AX: textUnderElement should consider alt text, but skip links and controls
authordmazzoni@google.com <dmazzoni@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Dec 2012 22:24:03 +0000 (22:24 +0000)
committerdmazzoni@google.com <dmazzoni@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Dec 2012 22:24:03 +0000 (22:24 +0000)
commitb3cc8b3a9f44ec8d832d35cb45dd567b653c9e00
treeee501cebaba7359a248e59d9f6bc070a527dd048
parentccfa8865a55d11dd4a212f1b4073093a4e6e5cdb
AX: textUnderElement should consider alt text, but skip links and controls
https://bugs.webkit.org/show_bug.cgi?id=101650

Reviewed by Chris Fleizach.

Source/WebCore:

Getting inner text from an element now ignores focusable descendants
and containers, but uses alternative text.  The computation of
textUnderElement is now recursive and doesn't depend on text
iterators, which might not do the right thing for accessibility
anyways.

For GTK, the old behavior is retained so that support for
the object replacement character is still there. Filed a new
bug (105214) for GTK folks to look at this.

Test: accessibility/button-title-uses-inner-img-alt.html
Test: accessibility/focusable-div.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore):
(WebCore::shouldUseAccessiblityObjectInnerText):
(WebCore::AccessibilityNodeObject::textUnderElement):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::textUnderElement):

LayoutTests:

Adds new tests to show that getting inner text from an element
now ignores focusable descendants and containers, but uses alternative
text.

Updates and rebaselines several tests to reflect the new logic.
Skips these tests on GTK until support for the object replacement
character can be added.

* accessibility/button-title-uses-inner-img-alt-expected.txt: Added.
* accessibility/button-title-uses-inner-img-alt.html: Added.
* accessibility/focusable-div-expected.txt: Extended with more test cases.
* accessibility/focusable-div.html: Extended with more test cases.
* platform/chromium/TestExpectations: Un-skip test that now passes.
* platform/chromium/accessibility/image-link-expected.txt: Rebaseline
* platform/mac/accessibility/image-link-expected.txt: Rebaseline
* platform/mac/accessibility/internal-link-anchors2-expected.txt: Rebaseline
* platform/mac/accessibility/static-text-role-uses-text-under-element-expected.txt: Rebaseline
* platform/mac/accessibility/static-text-role-uses-text-under-element.html: Fix
* platform/mac/accessibility/table-with-aria-role-expected.txt: Rebaseline
* platform/gtk/TestExpectations: Skip these tests until this feature is implemented for GTK.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
LayoutTests/ChangeLog
LayoutTests/accessibility/button-title-uses-inner-img-alt-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/button-title-uses-inner-img-alt.html [new file with mode: 0644]
LayoutTests/accessibility/focusable-div-expected.txt
LayoutTests/accessibility/focusable-div.html
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/chromium/accessibility/image-link-expected.txt
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/mac/accessibility/image-link-expected.txt
LayoutTests/platform/mac/accessibility/internal-link-anchors2-expected.txt
LayoutTests/platform/mac/accessibility/static-text-role-uses-text-under-element-expected.txt
LayoutTests/platform/mac/accessibility/static-text-role-uses-text-under-element.html
LayoutTests/platform/mac/accessibility/table-with-aria-role-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityNodeObject.cpp
Source/WebCore/accessibility/AccessibilityRenderObject.cpp