Title: [163369] trunk
Revision
163369
Author
[email protected]
Date
2014-02-04 02:10:42 -0800 (Tue, 04 Feb 2014)

Log Message

[CSS Regions] Fix Assert SHOULD NEVER BE REACHED in RenderLayer::enclosingElement()
https://bugs.webkit.org/show_bug.cgi?id=123329

Patch by Mihai Maerean <[email protected]> on 2014-02-04
Reviewed by Mihnea Ovidenie.

Source/WebCore:

The flowthread doesn't have an enclosing element, so when hitting the layer of the
flowthread (e.g. the descent area of the RootInlineBox for the image flowed alone
inside the flow thread) we're letting the hit testing continue so it will hit the region.

Tests: fast/regions/assert-hit-test-image.html
       fast/regions/auto-size/region-same-height-as-div-with-inline-child.html

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

LayoutTests:

* fast/regions/assert-hit-test-image.html: Added.
* fast/regions/assert-hit-test-image-expected.txt: Added.
* fast/regions/auto-size/region-same-height-as-div-with-inline-child.html: Added.
* fast/regions/auto-size/region-same-height-as-div-with-inline-child-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (163368 => 163369)


--- trunk/LayoutTests/ChangeLog	2014-02-04 08:53:46 UTC (rev 163368)
+++ trunk/LayoutTests/ChangeLog	2014-02-04 10:10:42 UTC (rev 163369)
@@ -1,3 +1,15 @@
+2014-02-04  Mihai Maerean  <[email protected]>
+
+        [CSS Regions] Fix Assert SHOULD NEVER BE REACHED in RenderLayer::enclosingElement()
+        https://bugs.webkit.org/show_bug.cgi?id=123329
+
+        Reviewed by Mihnea Ovidenie.
+
+        * fast/regions/assert-hit-test-image.html: Added.
+        * fast/regions/assert-hit-test-image-expected.txt: Added.
+        * fast/regions/auto-size/region-same-height-as-div-with-inline-child.html: Added.
+        * fast/regions/auto-size/region-same-height-as-div-with-inline-child-expected.txt: Added.
+
 2014-02-04  Mihnea Ovidenie  <[email protected]>
 
         ASSERTION FAILED: !object || (object->isRenderBlock())

Added: trunk/LayoutTests/fast/regions/assert-hit-test-image-expected.txt (0 => 163369)


--- trunk/LayoutTests/fast/regions/assert-hit-test-image-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/assert-hit-test-image-expected.txt	2014-02-04 10:10:42 UTC (rev 163369)
@@ -0,0 +1,4 @@
+
+The test passes if it doesn't trigger an assert. When hitting the RootInlineBox of the flowed image, the region should be hit and have its :hover state activated.
+
+PASS

Added: trunk/LayoutTests/fast/regions/assert-hit-test-image.html (0 => 163369)


--- trunk/LayoutTests/fast/regions/assert-hit-test-image.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/assert-hit-test-image.html	2014-02-04 10:10:42 UTC (rev 163369)
@@ -0,0 +1,40 @@
+<!doctype html>
+<html>
+<head>
+    <title>Test - Bug 123329: [CSS Regions] Fix Assert SHOULD NEVER BE REACHED in RenderLayer::enclosingElement()</title>
+    <style>
+        .content {
+            -webkit-flow-into: flow;
+            width: 100px;
+            height: 100px;
+        }
+        .region {
+            -webkit-flow-from: flow;
+        }
+    </style>
+</head>
+<body>
+    <img src="" class="content"/>
+    <div class="region"></div>
+    <p>
+        The test passes if it doesn't trigger an assert.
+        When hitting the RootInlineBox of the flowed image, the region should be hit and have its :hover state activated.
+    </p>
+    <p class="result"></p>
+
+    <script type="text/_javascript_">
+        if (window.testRunner)
+            window.testRunner.dumpAsText(false);
+
+        function isHover(element) {
+            return (element.parentElement.querySelector(':hover') === element);
+        }
+
+        if(window.eventSender) {
+            var img = document.querySelector("img");
+            window.eventSender.mouseMoveTo( img.offsetLeft + 1, img.offsetTop + img.offsetHeight + 1 );
+            document.querySelector(".result").innerHTML = isHover(document.querySelector(".region")) ? "PASS" : "FAIL";
+        }
+    </script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/regions/auto-size/region-same-height-as-div-with-inline-child-expected.txt (0 => 163369)


--- trunk/LayoutTests/fast/regions/auto-size/region-same-height-as-div-with-inline-child-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/auto-size/region-same-height-as-div-with-inline-child-expected.txt	2014-02-04 10:10:42 UTC (rev 163369)
@@ -0,0 +1,4 @@
+
+
+The test passes if the height of the region/flowthread is the same as the height of the div containing the same inline content.
+PASS

Added: trunk/LayoutTests/fast/regions/auto-size/region-same-height-as-div-with-inline-child.html (0 => 163369)


--- trunk/LayoutTests/fast/regions/auto-size/region-same-height-as-div-with-inline-child.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/auto-size/region-same-height-as-div-with-inline-child.html	2014-02-04 10:10:42 UTC (rev 163369)
@@ -0,0 +1,42 @@
+<!doctype html>
+<html>
+<head>
+    <title>Test - Bug 123329: [CSS Regions] Fix Assert SHOULD NEVER BE REACHED in RenderLayer::enclosingElement()</title>
+    <style>
+        img {
+            width: 100px;
+            height: 100px;
+        }
+        .content {
+            -webkit-flow-into: flow;
+        }
+        .region {
+            -webkit-flow-from: flow;
+        }
+    </style>
+</head>
+<body>
+    <img src="" class="content"/>
+    <div class="region"></div>
+
+    <div class="nonRegion">
+        <img src=""
+    </div>
+
+    <div>
+        The test passes if the height of the region/flowthread is the same as the height of the div containing the same inline content.
+    </div>
+
+    <div class="result"></div>
+
+    <script type="text/_javascript_">
+        if (window.testRunner)
+            window.testRunner.dumpAsText(false);
+
+        var expected = document.querySelector(".nonRegion").offsetHeight;
+        var actual = document.querySelector(".region").offsetHeight;
+        document.querySelector(".result").innerHTML = (actual == expected) ? "PASS" : "FAIL expected=" + expected + " actual=" + actual;
+    </script>
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (163368 => 163369)


--- trunk/Source/WebCore/ChangeLog	2014-02-04 08:53:46 UTC (rev 163368)
+++ trunk/Source/WebCore/ChangeLog	2014-02-04 10:10:42 UTC (rev 163369)
@@ -1,3 +1,20 @@
+2014-02-04  Mihai Maerean  <[email protected]>
+
+        [CSS Regions] Fix Assert SHOULD NEVER BE REACHED in RenderLayer::enclosingElement()
+        https://bugs.webkit.org/show_bug.cgi?id=123329
+
+        Reviewed by Mihnea Ovidenie.
+
+        The flowthread doesn't have an enclosing element, so when hitting the layer of the
+        flowthread (e.g. the descent area of the RootInlineBox for the image flowed alone
+        inside the flow thread) we're letting the hit testing continue so it will hit the region.
+
+        Tests: fast/regions/assert-hit-test-image.html
+               fast/regions/auto-size/region-same-height-as-div-with-inline-child.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::hitTestContents):
+
 2014-02-04  Mihnea Ovidenie  <[email protected]>
 
         ASSERTION FAILED: !object || (object->isRenderBlock())

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (163368 => 163369)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-02-04 08:53:46 UTC (rev 163368)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-02-04 10:10:42 UTC (rev 163369)
@@ -5041,6 +5041,13 @@
     // the content in the layer has an element. So just walk up
     // the tree.
     if (!result.innerNode() || !result.innerNonSharedNode()) {
+        if (isOutOfFlowRenderFlowThread()) {
+            // The flowthread doesn't have an enclosing element, so when hitting the layer of the
+            // flowthread (e.g. the descent area of the RootInlineBox for the image flowed alone
+            // inside the flow thread) we're letting the hit testing continue so it will hit the region.
+            return false;
+        }
+
         Element* e = enclosingElement();
         if (!result.innerNode())
             result.setInnerNode(e);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to