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 e106030ac6c138d8d707a6158cfcc99057eddaee..e79f1b3a3a9c57282638f5b2bf3e3eb069b18707 100644 |
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp |
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp |
@@ -1857,6 +1857,24 @@ bool FrameView::hasOrthogonalWritingModeRoots() const |
return !m_orthogonalWritingModeRootList.isEmpty(); |
} |
+static inline void removeFloatingObjectsForSubtreeRoot(LayoutObject& root) |
+{ |
+ // TODO(kojii): Under certain conditions, moveChildTo() defers |
+ // removeFloatingObjects() until the containing block layouts. For |
+ // instance, when descendants of the moving child is floating, |
+ // removeChildNode() does not clear them. In such cases, at this |
+ // point, FloatingObjects may contain old or even deleted objects. |
+ // Dealing this in markAllDescendantsWithFloatsForLayout() could |
+ // solve, but since that is likely to suffer the performance and |
+ // since the containing block of orthogonal writing mode roots |
+ // having floats is very rare, prefer to re-create |
+ // FloatingObjects. |
+ if (LayoutBlock* cb = root.containingBlock()) { |
+ if (cb->needsLayout() && cb->isLayoutBlockFlow()) |
+ toLayoutBlockFlow(cb)->removeFloatingObjects(); |
+ } |
+} |
+ |
void FrameView::layoutOrthogonalWritingModeRoots() |
{ |
for (auto& root : m_orthogonalWritingModeRootList.ordered()) { |
@@ -1867,8 +1885,9 @@ void FrameView::layoutOrthogonalWritingModeRoots() |
|| !root->styleRef().logicalHeight().isIntrinsicOrAuto()) { |
continue; |
} |
- LayoutState layoutState(*root); |
- root->layout(); |
+ |
+ removeFloatingObjectsForSubtreeRoot(*root); |
+ layoutFromRootObject(*root); |
} |
} |