Bug 121977 - Regression: AX: <table><caption> no longer exposed as AXTitle.
Summary: Regression: AX: <table><caption> no longer exposed as AXTitle.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Samuel White
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-09-26 13:54 PDT by James Craig
Modified: 2013-10-03 16:28 PDT (History)
14 users (show)

See Also:


Attachments
test case (1.07 KB, text/html)
2013-09-26 13:54 PDT, James Craig
no flags Details
Patch. (9.05 KB, patch)
2013-10-01 13:08 PDT, Samuel White
ddkilzer: review-
Details | Formatted Diff | Diff
Updated patch. (8.92 KB, patch)
2013-10-02 17:09 PDT, Samuel White
darin: review-
Details | Formatted Diff | Diff
Updated patch. (7.56 KB, patch)
2013-10-03 15:50 PDT, Samuel White
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Craig 2013-09-26 13:54:11 PDT
Created attachment 212741 [details]
test case 

Regression: AX: <table><caption> no longer exposed as AXTitle.

Table caption in attached file is exposed as AXTable->AXTitle in Safari 6, but not in the WebKit nightlies.
Comment 1 Radar WebKit Bug Importer 2013-09-26 13:54:26 PDT
<rdar://problem/15091139>
Comment 2 Samuel White 2013-10-01 13:08:14 PDT
Created attachment 213114 [details]
Patch.
Comment 3 David Kilzer (:ddkilzer) 2013-10-01 16:12:33 PDT
Comment on attachment 213114 [details]
Patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=213114&action=review

r- to add the missing checks and to share more code between the two methods.

> Source/WebCore/accessibility/AccessibilityTable.cpp:555
> +void AccessibilityTable::titleElementText(Vector<AccessibilityText>& textOrder) const
> +{

Seems like there are some checks missing here that appear in other methods, namely:

if (!isAccessibilityTable())
    return;

if (!m_renderer)
    return

> Source/WebCore/accessibility/AccessibilityTable.cpp:561
> +    Node* node = this->node();
> +    if (node && isHTMLTableElement(node)) {
> +        HTMLTableCaptionElement* caption = toHTMLTableElement(node)->caption();
> +        if (caption)
> +            textOrder.append(AccessibilityText(caption->innerText(), LabelByElementText));
> +    }

Instead of duplicating this code from AccessibilityTable::title(), try to share the code in AccessibilityTable::title() with this method.

Also, shouldn't you use m_renderer->node() instead of this->node() as in AccessibilityTable::title() below?
Comment 4 Samuel White 2013-10-01 16:38:04 PDT
(In reply to comment #3)
> (From update of attachment 213114 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=213114&action=review
> 
> r- to add the missing checks and to share more code between the two methods.
> 
> > Source/WebCore/accessibility/AccessibilityTable.cpp:555
> > +void AccessibilityTable::titleElementText(Vector<AccessibilityText>& textOrder) const
> > +{
> 
> Seems like there are some checks missing here that appear in other methods, namely:
> 
> if (!isAccessibilityTable())
>     return;
This check was omitted because isAccessibilityTable always returns true if we have a caption. In hindsight, I shouldn't depend on that heuristic to remain constant so I'll add an explicit isAccessibilityTable check as requested.
> 
> if (!m_renderer)
>     return
node() is just a convenience method on AccessibilityObject that contains the above renderer check.
> 
> > Source/WebCore/accessibility/AccessibilityTable.cpp:561
> > +    Node* node = this->node();
> > +    if (node && isHTMLTableElement(node)) {
> > +        HTMLTableCaptionElement* caption = toHTMLTableElement(node)->caption();
> > +        if (caption)
> > +            textOrder.append(AccessibilityText(caption->innerText(), LabelByElementText));
> > +    }
> 
> Instead of duplicating this code from AccessibilityTable::title(), try to share the code in AccessibilityTable::title() with this method.
Line 602 of AccessibilityObject.h notes that title() will be deprecated:

// Accessibility Text - (To be deprecated).
    virtual String accessibilityDescription() const { return String(); }
    virtual String title() const { return String(); }
    virtual String helpText() const { return String(); }

In fact I believe this regression is due to us moving away from title() and over to the accessibilityText stack. Therefore, I chose to avoid it to make the refactor easier moving forward. I can leverage it for now if you think this is premature.

> 
> Also, shouldn't you use m_renderer->node() instead of this->node() as in AccessibilityTable::title() below?

Thanks for the feedback David!
Comment 5 Samuel White 2013-10-02 17:09:26 PDT
Created attachment 213217 [details]
Updated patch.

Removed redundant code per review.
Comment 6 Darin Adler 2013-10-02 20:46:08 PDT
Comment on attachment 213217 [details]
Updated patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=213217&action=review

Looks generally good, but with a lot of “style changes” we probably don’t want.

> Source/WebCore/accessibility/AccessibilityImageMapLink.h:64
> +    virtual void accessibilityText(Vector<AccessibilityText>&) OVERRIDE;

Why does this need to be public? It is good to have overriding functions be private, even if the function they are overriding is public. It helps us detect people calling functions directly on derived classes but paying virtual dispatch overhead. In general, most virtual function overrides should be private.

> Source/WebCore/accessibility/AccessibilityMediaControls.h:50
> +    virtual void accessibilityText(Vector<AccessibilityText>&) OVERRIDE;

Same comment.

> Source/WebCore/accessibility/AccessibilityNodeObject.h:125
> +    virtual void accessibilityText(Vector<AccessibilityText>&) OVERRIDE;

Why does this function need to be public now? It was private before.

Strange that this function is non-const, but all the other nearly identical ones are const. Not new to this patch, though.

Also, as an aside, WebKit coding style would name this function getAccessibilityText. We use the prefix "get" to mean "returns a value through an out argument". Since you didn’t add this function, that doesn’t need to be fixed in this patch.

> Source/WebCore/accessibility/AccessibilityNodeObject.h:196
> +    virtual void titleElementText(Vector<AccessibilityText>&) const;
> +    virtual void alternativeText(Vector<AccessibilityText>&) const;
> +    virtual void visibleText(Vector<AccessibilityText>&) const;
> +    virtual void helpText(Vector<AccessibilityText>&) const;

Why do these functions need to be public now? They were private before.

Why do all of these functions need to be virtual now? Only titleElementText is now being overridden, so I would suggest making only it be virtual.

> Source/WebCore/accessibility/AccessibilityTable.h:96
> +    virtual void titleElementText(Vector<AccessibilityText>&) const OVERRIDE;

Should be private, not protected.
Comment 7 Samuel White 2013-10-03 15:50:15 PDT
Created attachment 213308 [details]
Updated patch.
Comment 8 Samuel White 2013-10-03 15:54:43 PDT
(In reply to comment #6)
> (From update of attachment 213217 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=213217&action=review
> 
> Looks generally good, but with a lot of “style changes” we probably don’t want.
> 
> > Source/WebCore/accessibility/AccessibilityImageMapLink.h:64
> > +    virtual void accessibilityText(Vector<AccessibilityText>&) OVERRIDE;
> 
> Why does this need to be public? It is good to have overriding functions be private, even if the function they are overriding is public. It helps us detect people calling functions directly on derived classes but paying virtual dispatch overhead. In general, most virtual function overrides should be private.

Fixed, thanks.

> 
> > Source/WebCore/accessibility/AccessibilityMediaControls.h:50
> > +    virtual void accessibilityText(Vector<AccessibilityText>&) OVERRIDE;
> 
> Same comment.

Same.

> 
> > Source/WebCore/accessibility/AccessibilityNodeObject.h:125
> > +    virtual void accessibilityText(Vector<AccessibilityText>&) OVERRIDE;
> 
> Why does this function need to be public now? It was private before.

I suspect that subclasses will augment the results returned by accessibilityText rather than doing a complete override. However, this was just a suspicion so we shouldn't make this change until that need becomes more clear. Thanks for pointing that out.

> 
> Strange that this function is non-const, but all the other nearly identical ones are const. Not new to this patch, though.

Agreed. I made titleElementText const for this reason.

> 
> Also, as an aside, WebKit coding style would name this function getAccessibilityText. We use the prefix "get" to mean "returns a value through an out argument". Since you didn’t add this function, that doesn’t need to be fixed in this patch.

Noted. Thanks for the tip.

> 
> > Source/WebCore/accessibility/AccessibilityNodeObject.h:196
> > +    virtual void titleElementText(Vector<AccessibilityText>&) const;
> > +    virtual void alternativeText(Vector<AccessibilityText>&) const;
> > +    virtual void visibleText(Vector<AccessibilityText>&) const;
> > +    virtual void helpText(Vector<AccessibilityText>&) const;
> 
> Why do these functions need to be public now? They were private before.

Same reasoning as above. I suspect augmentation will be necessary. Reverted until needs become more clear.

> 
> Why do all of these functions need to be virtual now? Only titleElementText is now being overridden, so I would suggest making only it be virtual.

Fixed.

> 
> > Source/WebCore/accessibility/AccessibilityTable.h:96
> > +    virtual void titleElementText(Vector<AccessibilityText>&) const OVERRIDE;
> 
> Should be private, not protected.

Fixed.


Thanks for taking a look Darin.
Comment 9 WebKit Commit Bot 2013-10-03 16:28:02 PDT
Comment on attachment 213308 [details]
Updated patch.

Clearing flags on attachment: 213308

Committed r156867: <http://trac.webkit.org/changeset/156867>
Comment 10 WebKit Commit Bot 2013-10-03 16:28:05 PDT
All reviewed patches have been landed.  Closing bug.