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 c25aeff888e2f5a41d8013278b9e84e802a083b7..e9c68ec0d7c578597f2143695733a6b978577e3c 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
@@ -419,24 +419,13 @@ void LayoutBlockFlow::layoutBlock(bool relayoutChildren) { |
} |
DISABLE_CFI_PERF |
-inline bool LayoutBlockFlow::layoutBlockFlow(bool relayoutChildren, |
- SubtreeLayoutScope& layoutScope) { |
- LayoutUnit oldLeft = logicalLeft(); |
- bool logicalWidthChanged = updateLogicalWidthAndColumnWidth(); |
- relayoutChildren |= logicalWidthChanged; |
+void LayoutBlockFlow::resetLayout() { |
+ if (!firstChild() && !isAnonymousBlock()) |
+ setChildrenInline(true); |
+ setContainsInlineWithOutlineAndContinuation(false); |
rebuildFloatsFromIntruding(); |
- 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(); |
- } |
- |
// We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg, |
// to track our current maximal positive and negative margins. These values |
// are used when we are collapsed with adjacent blocks, so for example, if you |
@@ -454,7 +443,7 @@ inline bool LayoutBlockFlow::layoutBlockFlow(bool relayoutChildren, |
setHasMarginAfterQuirk(style()->hasMarginAfterQuirk()); |
} |
- if (state.isPaginated()) { |
+ if (view()->layoutState()->isPaginated()) { |
setPaginationStrutPropagatedFromChild(LayoutUnit()); |
setFirstForcedBreakOffset(LayoutUnit()); |
@@ -470,23 +459,37 @@ inline bool LayoutBlockFlow::layoutBlockFlow(bool relayoutChildren, |
setBreakBefore(LayoutBlock::breakBefore()); |
setBreakAfter(LayoutBlock::breakAfter()); |
} |
+} |
+ |
+DISABLE_CFI_PERF |
+inline bool LayoutBlockFlow::layoutBlockFlow(bool relayoutChildren, |
+ SubtreeLayoutScope& layoutScope) { |
+ LayoutUnit oldLeft = logicalLeft(); |
+ bool logicalWidthChanged = updateLogicalWidthAndColumnWidth(); |
+ relayoutChildren |= logicalWidthChanged; |
+ |
+ LayoutState state(*this, logicalWidthChanged); |
+ |
+ if (m_paginationStateChanged) { |
szager1
2016/11/30 20:33:28
Should this be inside resetLayout? Maybe pass a L
mstensho (USE GERRIT)
2016/11/30 20:47:58
This is something that ideally should only be done
|
+ // 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(); |
+ } |
+ |
+ LayoutUnit previousHeight = logicalHeight(); |
+ resetLayout(); |
LayoutUnit beforeEdge = borderBefore() + paddingBefore(); |
LayoutUnit afterEdge = |
borderAfter() + paddingAfter() + scrollbarLogicalHeight(); |
- LayoutUnit previousHeight = logicalHeight(); |
setLogicalHeight(beforeEdge); |
- if (!firstChild() && !isAnonymousBlock()) |
- setChildrenInline(true); |
- |
TextAutosizer::LayoutScope textAutosizerLayoutScope(this, &layoutScope); |
bool preferredLogicalWidthsWereDirty = preferredLogicalWidthsDirty(); |
- // Reset the flag here instead of in layoutInlineChildren() in case that |
- // all inline children are removed from this block. |
- setContainsInlineWithOutlineAndContinuation(false); |
if (childrenInline()) |
layoutInlineChildren(relayoutChildren, afterEdge); |
else |