Title: [167489] trunk
Revision
167489
Author
stav...@adobe.com
Date
2014-04-18 06:07:48 -0700 (Fri, 18 Apr 2014)

Log Message

[CSSRegions] Incorrect background paint on positioned element hover
https://bugs.webkit.org/show_bug.cgi?id=131617

Reviewed by Andrei Bucur.

Source/WebCore:
When computing the repaint rect for absolute elements flowed into regions, the Y location of the
region within the flow thread must no longer be added to the repaint rect's location because absolute
positioned elements get pushed down through the regions by their absolute top. So adding the region's
position in the flow thread and then adding the element's absolute top would cause us to add
something twice.

Tests: fast/regions/repaint/repaint-absolute-pushed-to-next-region.html

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

LayoutTests:
Added test for the proper repainting of absolute positioned elements in regions when the
absolute top of the elements causes it to be pushed to the next region.

* fast/regions/repaint/repaint-absolute-pushed-to-next-region-expected.txt: Added.
* fast/regions/repaint/repaint-absolute-pushed-to-next-region.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (167488 => 167489)


--- trunk/LayoutTests/ChangeLog	2014-04-18 12:34:03 UTC (rev 167488)
+++ trunk/LayoutTests/ChangeLog	2014-04-18 13:07:48 UTC (rev 167489)
@@ -1,3 +1,16 @@
+2014-04-18  Radu Stavila  <stav...@adobe.com>
+
+        [CSSRegions] Incorrect background paint on positioned element hover
+        https://bugs.webkit.org/show_bug.cgi?id=131617
+
+        Reviewed by Andrei Bucur.
+
+        Added test for the proper repainting of absolute positioned elements in regions when the
+        absolute top of the elements causes it to be pushed to the next region.
+
+        * fast/regions/repaint/repaint-absolute-pushed-to-next-region-expected.txt: Added.
+        * fast/regions/repaint/repaint-absolute-pushed-to-next-region.html: Added.
+
 2014-04-18  Philippe Normand  <pnorm...@igalia.com>
 
         Remove NETWORK_INFO support

Added: trunk/LayoutTests/fast/regions/repaint/repaint-absolute-pushed-to-next-region-expected.txt (0 => 167489)


--- trunk/LayoutTests/fast/regions/repaint/repaint-absolute-pushed-to-next-region-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/repaint/repaint-absolute-pushed-to-next-region-expected.txt	2014-04-18 13:07:48 UTC (rev 167489)
@@ -0,0 +1,12 @@
+Bug 131617 - [CSSRegions] Incorrect background paint on positioned element hover
+When hovering the blue div, it should turn green
+
+(repaint rects
+  (rect 105 205 100 300)
+  (rect 305 105 100 300)
+  (rect 105 205 100 300)
+  (rect 305 105 100 300)
+  (rect 105 205 100 300)
+  (rect 305 105 100 300)
+)
+

Added: trunk/LayoutTests/fast/regions/repaint/repaint-absolute-pushed-to-next-region.html (0 => 167489)


--- trunk/LayoutTests/fast/regions/repaint/repaint-absolute-pushed-to-next-region.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/repaint/repaint-absolute-pushed-to-next-region.html	2014-04-18 13:07:48 UTC (rev 167489)
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="" type="text/_javascript_"></script>
+
+        <style>
+            #cn {
+                -webkit-flow-into: flow;
+            }
+            #region {
+                -webkit-flow-from: flow;
+                position: absolute;
+                top: 100px;
+                left: 100px;
+                width: 100px;
+                height: 100px;
+                border: 5px solid green;
+            }
+            #region2 {
+                -webkit-flow-from: flow;
+                position: absolute;
+                top: 100px;
+                left: 300px;
+                width: 100px;
+                height: 100px;
+                border: 5px solid green;
+            }
+            #inner {
+                position: absolute;
+                top: 100px;
+                left: 0px; 
+                width: 100px;
+                height: 300px;
+                background-color: blue;
+            }
+            #inner:hover { background-color: lime; }
+        </style>
+    </head>
+
+    <body _onload_="runRepaintTest();">
+        <a href="" 131617 - [CSSRegions] Incorrect background paint on positioned element hover</a>
+        <p>When hovering the blue div, it should turn green</p>
+
+        <div id="cn">
+            <div id="inner"></div>
+        </div>
+        <div id="region"></div>
+        <div id="region2"></div>
+
+        <script type="text/_javascript_">
+            function repaintTest() 
+            {
+                if(!window.testRunner)
+                    return;
+
+                var element = document.getElementById("inner");
+                var left = element.offsetLeft;
+                var top = element.offsetTop;
+
+                eventSender.mouseMoveTo(left + 10, top + 10);
+            }
+        </script>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (167488 => 167489)


--- trunk/Source/WebCore/ChangeLog	2014-04-18 12:34:03 UTC (rev 167488)
+++ trunk/Source/WebCore/ChangeLog	2014-04-18 13:07:48 UTC (rev 167489)
@@ -1,3 +1,21 @@
+2014-04-18  Radu Stavila  <stav...@adobe.com>
+
+        [CSSRegions] Incorrect background paint on positioned element hover
+        https://bugs.webkit.org/show_bug.cgi?id=131617
+
+        Reviewed by Andrei Bucur.
+
+        When computing the repaint rect for absolute elements flowed into regions, the Y location of the
+        region within the flow thread must no longer be added to the repaint rect's location because absolute
+        positioned elements get pushed down through the regions by their absolute top. So adding the region's
+        position in the flow thread and then adding the element's absolute top would cause us to add
+        something twice.
+
+        Tests: fast/regions/repaint/repaint-absolute-pushed-to-next-region.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeRectForRepaint):
+
 2014-04-18  Philippe Normand  <pnorm...@igalia.com>
 
         Remove NETWORK_INFO support

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (167488 => 167489)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2014-04-18 12:34:03 UTC (rev 167488)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2014-04-18 13:07:48 UTC (rev 167489)
@@ -2108,8 +2108,14 @@
     if (!o)
         return;
     
+    EPosition position = styleToUse.position();
+
     // This code isn't necessary for in-flow RenderFlowThreads.
-    if (o->isOutOfFlowRenderFlowThread()) {
+    // Don't add the location of the region in the flow thread for absolute positioned
+    // 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) {
         RenderRegion* firstRegion = nullptr;
         RenderRegion* lastRegion = nullptr;
         if (toRenderFlowThread(o)->getRegionRangeForBox(this, firstRegion, lastRegion))
@@ -2122,8 +2128,6 @@
     LayoutPoint topLeft = rect.location();
     topLeft.move(locationOffset());
 
-    EPosition position = styleToUse.position();
-
     // We are now in our parent container's coordinate space.  Apply our transform to obtain a bounding box
     // in the parent's coordinate space that encloses us.
     if (hasLayer() && layer()->transform()) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to