Title: [97370] trunk
Revision
97370
Author
hy...@apple.com
Date
2011-10-13 09:55:13 -0700 (Thu, 13 Oct 2011)

Log Message

Source/WebCore: https://bugs.webkit.org/show_bug.cgi?id=69932
        
Layout repainting messed up for objects in regions. There were two bugs here.
The first is that the regionOverflowRect needs to at least be the size of the 
region's rect. When you're in the middle of layout, you haven't computed the
overflow rect for the flow thread yet (the flow thread's height could even be 0),
and so you just need to enforce a minimum size. Also removed the region-overflow:break
clipping behavior, since it was established that was wrong.
        
The second bug is that when you tell a region to repaint, you need to disable layout state,
since applying layout deltas from the flow thread makes no sense. The region is in a totally
different place in the render tree, so the current flow thread layout state can't be used
to determine your coordinate offset.

Reviewed by Dan Bernstein.

Added fast/repaint test.

* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::repaintRectangleInRegions):
* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::regionOverflowRect):

LayoutTests: https://bugs.webkit.org/show_bug.cgi?id=69932
        
Layout repainting messed up for objects in regions. Add a repaint test to
illustrate the issue.

Reviewed by Dan Bernstein.

* fast/repaint/region-painting-via-layout.html: Added.
* platform/mac/fast/regions/region-overflow-break-expected.png:
* platform/mac/fast/repaint/region-painting-via-layout-expected.png: Added.
* platform/mac/fast/repaint/region-painting-via-layout-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (97369 => 97370)


--- trunk/LayoutTests/ChangeLog	2011-10-13 16:33:19 UTC (rev 97369)
+++ trunk/LayoutTests/ChangeLog	2011-10-13 16:55:13 UTC (rev 97370)
@@ -1,3 +1,17 @@
+2011-10-13  David Hyatt  <hy...@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=69932
+        
+        Layout repainting messed up for objects in regions. Add a repaint test to
+        illustrate the issue.
+
+        Reviewed by Dan Bernstein.
+
+        * fast/repaint/region-painting-via-layout.html: Added.
+        * platform/mac/fast/regions/region-overflow-break-expected.png:
+        * platform/mac/fast/repaint/region-painting-via-layout-expected.png: Added.
+        * platform/mac/fast/repaint/region-painting-via-layout-expected.txt: Added.
+
 2011-10-13  Renata Hodovan  <r...@webkit.org>
 
         FEComponentTransfer element doesn't support dynamic invalidation

Added: trunk/LayoutTests/fast/repaint/region-painting-via-layout.html (0 => 97370)


--- trunk/LayoutTests/fast/repaint/region-painting-via-layout.html	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/region-painting-via-layout.html	2011-10-13 16:55:13 UTC (rev 97370)
@@ -0,0 +1,49 @@
+<html>
+<head>
+<title>Test for https://bugs.webkit.org/show_bug.cgi?id=69932</title>
+<style type="text/css">
+#content {
+    -webkit-flow: "flow1";
+    position:relative;
+    padding-top:1000px;
+}
+
+#target { height: 200px; background-color: red }
+
+#region1, #region2, #region3 {
+    content: -webkit-from-flow("flow1");
+}
+
+#region1 {
+    width: 300px;
+    height: 1000px;
+    background-color:red
+}
+
+#region2 {
+    width: 100%;
+    height: 180px;
+    border:1px solid black;
+    background-color:red
+}
+
+</style>
+<script src="" type="text/_javascript_"></script>
+<script>
+function repaintTest()
+{
+    document.getElementById('target').style.fontSize = '36px';
+    document.getElementById('target').style.backgroundColor = 'green';
+}
+</script>
+</head>
+<body _onload_="runRepaintTest();">
+    <div id="content"><div><div id="target"></div></div>
+    </div>
+    <div style="position:absolute;width:0;height:0;overflow:hidden">
+      <div id="region1"></div>
+    </div>
+
+    <div id="region2"></div>
+    </body>
+</html>

Modified: trunk/LayoutTests/platform/mac/fast/regions/region-overflow-break-expected.png


(Binary files differ)

Added: trunk/LayoutTests/platform/mac/fast/repaint/region-painting-via-layout-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/repaint/region-painting-via-layout-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/fast/repaint/region-painting-via-layout-expected.txt (0 => 97370)


--- trunk/LayoutTests/platform/mac/fast/repaint/region-painting-via-layout-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/repaint/region-painting-via-layout-expected.txt	2011-10-13 16:55:13 UTC (rev 97370)
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderRegion {DIV} at (0,0) size 786x182 [bgcolor=#FF0000] [border: (1px solid #000000)]
+Flow Threads
+  Thread with flow-name 'flow1'
+    layer at (0,0) size 784x1180 backgroundClip at (0,0) size 800x600 clip at (0,0) size 800x600 outlineClip at (0,0) size 800x600
+      RenderFlowThread at (0,0) size 784x1180
+    layer at (0,0) size 784x1200 backgroundClip at (0,0) size 800x600 clip at (0,0) size 800x600 outlineClip at (0,0) size 800x600
+      RenderBlock (relative positioned) {DIV} at (0,0) size 784x1200
+        RenderBlock {DIV} at (0,1000) size 784x200
+          RenderBlock {DIV} at (0,0) size 784x200 [bgcolor=#008000]
+  Regions for flow 'flow1'
+    RenderRegion {DIV} #region1 with index 0
+    RenderRegion {DIV} #region2 with index 0

Modified: trunk/Source/WebCore/ChangeLog (97369 => 97370)


--- trunk/Source/WebCore/ChangeLog	2011-10-13 16:33:19 UTC (rev 97369)
+++ trunk/Source/WebCore/ChangeLog	2011-10-13 16:55:13 UTC (rev 97370)
@@ -1,3 +1,28 @@
+2011-10-13  David Hyatt  <hy...@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=69932
+        
+        Layout repainting messed up for objects in regions. There were two bugs here.
+        The first is that the regionOverflowRect needs to at least be the size of the 
+        region's rect. When you're in the middle of layout, you haven't computed the
+        overflow rect for the flow thread yet (the flow thread's height could even be 0),
+        and so you just need to enforce a minimum size. Also removed the region-overflow:break
+        clipping behavior, since it was established that was wrong.
+        
+        The second bug is that when you tell a region to repaint, you need to disable layout state,
+        since applying layout deltas from the flow thread makes no sense. The region is in a totally
+        different place in the render tree, so the current flow thread layout state can't be used
+        to determine your coordinate offset.
+
+        Reviewed by Dan Bernstein.
+
+        Added fast/repaint test.
+
+        * rendering/RenderFlowThread.cpp:
+        (WebCore::RenderFlowThread::repaintRectangleInRegions):
+        * rendering/RenderRegion.cpp:
+        (WebCore::RenderRegion::regionOverflowRect):
+
 2011-10-13  Renata Hodovan  <r...@webkit.org>
 
         FEComponentTransfer element doesn't support dynamic invalidation

Modified: trunk/Source/WebCore/rendering/RenderFlowThread.cpp (97369 => 97370)


--- trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2011-10-13 16:33:19 UTC (rev 97369)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2011-10-13 16:55:13 UTC (rev 97370)
@@ -523,6 +523,7 @@
         
         // Now switch to the region's writing mode coordinate space and let it repaint itself.
         region->flipForWritingMode(clippedRect);
+        LayoutStateDisabler layoutStateDisabler(view()); // We can't use layout state to repaint, since the region is somewhere else.
         region->repaintRectangle(clippedRect, immediate);
     }
 }

Modified: trunk/Source/WebCore/rendering/RenderRegion.cpp (97369 => 97370)


--- trunk/Source/WebCore/rendering/RenderRegion.cpp	2011-10-13 16:33:19 UTC (rev 97369)
+++ trunk/Source/WebCore/rendering/RenderRegion.cpp	2011-10-13 16:55:13 UTC (rev 97370)
@@ -69,13 +69,13 @@
     LayoutRect clipRect;
     if (m_flowThread->isHorizontalWritingMode()) {
         LayoutUnit minY = isFirstRegion() ? (flowThreadOverflow.y() - outlineSize) : regionRect().y();
-        LayoutUnit maxY = style()->regionOverflow() == AutoRegionOverflow && isLastRegion() ? (flowThreadOverflow.maxY() + outlineSize) : regionRect().maxY();
+        LayoutUnit maxY = isLastRegion() ? max(regionRect().maxY(), flowThreadOverflow.maxY()) + outlineSize : regionRect().maxY();
         LayoutUnit minX = clipX ? regionRect().x() : (flowThreadOverflow.x() - outlineSize);
         LayoutUnit maxX = clipX ? regionRect().maxX() : (flowThreadOverflow.maxX() + outlineSize);
         clipRect = LayoutRect(minX, minY, maxX - minX, maxY - minY);
     } else {
         LayoutUnit minX = isFirstRegion() ? (flowThreadOverflow.x() - outlineSize) : regionRect().x();
-        LayoutUnit maxX = style()->regionOverflow() == AutoRegionOverflow && isLastRegion() ? (flowThreadOverflow.maxX() + outlineSize) : regionRect().maxX();
+        LayoutUnit maxX = isLastRegion() ? max(regionRect().maxX(), flowThreadOverflow.maxX()) + outlineSize : regionRect().maxX();
         LayoutUnit minY = clipY ? regionRect().y() : (flowThreadOverflow.y() - outlineSize);
         LayoutUnit maxY = clipY ? regionRect().maxY() : (flowThreadOverflow.maxY() + outlineSize);
         clipRect = LayoutRect(minX, minY, maxX - minX, maxY - minY);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to