[CSS Regions] Elements using transforms are not repainted correctly when rendered...
authorachicu@adobe.com <achicu@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Nov 2012 22:23:24 +0000 (22:23 +0000)
committerachicu@adobe.com <achicu@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Nov 2012 22:23:24 +0000 (22:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=102826

Reviewed by David Hyatt.

Source/WebCore:

When the page is composited, all the elements will have a composited repaint container. In that case we will
never catch the repaints in the RenderFlowThread, but they will go directly to the RenderView.
There's a single case when the parent composited layer of an element inside the RenderFlowThread will get
its own repaints. That case only happens when the parent composited layer is also part of the same flow thread.
Right now compositing is disabled for elements inside the RenderFlowThread, so that case doesn't even happen yet.
That will be fixed in https://bugs.webkit.org/show_bug.cgi?id=84900.

Test: fast/repaint/region-painting-in-composited-view.html

* rendering/RenderObject.cpp:
(WebCore::RenderObject::containerForRepaint):

LayoutTests:

Added test file to check for repainting inside a RenderFlowThread when the page is in composited mode.

* fast/repaint/region-painting-in-composited-view-expected.html: Added.
* fast/repaint/region-painting-in-composited-view.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/repaint/region-painting-in-composited-view-expected.html [new file with mode: 0644]
LayoutTests/fast/repaint/region-painting-in-composited-view.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderObject.cpp

index 52b4c50..4e741ed 100644 (file)
@@ -1,3 +1,15 @@
+2012-11-27  Alexandru Chiculita  <achicu@adobe.com>
+
+        [CSS Regions] Elements using transforms are not repainted correctly when rendered in a region
+        https://bugs.webkit.org/show_bug.cgi?id=102826
+
+        Reviewed by David Hyatt.
+
+        Added test file to check for repainting inside a RenderFlowThread when the page is in composited mode.
+
+        * fast/repaint/region-painting-in-composited-view-expected.html: Added.
+        * fast/repaint/region-painting-in-composited-view.html: Added.
+
 2012-11-27  Tony Chang  <tony@chromium.org>
 
         Unreviewed, updating TestExpectations after input slider change.
diff --git a/LayoutTests/fast/repaint/region-painting-in-composited-view-expected.html b/LayoutTests/fast/repaint/region-painting-in-composited-view-expected.html
new file mode 100644 (file)
index 0000000..404b5e8
--- /dev/null
@@ -0,0 +1,39 @@
+<!doctype html>
+<head>
+<title>Test for https://bugs.webkit.org/show_bug.cgi?id=102826</title>
+<style type="text/css">
+#region1, #region2 {
+    position: absolute;
+    top: 0px;
+    left: 0px;
+    width: 100px;
+    height: 50px;
+}
+
+#region1 {
+    left: 120px;
+    background-color: red;
+    /* We need a composited layer, to make the output 
+       exactly the same as the test file. */
+    -webkit-transform: translate3d(0,0,0);
+}
+
+#region2 {
+    background-color: green;
+}
+
+</style>
+<script src="resources/repaint.js" type="text/javascript"></script>
+<script>
+function repaintTest()
+{
+    // Using the same repaint behavior, so that we get the same repaint area.
+    document.getElementById('region1').style.backgroundColor = 'green';
+}
+</script>
+</head>
+<body onload="runRepaintTest();">
+    <div id="region1"></div>
+    <div id="region2"></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/repaint/region-painting-in-composited-view.html b/LayoutTests/fast/repaint/region-painting-in-composited-view.html
new file mode 100644 (file)
index 0000000..d027117
--- /dev/null
@@ -0,0 +1,58 @@
+<!doctype html>
+<head>
+<title>Test for https://bugs.webkit.org/show_bug.cgi?id=102826</title>
+<script>
+    if (window.testRunner)
+        window.testRunner.overridePreference("WebKitCSSRegionsEnabled", "1");
+</script>
+<style type="text/css">
+#content {
+    -webkit-flow-into: flow1;
+}
+
+#target { 
+    background: red; 
+    width: 100px; 
+    height: 50px;
+}
+
+#region1, #region2 {
+    position: absolute;
+    top: 0px;
+    width: 100px;
+    height: 50px;
+    -webkit-flow-from: flow1;
+}
+
+#region1 {
+    /* Make sure that the content of the first region will display in a totally
+       different place than it would have been displayed if regions were not used. */
+    left: 120px;
+    /* Force the composited mode on the current page. */
+    -webkit-transform: translate3d(0,0,0);
+}
+
+#region2 {
+    left: 0px;
+    background-color: green;
+}
+
+</style>
+<script src="resources/repaint.js" type="text/javascript"></script>
+<script>
+function repaintTest()
+{
+    document.getElementById('target').style.backgroundColor = 'green';
+}
+</script>
+</head>
+<body onload="runRepaintTest();">
+    <!-- Testing that the repaint goes through the RenderRegions and not 
+    directly to the viewport. You should see two green rectangles. -->
+    <div id="content">
+        <div id="target"></div>
+    </div>
+    <div id="region1"></div>
+    <div id="region2"></div>
+</body>
+</html>
index 692b715..ddf08c8 100644 (file)
@@ -1,3 +1,22 @@
+2012-11-27  Alexandru Chiculita  <achicu@adobe.com>
+
+        [CSS Regions] Elements using transforms are not repainted correctly when rendered in a region
+        https://bugs.webkit.org/show_bug.cgi?id=102826
+
+        Reviewed by David Hyatt.
+
+        When the page is composited, all the elements will have a composited repaint container. In that case we will
+        never catch the repaints in the RenderFlowThread, but they will go directly to the RenderView. 
+        There's a single case when the parent composited layer of an element inside the RenderFlowThread will get 
+        its own repaints. That case only happens when the parent composited layer is also part of the same flow thread.
+        Right now compositing is disabled for elements inside the RenderFlowThread, so that case doesn't even happen yet.
+        That will be fixed in https://bugs.webkit.org/show_bug.cgi?id=84900.
+
+        Test: fast/repaint/region-painting-in-composited-view.html
+
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::containerForRepaint):
+
 2012-11-27  Tony Chang  <tony@chromium.org>
 
         Unreviewed, win compile fix take 2.
index 15dcdd0..754aee1 100644 (file)
@@ -1290,12 +1290,15 @@ RenderLayerModelObject* RenderObject::containerForRepaint() const
 #endif
 
     // If we have a flow thread, then we need to do individual repaints within the RenderRegions instead.
-    // Return the flow thread as a repaint container in order to create a chokepoint that allows us to change
+    // Return the flow thread as a repaint container in order to create a checkpoint that allows us to change
     // repainting to do individual region repaints.
-    // FIXME: Composited layers inside a flow thread will bypass this mechanism and will malfunction. It's not
-    // clear how to address this problem for composited descendants of a RenderFlowThread.
-    if (!repaintContainer && inRenderFlowThread())
-        repaintContainer = enclosingRenderFlowThread();
+    if (inRenderFlowThread()) {
+        RenderFlowThread* parentRenderFlowThread = enclosingRenderFlowThread();
+        // If we have already found a repaint container then we will repaint into that container only if it is part of the same
+        // flow thread. Otherwise we will need to catch the repaint call and send it to the flow thread.
+        if (!(repaintContainer && repaintContainer->inRenderFlowThread() && repaintContainer->enclosingRenderFlowThread() == parentRenderFlowThread))
+            repaintContainer = parentRenderFlowThread;
+    }
     return repaintContainer;
 }