Title: [136037] trunk
Revision
136037
Author
[email protected]
Date
2012-11-28 11:55:04 -0800 (Wed, 28 Nov 2012)

Log Message

[CSS Regions] InRenderFlowThread returns false in the first setStyle
https://bugs.webkit.org/show_bug.cgi?id=102839

Reviewed by Dave Hyatt.

Source/WebCore:

Some render objects use the "inRenderFlowThread" during the first styleWillChange/styleDidChange.
The first call to these methods comes from NodeRendererFactory::createRenderer. That happens before the RenderObject is
attached to the parent renderer, meaning that inRenderFlowThread is false. That means a RenderLayerBacking will be
created for renderers inside the RenderFlowThread, but composited layers inside the RenderFlowThread are not supported yet.
https://bugs.webkit.org/show_bug.cgi?id=84900

Test: fast/repaint/region-painting-composited-element.html

* dom/NodeRenderingContext.cpp:
(WebCore::NodeRendererFactory::createRenderer):
Added code to propagate the inRenderFlowThread flag from the parent node before the style is set for the first time.

LayoutTests:

Added test to check that the composited elements added to a RenderFlowThread are painted correctly.

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

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (136036 => 136037)


--- trunk/LayoutTests/ChangeLog	2012-11-28 19:54:25 UTC (rev 136036)
+++ trunk/LayoutTests/ChangeLog	2012-11-28 19:55:04 UTC (rev 136037)
@@ -1,3 +1,15 @@
+2012-11-28  Alexandru Chiculita  <[email protected]>
+
+        [CSS Regions] InRenderFlowThread returns false in the first setStyle
+        https://bugs.webkit.org/show_bug.cgi?id=102839
+
+        Reviewed by Dave Hyatt.
+
+        Added test to check that the composited elements added to a RenderFlowThread are painted correctly.
+
+        * fast/repaint/region-painting-composited-element-expected.html: Added.
+        * fast/repaint/region-painting-composited-element.html: Added.
+
 2012-11-28  Tony Chang  <[email protected]>
 
         Unreviewed, land updated Mac results after track limiter removal.

Added: trunk/LayoutTests/fast/repaint/region-painting-composited-element-expected.html (0 => 136037)


--- trunk/LayoutTests/fast/repaint/region-painting-composited-element-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/region-painting-composited-element-expected.html	2012-11-28 19:55:04 UTC (rev 136037)
@@ -0,0 +1,20 @@
+<!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">
+#region1, #region2 {
+    width: 100px;
+    height: 50px;
+    background-color: green;
+}
+</style>
+</head>
+<body>
+    <div id="region1"></div><br />
+    <div id="region2"></div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/repaint/region-painting-composited-element.html (0 => 136037)


--- trunk/LayoutTests/fast/repaint/region-painting-composited-element.html	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/region-painting-composited-element.html	2012-11-28 19:55:04 UTC (rev 136037)
@@ -0,0 +1,48 @@
+<!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-color: green; 
+    width: 100px; 
+    height: 50px;
+    /* Force a composited layer. */
+    -webkit-transform: translate3d(0,0,0);
+}
+
+#region1, #region2 {
+    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. */
+    background-color: red;
+}
+
+#region2 {
+    background-color: green;
+}
+
+</style>
+</head>
+<body>
+    <!-- Testing that the RenderObject is marked as part of the RenderFlowThread before it applies the first style.
+        The test should paint two green rectangles. There should be no red. -->
+    <div id="content">
+        <div id="target"></div>
+    </div>
+    <div id="region1"></div><br />
+    <div id="region2"></div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (136036 => 136037)


--- trunk/Source/WebCore/ChangeLog	2012-11-28 19:54:25 UTC (rev 136036)
+++ trunk/Source/WebCore/ChangeLog	2012-11-28 19:55:04 UTC (rev 136037)
@@ -1,3 +1,22 @@
+2012-11-28  Alexandru Chiculita  <[email protected]>
+
+        [CSS Regions] InRenderFlowThread returns false in the first setStyle
+        https://bugs.webkit.org/show_bug.cgi?id=102839
+
+        Reviewed by Dave Hyatt.
+
+        Some render objects use the "inRenderFlowThread" during the first styleWillChange/styleDidChange.
+        The first call to these methods comes from NodeRendererFactory::createRenderer. That happens before the RenderObject is 
+        attached to the parent renderer, meaning that inRenderFlowThread is false. That means a RenderLayerBacking will be 
+        created for renderers inside the RenderFlowThread, but composited layers inside the RenderFlowThread are not supported yet.
+        https://bugs.webkit.org/show_bug.cgi?id=84900
+
+        Test: fast/repaint/region-painting-composited-element.html
+
+        * dom/NodeRenderingContext.cpp:
+        (WebCore::NodeRendererFactory::createRenderer):
+        Added code to propagate the inRenderFlowThread flag from the parent node before the style is set for the first time.
+
 2012-11-28  Dan Bernstein  <[email protected]>
 
         <rdar://problem/12645085> REGRESSION (r130851): With kerning enabled, a white-space: pre-wrap inline starting with tab+space has the wrong width

Modified: trunk/Source/WebCore/dom/NodeRenderingContext.cpp (136036 => 136037)


--- trunk/Source/WebCore/dom/NodeRenderingContext.cpp	2012-11-28 19:54:25 UTC (rev 136036)
+++ trunk/Source/WebCore/dom/NodeRenderingContext.cpp	2012-11-28 19:55:04 UTC (rev 136037)
@@ -236,6 +236,11 @@
         newRenderer->destroy();
         return;
     }
+
+    // Make sure the RenderObject already knows it is going to be added to a RenderFlowThread before we set the style
+    // for the first time. Otherwise code using inRenderFlowThread() in the styleWillChange and styleDidChange will fail.
+    newRenderer->setInRenderFlowThread(parentRenderer->inRenderFlowThread());
+
     element->setRenderer(newRenderer);
     newRenderer->setAnimatableStyle(m_style.release()); // setAnimatableStyle() can depend on renderer() already being set.
 
@@ -272,6 +277,11 @@
         newRenderer->destroy();
         return;
     }
+
+    // Make sure the RenderObject already knows it is going to be added to a RenderFlowThread before we set the style
+    // for the first time. Otherwise code using inRenderFlowThread() in the styleWillChange and styleDidChange will fail.
+    newRenderer->setInRenderFlowThread(parentRenderer->inRenderFlowThread());
+
     RenderObject* nextRenderer = this->nextRenderer();
     textNode->setRenderer(newRenderer);
     // Parent takes care of the animations, no need to call setAnimatableStyle.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to