Index: third_party/WebKit/Source/core/frame/FrameView.cpp |
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp |
index 9d353189efb8d043a67ef5c640bd8b363b04f933..28d4deb5bdb9f730452502c8e0fa40560ff7142a 100644 |
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp |
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp |
@@ -1035,6 +1035,16 @@ void FrameView::performLayout(bool inSubtreeLayout) { |
ScriptForbiddenScope forbidScript; |
+ if (inSubtreeLayout && hasOrthogonalWritingModeRoots()) { |
+ // If we're going to lay out from each subtree root, rather than once from |
+ // LayoutView, we need to merge the depth-ordered orthogonal writing mode |
+ // root list into the depth-ordered list of subtrees scheduled for |
+ // layout. Otherwise, during layout of one such subtree, we'd risk skipping |
+ // over a subtree of objects needing layout. |
+ DCHECK(!m_layoutSubtreeRootList.isEmpty()); |
+ scheduleOrthogonalWritingModeRootsForLayout(); |
+ } |
+ |
ASSERT(!isInPerformLayout()); |
lifecycle().advanceTo(DocumentLifecycle::InPerformLayout); |
@@ -1045,9 +1055,6 @@ void FrameView::performLayout(bool inSubtreeLayout) { |
forceLayoutParentViewIfNeeded(); |
- if (hasOrthogonalWritingModeRoots()) |
- layoutOrthogonalWritingModeRoots(); |
- |
if (inSubtreeLayout) { |
if (m_analyzer) |
m_analyzer->increment(LayoutAnalyzer::PerformLayoutRootLayoutObjects, |
@@ -1065,6 +1072,8 @@ void FrameView::performLayout(bool inSubtreeLayout) { |
} |
m_layoutSubtreeRootList.clear(); |
} else { |
+ if (hasOrthogonalWritingModeRoots()) |
+ layoutOrthogonalWritingModeRoots(); |
layoutFromRootObject(*layoutView()); |
} |
@@ -2124,17 +2133,28 @@ static inline void removeFloatingObjectsForSubtreeRoot(LayoutObject& root) { |
} |
} |
+static bool prepareOrthogonalWritingModeRootForLayout(LayoutObject& root) { |
+ DCHECK(root.isBox() && toLayoutBox(root).isOrthogonalWritingModeRoot()); |
+ if (!root.needsLayout() || root.isOutOfFlowPositioned() || |
+ root.isColumnSpanAll() || |
+ !root.styleRef().logicalHeight().isIntrinsicOrAuto()) |
+ return false; |
+ |
+ removeFloatingObjectsForSubtreeRoot(root); |
+ return true; |
+} |
+ |
void FrameView::layoutOrthogonalWritingModeRoots() { |
for (auto& root : m_orthogonalWritingModeRootList.ordered()) { |
- ASSERT(root->isBox() && toLayoutBox(*root).isOrthogonalWritingModeRoot()); |
- if (!root->needsLayout() || root->isOutOfFlowPositioned() || |
- root->isColumnSpanAll() || |
- !root->styleRef().logicalHeight().isIntrinsicOrAuto()) { |
- continue; |
- } |
+ if (prepareOrthogonalWritingModeRootForLayout(*root)) |
+ layoutFromRootObject(*root); |
+ } |
+} |
- removeFloatingObjectsForSubtreeRoot(*root); |
- layoutFromRootObject(*root); |
+void FrameView::scheduleOrthogonalWritingModeRootsForLayout() { |
+ for (auto& root : m_orthogonalWritingModeRootList.ordered()) { |
+ if (prepareOrthogonalWritingModeRootForLayout(*root)) |
+ m_layoutSubtreeRootList.add(*root); |
} |
} |