Title: [278969] trunk
Revision
278969
Author
hey...@apple.com
Date
2021-06-16 17:27:58 -0700 (Wed, 16 Jun 2021)

Log Message

Make RenderLayer::hitTestLayer not assume its renderer is a RenderBox
https://bugs.webkit.org/show_bug.cgi?id=227004
<rdar://79265788>

Reviewed by Simon Fraser.

Source/WebCore:

An inline box might have a clip-path on it, so we can't assume that
the layer's renderer is a RenderBox. Avoid the assertion by hit testing
incorrectly for now.

Test: css3/masking/clip-path-hit-test-on-inline-iframe-parent.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hitTestLayer):

LayoutTests:

* css3/masking/clip-path-hit-test-on-inline-iframe-parent-expected.txt: Added.
* css3/masking/clip-path-hit-test-on-inline-iframe-parent.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (278968 => 278969)


--- trunk/LayoutTests/ChangeLog	2021-06-17 00:15:49 UTC (rev 278968)
+++ trunk/LayoutTests/ChangeLog	2021-06-17 00:27:58 UTC (rev 278969)
@@ -1,3 +1,14 @@
+2021-06-16  Cameron McCormack  <hey...@apple.com>
+
+        Make RenderLayer::hitTestLayer not assume its renderer is a RenderBox
+        https://bugs.webkit.org/show_bug.cgi?id=227004
+        <rdar://79265788>
+
+        Reviewed by Simon Fraser.
+
+        * css3/masking/clip-path-hit-test-on-inline-iframe-parent-expected.txt: Added.
+        * css3/masking/clip-path-hit-test-on-inline-iframe-parent.html: Added.
+
 2021-06-16  Arcady Goldmints-Orlov  <agoldmi...@igalia.com>
 
         [GLIB] Unreviewed test gardening. Skip another WebGL 2 test.

Added: trunk/LayoutTests/css3/masking/clip-path-hit-test-on-inline-iframe-parent-expected.txt (0 => 278969)


--- trunk/LayoutTests/css3/masking/clip-path-hit-test-on-inline-iframe-parent-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/masking/clip-path-hit-test-on-inline-iframe-parent-expected.txt	2021-06-17 00:27:58 UTC (rev 278969)
@@ -0,0 +1,11 @@
+Test clip-path is accounted for during hit-testing on an iframe's inline parent.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+FAIL document.elementFromPoint(50, 50).localName should be body. Was iframe.
+PASS successfullyParsed is true
+Some tests failed.
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/css3/masking/clip-path-hit-test-on-inline-iframe-parent.html (0 => 278969)


--- trunk/LayoutTests/css3/masking/clip-path-hit-test-on-inline-iframe-parent.html	                        (rev 0)
+++ trunk/LayoutTests/css3/masking/clip-path-hit-test-on-inline-iframe-parent.html	2021-06-17 00:27:58 UTC (rev 278969)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Hit testing of iframe with clip-path on a parent inline element</title>
+<script src=""
+<script type="text/_javascript_">
+
+function runTest() {
+    description("Test clip-path is accounted for during hit-testing on an iframe's inline parent.");
+    shouldBeEqualToString("document.elementFromPoint(50, 50).localName", "body");
+}
+
+</script>
+<style>
+
+#container, iframe {
+    width: 400px;
+    height: 300px;
+}
+
+#container {
+    position: absolute;
+    top: 0;
+    left: 0px;
+}
+
+#container > span {
+    clip-path: inset(100px 0 0 0);
+    font: 300px sans-serif;
+    vertical-align: top;
+}
+
+iframe {
+    border: 0;
+}
+
+p {
+    pointer-events: none;
+}
+
+</style>
+</head>
+<body>
+<div id="container"><span><iframe srcdoc="<body style='margin: 0; background: blue'></body>" _onload_="runTest()"></iframe></span></div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (278968 => 278969)


--- trunk/Source/WebCore/ChangeLog	2021-06-17 00:15:49 UTC (rev 278968)
+++ trunk/Source/WebCore/ChangeLog	2021-06-17 00:27:58 UTC (rev 278969)
@@ -1,3 +1,20 @@
+2021-06-16  Cameron McCormack  <hey...@apple.com>
+
+        Make RenderLayer::hitTestLayer not assume its renderer is a RenderBox
+        https://bugs.webkit.org/show_bug.cgi?id=227004
+        <rdar://79265788>
+
+        Reviewed by Simon Fraser.
+
+        An inline box might have a clip-path on it, so we can't assume that
+        the layer's renderer is a RenderBox. Avoid the assertion by hit testing
+        incorrectly for now.
+
+        Test: css3/masking/clip-path-hit-test-on-inline-iframe-parent.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::hitTestLayer):
+
 2021-06-16  Chris Dumez  <cdu...@apple.com>
 
         Protect Element before calling dispatchMouseEvent() on it

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (278968 => 278969)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2021-06-17 00:15:49 UTC (rev 278968)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2021-06-17 00:27:58 UTC (rev 278969)
@@ -4111,7 +4111,8 @@
     LayerListMutationDetector mutationChecker(*this);
 #endif
 
-    if (renderer().hasClipPath() && !downcast<RenderBox>(renderer()).hitTestClipPath(hitTestLocation, toLayoutPoint(location() - renderBoxLocation())))
+    // FIXME: We need to correctly hit test the clip-path when we have a RenderInline too.
+    if (renderer().hasClipPath() && is<RenderBox>(renderer()) && !downcast<RenderBox>(renderer()).hitTestClipPath(hitTestLocation, toLayoutPoint(location() - renderBoxLocation())))
         return nullptr;
 
     // Begin by walking our list of positive layers from highest z-index down to the lowest z-index.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to