Title: [185828] trunk
Revision
185828
Author
dba...@webkit.org
Date
2015-06-22 09:17:04 -0700 (Mon, 22 Jun 2015)

Log Message

AX: UI Automation cannot find AutoFill or search cancel buttons
https://bugs.webkit.org/show_bug.cgi?id=145241
<rdar://problem/21051411>

Reviewed by Chris Fleizach.

Source/WebCore:

Add support for hit testing the search cancel button and AutoFill button so that
they can be accessed by UI Automation.

Currently the accessibility hit test machinery ignores nodes in a shadow tree.
So, it neither finds the <input type="search"> cancel button nor the AutoFill button
when it performs a hit test. Therefore these buttons cannot be accessed using
UI Automation.

Tests: accessibility/hit-test-input-auto-fill-button.html
       accessibility/hit-test-input-search-cancel-button.html
       accessibility/input-search-cancel-button.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::accessibilityTextFieldDecorationHitTest): Added; returns
the AccessibilityObject for the search cancel button or AutoFill text field decoration as applicable.
(WebCore::AccessibilityRenderObject::accessibilityHitTest): Check whether the hit node
is a text field decoration.

LayoutTests:

Add tests to ensure that there exists an accessibility element for the
search cancel button and that it can be hit using a cursor position. Also
add a test to ensue that the AutoFill button can be hit using a cursor position.

* accessibility/hit-test-input-auto-fill-button-expected.txt: Added.
* accessibility/hit-test-input-auto-fill-button.html: Copied from LayoutTests/accessibility/input-auto-fill-button.html.
* accessibility/hit-test-input-search-cancel-button-expected.txt: Added.
* accessibility/hit-test-input-search-cancel-button.html: Added.
* accessibility/input-search-cancel-button-expected.txt: Added.
* accessibility/input-search-cancel-button.html: Copied from LayoutTests/accessibility/input-auto-fill-button.html.
* accessibility/resources/shouldBeAccessibleByCursor.js: Added.
(shouldBeAccessibleByCursor): Tests whether an AccessibilityUIElement can be hit
using its screen position.
* platform/wk2/TestExpectations: Mark tests hit-test-input-{auto-fill, search-cancel}-button.html
as failing due to <https://bugs.webkit.org/show_bug.cgi?id=71298>.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (185827 => 185828)


--- trunk/LayoutTests/ChangeLog	2015-06-22 14:32:48 UTC (rev 185827)
+++ trunk/LayoutTests/ChangeLog	2015-06-22 16:17:04 UTC (rev 185828)
@@ -1,3 +1,27 @@
+2015-06-22  Daniel Bates  <daba...@apple.com>
+
+        AX: UI Automation cannot find AutoFill or search cancel buttons
+        https://bugs.webkit.org/show_bug.cgi?id=145241
+        <rdar://problem/21051411>
+
+        Reviewed by Chris Fleizach.
+
+        Add tests to ensure that there exists an accessibility element for the
+        search cancel button and that it can be hit using a cursor position. Also
+        add a test to ensue that the AutoFill button can be hit using a cursor position.
+
+        * accessibility/hit-test-input-auto-fill-button-expected.txt: Added.
+        * accessibility/hit-test-input-auto-fill-button.html: Copied from LayoutTests/accessibility/input-auto-fill-button.html.
+        * accessibility/hit-test-input-search-cancel-button-expected.txt: Added.
+        * accessibility/hit-test-input-search-cancel-button.html: Added.
+        * accessibility/input-search-cancel-button-expected.txt: Added.
+        * accessibility/input-search-cancel-button.html: Copied from LayoutTests/accessibility/input-auto-fill-button.html.
+        * accessibility/resources/shouldBeAccessibleByCursor.js: Added.
+        (shouldBeAccessibleByCursor): Tests whether an AccessibilityUIElement can be hit
+        using its screen position.
+        * platform/wk2/TestExpectations: Mark tests hit-test-input-{auto-fill, search-cancel}-button.html
+        as failing due to <https://bugs.webkit.org/show_bug.cgi?id=71298>.
+
 2015-06-22  Xabier Rodriguez Calvar  <calva...@igalia.com> and Youenn Fablet  <youenn.fab...@crf.canon.fr>
 
         [Streams API] Implement ReadableStream cancel (abstract part)

Added: trunk/LayoutTests/accessibility/hit-test-input-auto-fill-button-expected.txt (0 => 185828)


--- trunk/LayoutTests/accessibility/hit-test-input-auto-fill-button-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/hit-test-input-auto-fill-button-expected.txt	2015-06-22 16:17:04 UTC (rev 185828)
@@ -0,0 +1,10 @@
+This tests that the AutoFill button is hit testable.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS AutoFill button can be hit.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/hit-test-input-auto-fill-button.html (0 => 185828)


--- trunk/LayoutTests/accessibility/hit-test-input-auto-fill-button.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/hit-test-input-auto-fill-button.html	2015-06-22 16:17:04 UTC (rev 185828)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<div id="description"></div>
+<input type="password" id="password">
+<div id="console"></div>
+<script>
+description("This tests that the AutoFill button is hit testable.");
+
+if (!window.internals || !window.accessibilityController)
+    testFailed("You must run this test in the test tool and have implemented window.internals and window.accessibilityController.");
+else {
+    internals.setShowAutoFillButton(document.getElementById("password"), true);
+
+    shouldBeAccessibleByCursor(accessibilityController.accessibleElementById("password").childAtIndex(0), "AutoFill button");
+}
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/accessibility/hit-test-input-search-cancel-button-expected.txt (0 => 185828)


--- trunk/LayoutTests/accessibility/hit-test-input-search-cancel-button-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/hit-test-input-search-cancel-button-expected.txt	2015-06-22 16:17:04 UTC (rev 185828)
@@ -0,0 +1,10 @@
+This tests that the search cancel button is hit testable.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS search cancel button can be hit.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/hit-test-input-search-cancel-button.html (0 => 185828)


--- trunk/LayoutTests/accessibility/hit-test-input-search-cancel-button.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/hit-test-input-search-cancel-button.html	2015-06-22 16:17:04 UTC (rev 185828)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<div id="description"></div>
+<input type="search" id="search" value="d" autofocus>
+<div id="console"></div>
+<script>
+description("This tests that the search cancel button is hit testable.");
+
+if (!window.internals || !window.accessibilityController)
+    testFailed("You must run this test in the test tool and have implemented window.internals and window.accessibilityController.");
+else {
+    shouldBeAccessibleByCursor(accessibilityController.accessibleElementById("search").childAtIndex(1), "search cancel button");
+}
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/accessibility/input-search-cancel-button-expected.txt (0 => 185828)


--- trunk/LayoutTests/accessibility/input-search-cancel-button-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/input-search-cancel-button-expected.txt	2015-06-22 16:17:04 UTC (rev 185828)
@@ -0,0 +1,11 @@
+This tests that there exists an accessibility element for the search cancel button.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS accessibilityController.accessibleElementById("search").childAtIndex(1).description is "AXDescription: cancel"
+PASS accessibilityController.accessibleElementById("search").childAtIndex(1).role is "AXRole: AXButton"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/input-search-cancel-button.html (0 => 185828)


--- trunk/LayoutTests/accessibility/input-search-cancel-button.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/input-search-cancel-button.html	2015-06-22 16:17:04 UTC (rev 185828)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<div id="description"></div>
+<input type="search" id="search" value="d" autofocus>
+<div id="console"></div>
+<script>
+description("This tests that there exists an accessibility element for the search cancel button.");
+
+if (!window.internals || !window.accessibilityController)
+    testFailed("You must run this test in the test tool and have implemented window.internals and window.accessibilityController.");
+else {
+    shouldBeEqualToString('accessibilityController.accessibleElementById("search").childAtIndex(1).description', "AXDescription: cancel");
+    shouldBeEqualToString('accessibilityController.accessibleElementById("search").childAtIndex(1).role', "AXRole: AXButton");
+}
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/accessibility/resources/shouldBeAccessibleByCursor.js (0 => 185828)


--- trunk/LayoutTests/accessibility/resources/shouldBeAccessibleByCursor.js	                        (rev 0)
+++ trunk/LayoutTests/accessibility/resources/shouldBeAccessibleByCursor.js	2015-06-22 16:17:04 UTC (rev 185828)
@@ -0,0 +1,14 @@
+function shouldBeAccessibleByCursor(accessibilityElement, displayName)
+{
+    console.assert(window.accessibilityController);
+    var x = accessibilityElement.x + accessibilityElement.width / 2;
+    var y = accessibilityElement.y + accessibilityElement.height / 2;
+    var hitElement = accessibilityController.elementAtPoint(x, y);
+    if (accessibilityElement.isEqual(hitElement))
+        testPassed(displayName + " can be hit.");
+    else {
+        testFailed("should have hit " + displayName + " at (" + x + ", " + y + "). Hit element " + hitElement + ":");
+        if (hitElement)
+            debug(hitElement.allAttributes());
+    }
+}

Modified: trunk/LayoutTests/platform/wk2/TestExpectations (185827 => 185828)


--- trunk/LayoutTests/platform/wk2/TestExpectations	2015-06-22 14:32:48 UTC (rev 185827)
+++ trunk/LayoutTests/platform/wk2/TestExpectations	2015-06-22 16:17:04 UTC (rev 185828)
@@ -46,6 +46,8 @@
 webkit.org/b/101773 fast/repaint/body-background-image.html [ ImageOnlyFailure Pass ]
 
 # AX tests that require hit testing do not work in WK2.
+webkit.org/b/71298 accessibility/hit-test-input-auto-fill-button.html
+webkit.org/b/71298 accessibility/hit-test-input-search-cancel-button.html
 webkit.org/b/71298 accessibility/loading-iframe-updates-axtree.html
 webkit.org/b/71298 platform/mac/accessibility/html-slider-indicator.html
 webkit.org/b/71298 platform/mac/accessibility/listbox-hit-test.html

Modified: trunk/Source/WebCore/ChangeLog (185827 => 185828)


--- trunk/Source/WebCore/ChangeLog	2015-06-22 14:32:48 UTC (rev 185827)
+++ trunk/Source/WebCore/ChangeLog	2015-06-22 16:17:04 UTC (rev 185828)
@@ -1,3 +1,29 @@
+2015-06-22  Daniel Bates  <daba...@apple.com>
+
+        AX: UI Automation cannot find AutoFill or search cancel buttons
+        https://bugs.webkit.org/show_bug.cgi?id=145241
+        <rdar://problem/21051411>
+
+        Reviewed by Chris Fleizach.
+
+        Add support for hit testing the search cancel button and AutoFill button so that
+        they can be accessed by UI Automation.
+
+        Currently the accessibility hit test machinery ignores nodes in a shadow tree.
+        So, it neither finds the <input type="search"> cancel button nor the AutoFill button
+        when it performs a hit test. Therefore these buttons cannot be accessed using
+        UI Automation.
+
+        Tests: accessibility/hit-test-input-auto-fill-button.html
+               accessibility/hit-test-input-search-cancel-button.html
+               accessibility/input-search-cancel-button.html
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::accessibilityTextFieldDecorationHitTest): Added; returns
+        the AccessibilityObject for the search cancel button or AutoFill text field decoration as applicable.
+        (WebCore::AccessibilityRenderObject::accessibilityHitTest): Check whether the hit node
+        is a text field decoration.
+
 2015-06-22  Xabier Rodriguez Calvar  <calva...@igalia.com> and Youenn Fablet  <youenn.fab...@crf.canon.fr>
 
         [Streams API] Implement ReadableStream cancel (abstract part)

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (185827 => 185828)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2015-06-22 14:32:48 UTC (rev 185827)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2015-06-22 16:17:04 UTC (rev 185828)
@@ -2195,6 +2195,16 @@
     return nullptr;
 }
 
+AccessibilityObject* AccessibilityRenderObject::accessibilityTextFieldDecorationHitTest(const HTMLInputElement& inputElement, const Node& decoration) const
+{
+    if (inputElement.autoFillButtonElement() == &decoration || inputElement.cancelButtonElement() == &decoration) {
+        AccessibilityObject* object = axObjectCache()->getOrCreate(decoration.renderer());
+        if (object && !object->accessibilityIsIgnored())
+            return object;
+    }
+    return nullptr;
+}
+
 AccessibilityObject* AccessibilityRenderObject::remoteSVGElementHitTest(const IntPoint& point) const
 {
     AccessibilityObject* remote = remoteSVGRootElement();
@@ -2230,6 +2240,11 @@
     Node* node = hitTestResult.innerNode()->deprecatedShadowAncestorNode();
     ASSERT(node);
 
+    if (is<HTMLInputElement>(*node)) {
+        if (AccessibilityObject* object = accessibilityTextFieldDecorationHitTest(downcast<HTMLInputElement>(*node), *hitTestResult.innerNode()))
+            return object;
+    }
+
     if (is<HTMLAreaElement>(*node))
         return accessibilityImageMapHitTest(downcast<HTMLAreaElement>(node), point);
     

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h (185827 => 185828)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h	2015-06-22 14:32:48 UTC (rev 185827)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h	2015-06-22 16:17:04 UTC (rev 185828)
@@ -242,6 +242,7 @@
     void addRadioButtonGroupMembers(AccessibilityChildrenVector& linkedUIElements) const;
     AccessibilityObject* internalLinkElement() const;
     AccessibilityObject* accessibilityImageMapHitTest(HTMLAreaElement*, const IntPoint&) const;
+    AccessibilityObject* accessibilityTextFieldDecorationHitTest(const HTMLInputElement&, const Node&) const;
     AccessibilityObject* accessibilityParentForImageMap(HTMLMapElement*) const;
     virtual AccessibilityObject* elementAccessibilityHitTest(const IntPoint&) const override;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to