Bug 99502 - AX: Refactor accessibility name computation so it's more platform independent
Summary: AX: Refactor accessibility name computation so it's more platform independent
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: chris fleizach
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-16 13:59 PDT by chris fleizach
Modified: 2012-10-19 09:26 PDT (History)
8 users (show)

See Also:


Attachments
patch (32.93 KB, patch)
2012-10-17 01:12 PDT, chris fleizach
webkit.review.bot: commit-queue-
Details | Formatted Diff | Diff
patch (33.37 KB, patch)
2012-10-17 18:01 PDT, chris fleizach
bdakin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description chris fleizach 2012-10-16 13:59:46 PDT
The current model of determining the accessible text for an object has a lot of Mac biases built in due to legacy implementation. 

This patch will categorize and order accessibility text based on WAI-ARIA text computation rules and then allows the platform (only Mac right now) to decide how best to apply that text to its own AX API.
Comment 1 chris fleizach 2012-10-17 01:12:05 PDT
Created attachment 169116 [details]
patch
Comment 2 WebKit Review Bot 2012-10-17 03:08:04 PDT
Comment on attachment 169116 [details]
patch

Attachment 169116 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/14395502

New failing tests:
accessibility/loading-iframe-sends-notification.html
Comment 3 chris fleizach 2012-10-17 08:19:42 PDT
Hard to believe that 
accessibility/loading-iframe-sends-notification.html

is failing because of this patch. It does run fine on Mac and this patch shouldn't affect other platforms.
Comment 4 Mario Sanchez Prada 2012-10-17 08:34:57 PDT
Comment on attachment 169116 [details]
patch

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

I like the idea, since it should make it easier for ports to "select" which accessible textual information is interested in in any case, without having to reinvent the wheel.

Besides, I've informally reviewed the patch and it mostly looks good to me, although it would be worth to try to understand why it made that layout test fail in chromium EWS.

I just have some really minor comments probably a bit too subjective sometimes. See them below

> Source/WebCore/ChangeLog:12
> +        This change categorizes and orders accessibility text based on WAI-ARIA text computation rules and then
> +        allows the platform (only Mac right now) to decide how best to apply that text to its own AX API.

A link to the part of the WAI-ARIA specification where these rules are explained might be useful here.

> Source/WebCore/ChangeLog:72
> +        (WebCore::localizedMediaControlElementHelpText):

I know it's a pain, but in theory we should be adding a short description to every function in the ChangeLog

> Source/WebCore/accessibility/AccessibilityObject.h:546
> +    // Accessibility Text - (To be deprecated).
> +    virtual String accessibilityDescription() const { return String(); }
> +    virtual String title() const { return String(); }
> +    virtual String helpText() const { return String(); }

I understand that other ports (e.g. GTK) should migrate the usage of these functions to the new AccessibilityText API, right?

> Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1096
> +    

Extra line

> Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1107
> +    titleElementText(textOrder);
> +    
> +    alternativeText(textOrder);
> +    
> +    visibleText(textOrder);
> +    
> +    helpText(textOrder);

I would probably compact these without extra lines. Also, I would try to keep them in the same order as they are declared in the header file:

    void alternativeText(Vector<AccessibilityText>&) const;
    void visibleText(Vector<AccessibilityText>&) const;
    void titleElementText(Vector<AccessibilityText>&);
    void helpText(Vector<AccessibilityText>&) const;
    String alternativeTextForWebArea() const;
    void ariaLabeledByText(Vector<AccessibilityText>&) const;

Additionally I would probably reorder the definitions for these functions in this same file to be consistent too with that order. I think it would make the code easier to read.

Just a suggestion, not a big deal anyway as it's just a matter of taster

> Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1251
> +    if (isHeading() || isLink())
> +        useTextUnderElement = true;
> +    
> +    // If it's focusable but it's not content editable or a known control type, then it will appear to
> +    // the user as a single atomic object, so we should use its text as the default title.                              
> +    if (isGenericFocusableElement())
> +        useTextUnderElement = true;

Would it make sense to merge these two ifs in a single block?

> Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1258
> +

Extra line
Comment 5 Dominic Mazzoni 2012-10-17 08:56:56 PDT
(In reply to comment #3)
> Hard to believe that 
> accessibility/loading-iframe-sends-notification.html
> 
> is failing because of this patch. It does run fine on Mac and this patch shouldn't affect other platforms.

I think the test may be too brittle. Mark it as skipped and assign the bug to me, with a note to take a look after this bug lands.

- Dominic
Comment 6 chris fleizach 2012-10-17 18:01:34 PDT
Created attachment 169318 [details]
patch
Comment 7 chris fleizach 2012-10-19 09:26:32 PDT
http://trac.webkit.org/changeset/131905