REGRESSION: [CSS Regions] Content flowed directly into the flow thread that ends...
authorstavila@adobe.com <stavila@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 May 2014 17:38:04 +0000 (17:38 +0000)
committerstavila@adobe.com <stavila@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 May 2014 17:38:04 +0000 (17:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=133111

Reviewed by David Hyatt.

Source/WebCore:
When computing the repaint rect of an element flowed into a flow thread, if the element is flowed directly into
the flow thread (meaning its containing block is the flow thread itself), the region's position within the flow
must no longer be taken into consideration, because its already included in the element's |topLeft|.

Test: fast/regions/hover-element-flowed-second-region.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeRectForRepaint):

LayoutTests:
Added test for the correct repaint of an element flowed directly into the second region of a flow thread.

* fast/regions/hover-element-flowed-second-region-expected.html: Added.
* fast/regions/hover-element-flowed-second-region.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@169120 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/regions/hover-element-flowed-second-region-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/hover-element-flowed-second-region.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBox.cpp

index 3c8b31d..e61d2ed 100644 (file)
@@ -1,3 +1,15 @@
+2014-05-20  Radu Stavila  <stavila@adobe.com>
+
+        REGRESSION: [CSS Regions] Content flowed directly into the flow thread that ends up in the second region is not properly repainted
+        https://bugs.webkit.org/show_bug.cgi?id=133111
+
+        Reviewed by David Hyatt.
+
+        Added test for the correct repaint of an element flowed directly into the second region of a flow thread.
+
+        * fast/regions/hover-element-flowed-second-region-expected.html: Added.
+        * fast/regions/hover-element-flowed-second-region.html: Added.
+
 2014-05-20  Prashant Hiremath  <hiremathprashants@gmail.com>
 
         Only set title on SVG documents
diff --git a/LayoutTests/fast/regions/hover-element-flowed-second-region-expected.html b/LayoutTests/fast/regions/hover-element-flowed-second-region-expected.html
new file mode 100644 (file)
index 0000000..e750937
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+
+<head>
+    <style>
+        .region {
+            -webkit-flow-from: flow;
+            border: 2px solid blue;
+            width: 100px;
+            height: 100px;
+            margin: 10px;
+        }
+        #region2 {
+            margin-top: 10px;
+        }
+        .content {
+            -webkit-flow-into: flow;
+            background-color: green;
+            width: 100px;
+            height: 100px;
+        }
+
+        #content2 {
+            background-color: red;
+        }
+    </style>
+</head>
+
+<body>
+    <a href="https://bugs.webkit.org/show_bug.cgi?id=133111">Bug 133111 - [CSS Regions] Content flowed directly into the flow thread that ends up in the second region is not properly repainted</a>
+    <p>When hovered, the <span style="color:green"><b>green</b></span> content should turn <span style="color:red"><b>red</b></span>.</p>
+    <div class="region" id="region1"></div>
+    <div class="region" id="region2"></div>
+    <div class="content" id="content1"></div>
+    <div class="content" id="content2"></div>
+</body>
\ No newline at end of file
diff --git a/LayoutTests/fast/regions/hover-element-flowed-second-region.html b/LayoutTests/fast/regions/hover-element-flowed-second-region.html
new file mode 100644 (file)
index 0000000..9818499
--- /dev/null
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+
+<head>
+    <style>
+        .region {
+            -webkit-flow-from: flow;
+            border: 2px solid blue;
+            width: 100px;
+            height: 100px;
+            margin: 10px;
+        }
+        #region2 {
+            margin-top: 10px;
+        }
+        .content {
+            -webkit-flow-into: flow;
+            background-color: green;
+            width: 100px;
+            height: 100px;
+        }
+
+        .content:hover {
+            background-color: red;
+        }
+    </style>
+</head>
+
+<script type="text/javascript">
+    if (window.testRunner)
+        testRunner.waitUntilDone();
+
+    function beginTest() {
+        if (window.eventSender) {
+
+            // move mouse on the hover test object
+            var content2 = document.getElementById("region2");
+            eventSender.mouseMoveTo(content2.offsetLeft + 20, content2.offsetTop + 20);
+            eventSender.mouseDown(0);
+
+            testRunner.notifyDone();
+        }
+    }
+</script>
+
+<body onload="beginTest()">
+    <a href="https://bugs.webkit.org/show_bug.cgi?id=133111">Bug 133111 - [CSS Regions] Content flowed directly into the flow thread that ends up in the second region is not properly repainted</a>
+    <p>When hovered, the <span style="color:green"><b>green</b></span> content should turn <span style="color:red"><b>red</b></span>.</p>
+    <div class="region" id="region1"></div>
+    <div class="region" id="region2"></div>
+    <div class="content" id="content1"></div>
+    <div class="content" id="content2"></div>
+</body>
\ No newline at end of file
index 000c554..91dcd8b 100644 (file)
@@ -1,3 +1,19 @@
+2014-05-20  Radu Stavila  <stavila@adobe.com>
+
+        REGRESSION: [CSS Regions] Content flowed directly into the flow thread that ends up in the second region is not properly repainted
+        https://bugs.webkit.org/show_bug.cgi?id=133111
+
+        Reviewed by David Hyatt.
+
+        When computing the repaint rect of an element flowed into a flow thread, if the element is flowed directly into
+        the flow thread (meaning its containing block is the flow thread itself), the region's position within the flow
+        must no longer be taken into consideration, because its already included in the element's |topLeft|.
+
+        Test: fast/regions/hover-element-flowed-second-region.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeRectForRepaint):
+
 2014-05-20  Alex Christensen  <achristensen@webkit.org>
 
         Fix web timing assertion failure.
index b66123e..c43cf7d 100644 (file)
@@ -2140,7 +2140,9 @@ void RenderBox::computeRectForRepaint(const RenderLayerModelObject* repaintConta
     // elements because their absolute position already pushes them down through
     // the regions so adding this here and then adding the topLeft again would cause
     // us to add the height twice.
-    if (o->isOutOfFlowRenderFlowThread() && position != AbsolutePosition) {
+    // The same logic applies for elements flowed directly into the flow thread. Their topLeft member
+    // will already contain the portion rect of the region.
+    if (o->isOutOfFlowRenderFlowThread() && position != AbsolutePosition && containingBlock() != flowThreadContainingBlock()) {
         RenderRegion* firstRegion = nullptr;
         RenderRegion* lastRegion = nullptr;
         if (toRenderFlowThread(o)->getRegionRangeForBox(this, firstRegion, lastRegion))