Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(637)

Unified Diff: Source/core/rendering/RenderBlock.cpp

Issue 196533012: Make LayoutState always be RAII (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated to ToT Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/rendering/RenderBlockFlow.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBlock.cpp
diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp
index 2698c2af4ca393b0994bc2806bf222c0b40f2f3f..45a70be636677dd26151df858f26d017869d7764 100644
--- a/Source/core/rendering/RenderBlock.cpp
+++ b/Source/core/rendering/RenderBlock.cpp
@@ -1635,42 +1635,44 @@ bool RenderBlock::simplifiedLayout()
if ((!posChildNeedsLayout() && !needsSimplifiedNormalFlowLayout()) || normalChildNeedsLayout() || selfNeedsLayout())
return false;
- LayoutStateMaintainer statePusher(*this, locationOffset());
- if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovementOnly())
- return false;
+ {
+ // LayoutStateMaintainer needs this deliberate scope to pop before repaint
+ LayoutStateMaintainer statePusher(*this, locationOffset());
- FastTextAutosizer::LayoutScope fastTextAutosizerLayoutScope(this);
-
- // Lay out positioned descendants or objects that just need to recompute overflow.
- if (needsSimplifiedNormalFlowLayout())
- simplifiedNormalFlowLayout();
-
- // Make sure a forced break is applied after the content if we are a flow thread in a simplified layout.
- // This ensures the size information is correctly computed for the last auto-height region receiving content.
- if (isRenderFlowThread())
- toRenderFlowThread(this)->applyBreakAfterContent(clientLogicalBottom());
-
- // Lay out our positioned objects if our positioned child bit is set.
- // Also, if an absolute position element inside a relative positioned container moves, and the absolute element has a fixed position
- // child, neither the fixed element nor its container learn of the movement since posChildNeedsLayout() is only marked as far as the
- // relative positioned container. So if we can have fixed pos objects in our positioned objects list check if any of them
- // are statically positioned and thus need to move with their absolute ancestors.
- bool canContainFixedPosObjects = canContainFixedPositionObjects();
- if (posChildNeedsLayout() || canContainFixedPosObjects)
- layoutPositionedObjects(false, !posChildNeedsLayout() && canContainFixedPosObjects ? LayoutOnlyFixedPositionedObjects : DefaultLayout);
-
- // Recompute our overflow information.
- // FIXME: We could do better here by computing a temporary overflow object from layoutPositionedObjects and only
- // updating our overflow if we either used to have overflow or if the new temporary object has overflow.
- // For now just always recompute overflow. This is no worse performance-wise than the old code that called rightmostPosition and
- // lowestPosition on every relayout so it's not a regression.
- // computeOverflow expects the bottom edge before we clamp our height. Since this information isn't available during
- // simplifiedLayout, we cache the value in m_overflow.
- LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layoutClientAfterEdge() : clientLogicalBottom();
- computeOverflow(oldClientAfterEdge, true);
-
- statePusher.pop();
+ if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovementOnly())
+ return false;
+
+ FastTextAutosizer::LayoutScope fastTextAutosizerLayoutScope(this);
+
+ // Lay out positioned descendants or objects that just need to recompute overflow.
+ if (needsSimplifiedNormalFlowLayout())
+ simplifiedNormalFlowLayout();
+
+ // Make sure a forced break is applied after the content if we are a flow thread in a simplified layout.
+ // This ensures the size information is correctly computed for the last auto-height region receiving content.
+ if (isRenderFlowThread())
+ toRenderFlowThread(this)->applyBreakAfterContent(clientLogicalBottom());
+
+ // Lay out our positioned objects if our positioned child bit is set.
+ // Also, if an absolute position element inside a relative positioned container moves, and the absolute element has a fixed position
+ // child, neither the fixed element nor its container learn of the movement since posChildNeedsLayout() is only marked as far as the
+ // relative positioned container. So if we can have fixed pos objects in our positioned objects list check if any of them
+ // are statically positioned and thus need to move with their absolute ancestors.
+ bool canContainFixedPosObjects = canContainFixedPositionObjects();
+ if (posChildNeedsLayout() || canContainFixedPosObjects)
+ layoutPositionedObjects(false, !posChildNeedsLayout() && canContainFixedPosObjects ? LayoutOnlyFixedPositionedObjects : DefaultLayout);
+
+ // Recompute our overflow information.
+ // FIXME: We could do better here by computing a temporary overflow object from layoutPositionedObjects and only
+ // updating our overflow if we either used to have overflow or if the new temporary object has overflow.
+ // For now just always recompute overflow. This is no worse performance-wise than the old code that called rightmostPosition and
+ // lowestPosition on every relayout so it's not a regression.
+ // computeOverflow expects the bottom edge before we clamp our height. Since this information isn't available during
+ // simplifiedLayout, we cache the value in m_overflow.
+ LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layoutClientAfterEdge() : clientLogicalBottom();
+ computeOverflow(oldClientAfterEdge, true);
+ }
updateLayerTransform();
« no previous file with comments | « no previous file | Source/core/rendering/RenderBlockFlow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698