Index: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
index 90580735abd81b1b7186e0d19831340fb5888269..1514c642f90d7823cb023e6b5ee137a82bf5982e 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
@@ -408,22 +408,23 @@ void LayoutBlockFlow::layoutBlock(bool relayoutChildren) { |
relayoutChildren |= logicalWidthChanged; |
TextAutosizer::LayoutScope textAutosizerLayoutScope(this, &layoutScope); |
- LayoutState state(*this, logicalWidthChanged); |
- |
- if (m_paginationStateChanged) { |
- // We now need a deep layout to clean up struts after pagination, if we |
- // just ceased to be paginated, or, if we just became paginated on the |
- // other hand, we now need the deep layout, to insert pagination struts. |
- m_paginationStateChanged = false; |
- state.setPaginationStateChanged(); |
- } |
+ bool paginationStateChanged = m_paginationStateChanged; |
bool preferredLogicalWidthsWereDirty = preferredLogicalWidthsDirty(); |
// Multiple passes might be required for column based layout. |
// The number of passes could be as high as the number of columns. |
LayoutMultiColumnFlowThread* flowThread = multiColumnFlowThread(); |
do { |
+ LayoutState state(*this, logicalWidthChanged); |
+ if (m_paginationStateChanged) { |
+ // We now need a deep layout to clean up struts after pagination, if we |
+ // just ceased to be paginated, or, if we just became paginated on the |
+ // other hand, we now need the deep layout, to insert pagination struts. |
+ m_paginationStateChanged = false; |
+ state.setPaginationStateChanged(); |
+ } |
+ |
layoutChildren(relayoutChildren, layoutScope); |
if (!preferredLogicalWidthsWereDirty && preferredLogicalWidthsDirty()) { |
@@ -448,6 +449,13 @@ void LayoutBlockFlow::layoutBlock(bool relayoutChildren) { |
break; |
} while (true); |
+ LayoutState state(*this, logicalWidthChanged); |
+ if (paginationStateChanged) { |
+ // We still haven't laid out positioned descendants, and we need to perform |
+ // a deep layout on those too if pagination state changed. |
+ state.setPaginationStateChanged(); |
+ } |
+ |
// Remember the automatic logical height we got from laying out the children. |
LayoutUnit unconstrainedHeight = logicalHeight(); |
LayoutUnit unconstrainedClientAfterEdge = clientLogicalBottom(); |