Title: [166631] trunk/Source/WebCore
Revision
166631
Author
abu...@adobe.com
Date
2014-04-01 22:36:54 -0700 (Tue, 01 Apr 2014)

Log Message

[CSS Regions] Simplify the RenderFlowThread state pusher
https://bugs.webkit.org/show_bug.cgi?id=131035

Reviewed by David Hyatt.

The RenderFlowThread state pusher is desynchronized from the RenderView layout state pusher
by one renderer. This patch fixes the anomaly by correctly ordering the push and pop operations
between the two systems.

Tests: no functional change, no new tests.

* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::pushFlowThreadLayoutState):
(WebCore::RenderFlowThread::popFlowThreadLayoutState):
(WebCore::RenderFlowThread::offsetFromLogicalTopOfFirstRegion):
* rendering/RenderView.cpp:
(WebCore::RenderView::pushLayoutState):
* rendering/RenderView.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (166630 => 166631)


--- trunk/Source/WebCore/ChangeLog	2014-04-02 04:49:28 UTC (rev 166630)
+++ trunk/Source/WebCore/ChangeLog	2014-04-02 05:36:54 UTC (rev 166631)
@@ -1,3 +1,24 @@
+2014-04-01  Andrei Bucur  <abu...@adobe.com>
+
+        [CSS Regions] Simplify the RenderFlowThread state pusher
+        https://bugs.webkit.org/show_bug.cgi?id=131035
+
+        Reviewed by David Hyatt.
+
+        The RenderFlowThread state pusher is desynchronized from the RenderView layout state pusher
+        by one renderer. This patch fixes the anomaly by correctly ordering the push and pop operations
+        between the two systems.
+
+        Tests: no functional change, no new tests.
+
+        * rendering/RenderFlowThread.cpp:
+        (WebCore::RenderFlowThread::pushFlowThreadLayoutState):
+        (WebCore::RenderFlowThread::popFlowThreadLayoutState):
+        (WebCore::RenderFlowThread::offsetFromLogicalTopOfFirstRegion):
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::pushLayoutState):
+        * rendering/RenderView.h:
+
 2014-04-01  Beth Dakin  <bda...@apple.com>
 
         willReveal edge events should be hooked up for overflow:scroll

Modified: trunk/Source/WebCore/rendering/RenderFlowThread.cpp (166630 => 166631)


--- trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2014-04-02 04:49:28 UTC (rev 166630)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2014-04-02 05:36:54 UTC (rev 166631)
@@ -1144,6 +1144,8 @@
 
 void RenderFlowThread::pushFlowThreadLayoutState(const RenderObject& object)
 {
+    m_activeObjectsStack.add(&object);
+
     if (const RenderBox* currentBoxDescendant = currentActiveRenderBox()) {
         LayoutState* layoutState = currentBoxDescendant->view().layoutState();
         if (layoutState && layoutState->isPaginated()) {
@@ -1152,19 +1154,17 @@
             setOffsetFromLogicalTopOfFirstRegion(currentBoxDescendant, currentBoxDescendant->isHorizontalWritingMode() ? offsetDelta.height() : offsetDelta.width());
         }
     }
-
-    m_activeObjectsStack.add(&object);
 }
 
 void RenderFlowThread::popFlowThreadLayoutState()
 {
-    m_activeObjectsStack.removeLast();
-
     if (const RenderBox* currentBoxDescendant = currentActiveRenderBox()) {
         LayoutState* layoutState = currentBoxDescendant->view().layoutState();
         if (layoutState && layoutState->isPaginated())
             clearOffsetFromLogicalTopOfFirstRegion(currentBoxDescendant);
     }
+
+    m_activeObjectsStack.removeLast();
 }
 
 LayoutUnit RenderFlowThread::offsetFromLogicalTopOfFirstRegion(const RenderBlock* currentBlock) const
@@ -1174,16 +1174,6 @@
     if (hasCachedOffsetFromLogicalTopOfFirstRegion(currentBlock))
         return cachedOffsetFromLogicalTopOfFirstRegion(currentBlock);
 
-    // If it's the current box being laid out, use the layout state.
-    const RenderBox* currentBoxDescendant = currentActiveRenderBox();
-    if (currentBlock == currentBoxDescendant) {
-        LayoutState* layoutState = view().layoutState();
-        ASSERT(layoutState->m_renderer == currentBlock);
-        ASSERT(layoutState && layoutState->isPaginated());
-        LayoutSize offsetDelta = layoutState->m_layoutOffset - layoutState->m_pageOffset;
-        return currentBoxDescendant->isHorizontalWritingMode() ? offsetDelta.height() : offsetDelta.width();
-    }
-
     // As a last resort, take the slow path.
     LayoutRect blockRect(0, 0, currentBlock->width(), currentBlock->height());
     while (currentBlock && !currentBlock->isRenderFlowThread()) {

Modified: trunk/Source/WebCore/rendering/RenderView.cpp (166630 => 166631)


--- trunk/Source/WebCore/rendering/RenderView.cpp	2014-04-02 04:49:28 UTC (rev 166630)
+++ trunk/Source/WebCore/rendering/RenderView.cpp	2014-04-02 05:36:54 UTC (rev 166631)
@@ -1019,8 +1019,8 @@
     ASSERT(m_layoutStateDisableCount == 0);
     ASSERT(m_layoutState == 0);
 
+    m_layoutState = std::make_unique<LayoutState>(root);
     pushLayoutStateForCurrentFlowThread(root);
-    m_layoutState = std::make_unique<LayoutState>(root);
 }
 
 bool RenderView::shouldDisableLayoutStateForSubtree(RenderObject* renderer) const

Modified: trunk/Source/WebCore/rendering/RenderView.h (166630 => 166631)


--- trunk/Source/WebCore/rendering/RenderView.h	2014-04-02 04:49:28 UTC (rev 166630)
+++ trunk/Source/WebCore/rendering/RenderView.h	2014-04-02 05:36:54 UTC (rev 166631)
@@ -253,8 +253,8 @@
         // We push LayoutState even if layoutState is disabled because it stores layoutDelta too.
         if (!doingFullRepaint() || m_layoutState->isPaginated() || renderer.hasColumns() || renderer.flowThreadContainingBlock()
             || m_layoutState->lineGrid() || (renderer.style().lineGrid() != RenderStyle::initialLineGrid() && renderer.isRenderBlockFlow())) {
+            m_layoutState = std::make_unique<LayoutState>(std::move(m_layoutState), &renderer, offset, pageHeight, pageHeightChanged, colInfo);
             pushLayoutStateForCurrentFlowThread(renderer);
-            m_layoutState = std::make_unique<LayoutState>(std::move(m_layoutState), &renderer, offset, pageHeight, pageHeightChanged, colInfo);
             return true;
         }
         return false;
@@ -262,8 +262,8 @@
 
     void popLayoutState()
     {
+        popLayoutStateForCurrentFlowThread();
         m_layoutState = std::move(m_layoutState->m_next);
-        popLayoutStateForCurrentFlowThread();
     }
 
     // Suspends the LayoutState optimization. Used under transforms that cannot be represented by
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to