Title: [198941] trunk
Revision
198941
Author
n_w...@apple.com
Date
2016-03-31 22:34:46 -0700 (Thu, 31 Mar 2016)

Log Message

AX: AX hit-testing does not work on WebKit video playback buttons
https://bugs.webkit.org/show_bug.cgi?id=156084

Reviewed by Darin Adler.

Source/WebCore:

Use the element at point instead of the shadow host for hit testing on video tags.

Test: accessibility/mac/video-tag-hit-test.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::elementAccessibilityHitTest):
(WebCore::shouldUseShadowHostForHitTesting):
(WebCore::AccessibilityRenderObject::accessibilityHitTest):

LayoutTests:

* accessibility/mac/video-tag-hit-test-expected.txt: Added.
* accessibility/mac/video-tag-hit-test.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (198940 => 198941)


--- trunk/LayoutTests/ChangeLog	2016-04-01 04:54:02 UTC (rev 198940)
+++ trunk/LayoutTests/ChangeLog	2016-04-01 05:34:46 UTC (rev 198941)
@@ -1,3 +1,13 @@
+2016-03-31  Nan Wang  <n_w...@apple.com>
+
+        AX: AX hit-testing does not work on WebKit video playback buttons
+        https://bugs.webkit.org/show_bug.cgi?id=156084
+
+        Reviewed by Darin Adler.
+
+        * accessibility/mac/video-tag-hit-test-expected.txt: Added.
+        * accessibility/mac/video-tag-hit-test.html: Added.
+
 2016-03-31  Daniel Bates  <daba...@apple.com>
 
         REGRESSION (r197724): <object>/<embed> with no URL does not match source *

Added: trunk/LayoutTests/accessibility/mac/video-tag-hit-test-expected.txt (0 => 198941)


--- trunk/LayoutTests/accessibility/mac/video-tag-hit-test-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/video-tag-hit-test-expected.txt	2016-04-01 05:34:46 UTC (rev 198941)
@@ -0,0 +1,13 @@
+
+This tests that hit testing works on video tag.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS element.role is 'AXRole: AXButton'
+PASS element.description is 'AXDescription: Play'
+PASS element.parentElement().role is 'AXRole: AXToolbar'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/mac/video-tag-hit-test.html (0 => 198941)


--- trunk/LayoutTests/accessibility/mac/video-tag-hit-test.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/video-tag-hit-test.html	2016-04-01 05:34:46 UTC (rev 198941)
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<style>
+div.absolute {
+    position: absolute;
+    top: 0px;
+    left: 0px;
+    width: 400px;
+    height: 200px;
+    border: 1px solid #73AD21;
+}
+</style>
+</head>
+<body id="body">
+
+<div class="absolute" id="container" tabindex=0 id="region" title="region">
+<video id="video" width="400" height="200" controls>
+  <source src="" type="video/mp4">
+  Test Video.
+</video>
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that hit testing works on video tag.");
+
+    if (window.accessibilityController) {
+    
+          var element = accessibilityController.elementAtPoint(10, 185);
+          shouldBe("element.role", "'AXRole: AXButton'");
+          shouldBe("element.description", "'AXDescription: Play'");
+          shouldBe("element.parentElement().role", "'AXRole: AXToolbar'");
+    }
+
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (198940 => 198941)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2016-04-01 04:54:02 UTC (rev 198940)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2016-04-01 05:34:46 UTC (rev 198941)
@@ -198,3 +198,6 @@
 
 # This test checks ScrollAnimator events only for main frame scrollbars that use native widgets in WK1.
 fast/scrolling/scroll-animator-overlay-scrollbars-hovered.html [ Skip ]
+
+# This hit-test test doesn't work on DRT
+webkit.org/b/156084 accessibility/mac/video-tag-hit-test.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (198940 => 198941)


--- trunk/Source/WebCore/ChangeLog	2016-04-01 04:54:02 UTC (rev 198940)
+++ trunk/Source/WebCore/ChangeLog	2016-04-01 05:34:46 UTC (rev 198941)
@@ -1,3 +1,19 @@
+2016-03-31  Nan Wang  <n_w...@apple.com>
+
+        AX: AX hit-testing does not work on WebKit video playback buttons
+        https://bugs.webkit.org/show_bug.cgi?id=156084
+
+        Reviewed by Darin Adler.
+
+        Use the element at point instead of the shadow host for hit testing on video tags.
+
+        Test: accessibility/mac/video-tag-hit-test.html
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::elementAccessibilityHitTest):
+        (WebCore::shouldUseShadowHostForHitTesting):
+        (WebCore::AccessibilityRenderObject::accessibilityHitTest):
+
 2016-03-31  Alexey Proskuryakov  <a...@apple.com>
 
         Page overlay tests sometimes crash under MockPageOverlayClient::uninstallAllOverlays()

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (198940 => 198941)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2016-04-01 04:54:02 UTC (rev 198940)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2016-04-01 05:34:46 UTC (rev 198941)
@@ -2249,6 +2249,12 @@
     return AccessibilityObject::elementAccessibilityHitTest(point);
 }
     
+static bool shouldUseShadowHostForHitTesting(Node* shadowHost)
+{
+    // We need to allow automation of mouse events on video tags.
+    return shadowHost && !shadowHost->hasTagName(videoTag);
+}
+
 AccessibilityObject* AccessibilityRenderObject::accessibilityHitTest(const IntPoint& point) const
 {
     if (!m_renderer || !m_renderer->hasLayer())
@@ -2261,9 +2267,12 @@
     HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::AccessibilityHitTest);
     HitTestResult hitTestResult = HitTestResult(point);
     layer->hitTest(request, hitTestResult);
-    if (!hitTestResult.innerNode())
+    Node* node = hitTestResult.innerNode();
+    if (!node)
         return nullptr;
-    Node* node = hitTestResult.innerNode()->deprecatedShadowAncestorNode();
+    Node* shadowAncestorNode = node->shadowHost();
+    if (shouldUseShadowHostForHitTesting(shadowAncestorNode))
+        node = shadowAncestorNode;
     ASSERT(node);
 
     if (is<HTMLAreaElement>(*node))
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to