Index: Source/core/layout/LayoutMultiColumnSpannerPlaceholder.cpp |
diff --git a/Source/core/layout/LayoutMultiColumnSpannerPlaceholder.cpp b/Source/core/layout/LayoutMultiColumnSpannerPlaceholder.cpp |
index 5f5b00b91bb97e56788f76c300fe39e3c86186e3..bf360b12ef11bb36c39b1b7928a75a6dd45d1148 100644 |
--- a/Source/core/layout/LayoutMultiColumnSpannerPlaceholder.cpp |
+++ b/Source/core/layout/LayoutMultiColumnSpannerPlaceholder.cpp |
@@ -34,6 +34,25 @@ LayoutMultiColumnSpannerPlaceholder::LayoutMultiColumnSpannerPlaceholder(LayoutB |
{ |
} |
+void LayoutMultiColumnSpannerPlaceholder::layoutObjectInFlowThreadStyleDidChange(const ComputedStyle* oldStyle) |
+{ |
+ LayoutBox* objectInFlowThread = m_layoutObjectInFlowThread; |
+ if (flowThread()->removeSpannerPlaceholderIfNoLongerValid(objectInFlowThread)) { |
+ // No longer a valid spanner, due to style changes. |this| is now dead. |
+ if (objectInFlowThread->style()->hasOutOfFlowPosition() && !oldStyle->hasOutOfFlowPosition()) { |
+ // We went from being a spanner to being out-of-flow positioned. When an object becomes |
+ // out-of-flow positioned, we need to lay out its parent, since that's where the |
+ // now-out-of-flow object gets added to the right containing block for out-of-flow |
+ // positioned objects. Since neither a spanner nor an out-of-flow object is guaranteed |
+ // to have this parent in its containing block chain, we need to mark it here, or we |
+ // risk that the object isn't laid out. |
+ objectInFlowThread->parent()->setNeedsLayout(LayoutInvalidationReason::ColumnsChanged); |
+ } |
+ return; |
+ } |
+ updateMarginProperties(); |
+} |
+ |
void LayoutMultiColumnSpannerPlaceholder::updateMarginProperties() |
{ |
RefPtr<ComputedStyle> newStyle = ComputedStyle::clone(styleRef()); |
@@ -43,8 +62,13 @@ void LayoutMultiColumnSpannerPlaceholder::updateMarginProperties() |
void LayoutMultiColumnSpannerPlaceholder::willBeRemovedFromTree() |
{ |
- if (m_layoutObjectInFlowThread) |
+ if (m_layoutObjectInFlowThread) { |
+ LayoutBox* exSpanner = m_layoutObjectInFlowThread; |
m_layoutObjectInFlowThread->clearSpannerPlaceholder(); |
+ // Even if the placeholder is going away, the object in the flow thread might live on. Since |
+ // it's not a spanner anymore, it needs to be relaid out. |
+ exSpanner->setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::ColumnsChanged); |
+ } |
LayoutBox::willBeRemovedFromTree(); |
} |