Title: [219551] trunk
Revision
219551
Author
[email protected]
Date
2017-07-16 19:10:42 -0700 (Sun, 16 Jul 2017)

Log Message

DisallowUserAgentShadowContent moves out of non-UA shadow roots
https://bugs.webkit.org/show_bug.cgi?id=165647

Patch by Ali Juma <[email protected]> on 2017-07-16
Reviewed by Ryosuke Niwa.

Source/WebCore:

Make rect-based hit-testing include nodes in non-UA shadow trees when the
HitTestRequest has type DisallowUserAgentShadowContent.

Test: fast/dom/nodesFromRect/nodesFromRect-shadow.html

* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::addNodeToRectBasedTestResult):
* testing/Internals.cpp:
(WebCore::Internals::nodesFromRect):
* testing/Internals.h:

LayoutTests:

* fast/dom/nodesFromRect/nodesFromRect-shadow-expected.txt: Added.
* fast/dom/nodesFromRect/nodesFromRect-shadow.html: Added.
* fast/dom/nodesFromRect/resources/nodesFromRect.js:
(check):
(checkShadowContent):
(nodesFromRectAsString):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (219550 => 219551)


--- trunk/LayoutTests/ChangeLog	2017-07-17 01:43:14 UTC (rev 219550)
+++ trunk/LayoutTests/ChangeLog	2017-07-17 02:10:42 UTC (rev 219551)
@@ -1,3 +1,17 @@
+2017-07-16  Ali Juma  <[email protected]>
+
+        DisallowUserAgentShadowContent moves out of non-UA shadow roots
+        https://bugs.webkit.org/show_bug.cgi?id=165647
+
+        Reviewed by Ryosuke Niwa.
+
+        * fast/dom/nodesFromRect/nodesFromRect-shadow-expected.txt: Added.
+        * fast/dom/nodesFromRect/nodesFromRect-shadow.html: Added.
+        * fast/dom/nodesFromRect/resources/nodesFromRect.js:
+        (check):
+        (checkShadowContent):
+        (nodesFromRectAsString):
+
 2017-07-16  Antoine Quint  <[email protected]>
 
         Clicking edges of media control buttons changes visual state of button (pressed) but doesn't execute action

Added: trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-shadow-expected.txt (0 => 219551)


--- trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-shadow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-shadow-expected.txt	2017-07-17 02:10:42 UTC (rev 219551)
@@ -0,0 +1,7 @@
+PASS All correct nodes found for rect
+PASS All correct nodes found for rect
+PASS All correct nodes found for rect
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-shadow.html (0 => 219551)


--- trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-shadow.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/nodesFromRect/nodesFromRect-shadow.html	2017-07-17 02:10:42 UTC (rev 219551)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src=""
+    <script src=""
+    <style>
+        .box {
+            width: 30px;
+            height: 30px;
+            padding: 0px;
+        }
+     </style>
+</head>
+<body id="body">
+    <div id="d1" class="box"></div>
+
+    <div id="d2" class="box"></div>
+
+    <div id="shadowHost" class="box"></div>
+
+    <div id="console"></div>
+
+    <script>
+        checkRect(10, 45, 15, 30, "DIV#shadowHost, DIV#d2, BODY#body");
+
+        var host = document.getElementById("shadowHost");
+        var shadow = host.attachShadow({mode: 'closed'});
+        shadow.innerHTML="<content>text</content>";
+
+        checkRect(10, 45, 15, 30, "'text', CONTENT, DIV#shadowHost, DIV#d2, BODY#body");
+
+        shadow.innerHTML="<slot></slot>";
+        host.innerHTML="<inner-host></inner-host>";
+        var innerHost = host.querySelector("inner-host");
+        var innerShadow = innerHost.attachShadow({mode: 'closed'});
+        innerShadow.innerHTML = "<content>text</content>";
+
+        checkRect(10, 45, 15, 30, "'text', CONTENT, INNER-HOST, DIV#shadowHost, DIV#d2, BODY#body");
+    </script>
+    <script src=""
+</body>
+</html>
+

Modified: trunk/LayoutTests/fast/dom/nodesFromRect/resources/nodesFromRect.js (219550 => 219551)


--- trunk/LayoutTests/fast/dom/nodesFromRect/resources/nodesFromRect.js	2017-07-17 01:43:14 UTC (rev 219550)
+++ trunk/LayoutTests/fast/dom/nodesFromRect/resources/nodesFromRect.js	2017-07-17 02:10:42 UTC (rev 219551)
@@ -42,7 +42,7 @@
   if (!doc)
     doc = document;
 
-  var nodes = internals.nodesFromRect(doc, x, y, topPadding, rightPadding, bottomPadding, leftPadding, true /* ignoreClipping */, false /* allow shadow content */, false /* allow child-frame content */);
+  var nodes = internals.nodesFromRect(doc, x, y, topPadding, rightPadding, bottomPadding, leftPadding, true /* ignoreClipping */, false /* allow user-agent shadow content */, false /* allow child-frame content */);
   if (!nodes)
     return;
 
@@ -78,7 +78,7 @@
   if (!doc)
     doc = document;
 
-  var nodes = internals.nodesFromRect(doc, x, y, topPadding, rightPadding, bottomPadding, leftPadding, true /* ignoreClipping */, true /* allowShadowContent */, false /* allow child-frame content */);
+  var nodes = internals.nodesFromRect(doc, x, y, topPadding, rightPadding, bottomPadding, leftPadding, true /* ignoreClipping */, true /* allowUserAgentShadowContent */, false /* allow child-frame content */);
   if (!nodes)
     return;
 
@@ -145,7 +145,7 @@
 
 function nodesFromRectAsString(doc, x, y, topPadding, rightPadding, bottomPadding, leftPadding)
 {
-    var nodes = internals.nodesFromRect(doc, x, y, topPadding, rightPadding, bottomPadding, leftPadding, true /* ignoreClipping */, false /* allow shadow content */, true /* allow child-frame content */);
+    var nodes = internals.nodesFromRect(doc, x, y, topPadding, rightPadding, bottomPadding, leftPadding, true /* ignoreClipping */, false /* allow user-agent shadow content */, true /* allow child-frame content */);
     if (!nodes)
         return "";
 

Modified: trunk/Source/WebCore/ChangeLog (219550 => 219551)


--- trunk/Source/WebCore/ChangeLog	2017-07-17 01:43:14 UTC (rev 219550)
+++ trunk/Source/WebCore/ChangeLog	2017-07-17 02:10:42 UTC (rev 219551)
@@ -1,3 +1,21 @@
+2017-07-16  Ali Juma  <[email protected]>
+
+        DisallowUserAgentShadowContent moves out of non-UA shadow roots
+        https://bugs.webkit.org/show_bug.cgi?id=165647
+
+        Reviewed by Ryosuke Niwa.
+
+        Make rect-based hit-testing include nodes in non-UA shadow trees when the
+        HitTestRequest has type DisallowUserAgentShadowContent.
+
+        Test: fast/dom/nodesFromRect/nodesFromRect-shadow.html
+
+        * rendering/HitTestResult.cpp:
+        (WebCore::HitTestResult::addNodeToRectBasedTestResult):
+        * testing/Internals.cpp:
+        (WebCore::Internals::nodesFromRect):
+        * testing/Internals.h:
+
 2017-07-16  Antoine Quint  <[email protected]>
 
         Clicking edges of media control buttons changes visual state of button (pressed) but doesn't execute action

Modified: trunk/Source/WebCore/rendering/HitTestResult.cpp (219550 => 219551)


--- trunk/Source/WebCore/rendering/HitTestResult.cpp	2017-07-17 01:43:14 UTC (rev 219550)
+++ trunk/Source/WebCore/rendering/HitTestResult.cpp	2017-07-17 02:10:42 UTC (rev 219551)
@@ -667,8 +667,7 @@
     if (!node)
         return true;
 
-    // FIXME: This moves out of a author shadow tree.
-    if (request.disallowsUserAgentShadowContent())
+    if (request.disallowsUserAgentShadowContent() && node->isInUserAgentShadowTree())
         node = node->document().ancestorNodeInThisScope(node);
 
     mutableRectBasedTestResult().add(node);
@@ -688,8 +687,7 @@
     if (!node)
         return true;
 
-    // FIXME: This moves out of a author shadow tree.
-    if (request.disallowsUserAgentShadowContent())
+    if (request.disallowsUserAgentShadowContent() && node->isInUserAgentShadowTree())
         node = node->document().ancestorNodeInThisScope(node);
 
     mutableRectBasedTestResult().add(node);

Modified: trunk/Source/WebCore/testing/Internals.cpp (219550 => 219551)


--- trunk/Source/WebCore/testing/Internals.cpp	2017-07-17 01:43:14 UTC (rev 219550)
+++ trunk/Source/WebCore/testing/Internals.cpp	2017-07-17 02:10:42 UTC (rev 219551)
@@ -1835,7 +1835,7 @@
 // contextDocument(), with the exception of a few tests that pass a
 // different document, and could just make the call through another Internals
 // instance instead.
-ExceptionOr<RefPtr<NodeList>> Internals::nodesFromRect(Document& document, int centerX, int centerY, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent) const
+ExceptionOr<RefPtr<NodeList>> Internals::nodesFromRect(Document& document, int centerX, int centerY, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowUserAgentShadowContent, bool allowChildFrameContent) const
 {
     if (!document.frame() || !document.frame()->view())
         return Exception { INVALID_ACCESS_ERR };
@@ -1854,7 +1854,7 @@
     HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active;
     if (ignoreClipping)
         hitType |= HitTestRequest::IgnoreClipping;
-    if (!allowShadowContent)
+    if (!allowUserAgentShadowContent)
         hitType |= HitTestRequest::DisallowUserAgentShadowContent;
     if (allowChildFrameContent)
         hitType |= HitTestRequest::AllowChildFrameContent;

Modified: trunk/Source/WebCore/testing/Internals.h (219550 => 219551)


--- trunk/Source/WebCore/testing/Internals.h	2017-07-17 01:43:14 UTC (rev 219550)
+++ trunk/Source/WebCore/testing/Internals.h	2017-07-17 02:10:42 UTC (rev 219551)
@@ -249,7 +249,7 @@
     ExceptionOr<Ref<DOMRectList>> touchEventRectsForEvent(const String&);
     ExceptionOr<Ref<DOMRectList>> passiveTouchEventListenerRects();
 
-    ExceptionOr<RefPtr<NodeList>> nodesFromRect(Document&, int x, int y, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent) const;
+    ExceptionOr<RefPtr<NodeList>> nodesFromRect(Document&, int x, int y, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowUserAgentShadowContent, bool allowChildFrameContent) const;
 
     String parserMetaData(JSC::JSValue = JSC::JSValue::JSUndefined);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to