Title: [106544] trunk
Revision
106544
Author
[email protected]
Date
2012-02-02 02:25:25 -0800 (Thu, 02 Feb 2012)

Log Message

Regions should ignore the saved currentRenderFlowThread during repainting
because if there are imbricated flow threads, it might end using the wrong one.

[CSSRegions] Assert failure in RenderView::computeRectForRepaint
https://bugs.webkit.org/show_bug.cgi?id=77430

Patch by Raul Hudea <[email protected]> on 2012-02-02
Reviewed by David Hyatt.

Source/WebCore:

Test: fast/regions/imbricated-flow-threads-crash.html

* rendering/RenderFlowThread.cpp:
(CurrentRenderFlowThreadDisabler):
(WebCore::CurrentRenderFlowThreadDisabler::CurrentRenderFlowThreadDisabler):
(WebCore::CurrentRenderFlowThreadDisabler::~CurrentRenderFlowThreadDisabler):
(WebCore):
(WebCore::RenderFlowThread::repaintRectangleInRegions):

LayoutTests:

* fast/regions/imbricated-flow-threads-crash-expected.txt: Added.
* fast/regions/imbricated-flow-threads-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (106543 => 106544)


--- trunk/LayoutTests/ChangeLog	2012-02-02 10:24:29 UTC (rev 106543)
+++ trunk/LayoutTests/ChangeLog	2012-02-02 10:25:25 UTC (rev 106544)
@@ -1,3 +1,16 @@
+2012-02-02  Raul Hudea  <[email protected]>
+
+        Regions should ignore the saved currentRenderFlowThread during repainting
+        because if there are imbricated flow threads, it might end using the wrong one.
+
+        [CSSRegions] Assert failure in RenderView::computeRectForRepaint
+        https://bugs.webkit.org/show_bug.cgi?id=77430
+
+        Reviewed by David Hyatt.
+
+        * fast/regions/imbricated-flow-threads-crash-expected.txt: Added.
+        * fast/regions/imbricated-flow-threads-crash.html: Added.
+
 2012-02-02  Kentaro Hara  <[email protected]>
 
         The third argument of addEventListener/removeEventListener of PeerConnection should be optional

Added: trunk/LayoutTests/fast/regions/imbricated-flow-threads-crash-expected.txt (0 => 106544)


--- trunk/LayoutTests/fast/regions/imbricated-flow-threads-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/imbricated-flow-threads-crash-expected.txt	2012-02-02 10:25:25 UTC (rev 106544)
@@ -0,0 +1,3 @@
+Text should be rendered in the green region. The test passes if there is no crash
+
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Added: trunk/LayoutTests/fast/regions/imbricated-flow-threads-crash.html (0 => 106544)


--- trunk/LayoutTests/fast/regions/imbricated-flow-threads-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/imbricated-flow-threads-crash.html	2012-02-02 10:25:25 UTC (rev 106544)
@@ -0,0 +1,69 @@
+<html>
+<head>
+    <style type="text/css">
+    article{
+        -webkit-flow-into: article;
+    }
+    .region{
+        -webkit-flow-from: article;
+    }
+    #layout{
+        -webkit-flow-into: pages;
+    }
+    .page{
+        -webkit-flow-from: pages;
+    } 
+    #layout .region{
+        width: 50%;
+        background-color: lightgreen;
+        height: 100%;
+    }
+    #layout,
+    #paginator{
+        width: 200px;
+        height: 500px;
+    }
+    #paginator .page{
+        width: 100%;
+        height: 100%;
+        background: #ddd;
+    }
+    .description{
+        color: blue;
+    }
+    </style>
+</head>
+<body>
+    <div><p class="description">Text should be rendered in the green region. The test passes if there is no crash</p></div>
+
+    <div id="layout">
+        <div id="r1" class="region"></div>
+    </div> 
+    <div id="paginator">
+        <div class="page"></div>
+    </div>
+    <article>
+        <p>
+            Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+        </p>
+    </article>
+    <script>
+        if (window.layoutTestController) {
+            layoutTestController.dumpAsText();
+            layoutTestController.waitUntilDone();
+        }
+        function addNewRegion() {
+            var oldRegion = document.getElementById("r1");
+            var newRegion = oldRegion.cloneNode(true);
+            oldRegion.parentNode.appendChild(newRegion);
+            if (window.layoutTestController)
+                layoutTestController.notifyDone();
+        }
+        function test() {
+            setTimeout(addNewRegion, 0);
+        }
+
+        window.addEventListener("load", test, false);
+    </script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (106543 => 106544)


--- trunk/Source/WebCore/ChangeLog	2012-02-02 10:24:29 UTC (rev 106543)
+++ trunk/Source/WebCore/ChangeLog	2012-02-02 10:25:25 UTC (rev 106544)
@@ -1,3 +1,22 @@
+2012-02-02  Raul Hudea  <[email protected]>
+
+        Regions should ignore the saved currentRenderFlowThread during repainting
+        because if there are imbricated flow threads, it might end using the wrong one.
+
+        [CSSRegions] Assert failure in RenderView::computeRectForRepaint
+        https://bugs.webkit.org/show_bug.cgi?id=77430
+
+        Reviewed by David Hyatt.
+
+        Test: fast/regions/imbricated-flow-threads-crash.html
+
+        * rendering/RenderFlowThread.cpp:
+        (CurrentRenderFlowThreadDisabler):
+        (WebCore::CurrentRenderFlowThreadDisabler::CurrentRenderFlowThreadDisabler):
+        (WebCore::CurrentRenderFlowThreadDisabler::~CurrentRenderFlowThreadDisabler):
+        (WebCore):
+        (WebCore::RenderFlowThread::repaintRectangleInRegions):
+
 2012-02-02  Kinuko Yasuda  <[email protected]>
 
         Cleanup: Move chrome-specific filesystem type handling code (for FileSystem API) under chromium directory (re-landing r105395)

Modified: trunk/Source/WebCore/rendering/RenderFlowThread.cpp (106543 => 106544)


--- trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2012-02-02 10:24:29 UTC (rev 106543)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2012-02-02 10:25:25 UTC (rev 106544)
@@ -299,6 +299,27 @@
     RenderFlowThread* m_renderFlowThread;
 };
 
+class CurrentRenderFlowThreadDisabler {
+    WTF_MAKE_NONCOPYABLE(CurrentRenderFlowThreadDisabler);
+public:
+    CurrentRenderFlowThreadDisabler(RenderView* view)
+        : m_view(view)
+        , m_renderFlowThread(0)
+    {
+        m_renderFlowThread = m_view->currentRenderFlowThread();
+        if (m_renderFlowThread)
+            view->setCurrentRenderFlowThread(0);
+    }
+    ~CurrentRenderFlowThreadDisabler()
+    {
+        if (m_renderFlowThread)
+            m_view->setCurrentRenderFlowThread(m_renderFlowThread);
+    }
+private:
+    RenderView* m_view;
+    RenderFlowThread* m_renderFlowThread;
+};
+
 void RenderFlowThread::layout()
 {
     bool regionsChanged = m_regionsInvalidated && everHadLayout();
@@ -520,6 +541,10 @@
         // 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.
+
+        // Can't use currentFlowThread as it possible to have imbricated flow threads and the wrong one could be used,
+        // so, we let each region figure out the proper enclosing flow thread
+        CurrentRenderFlowThreadDisabler disabler(view());
         region->repaintRectangle(clippedRect, immediate);
     }
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to