Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1402)

Unified Diff: Source/core/rendering/RenderBlockFlow.cpp

Issue 218663004: Changing between multicol and regular block shouldn't recreate all renderers. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Code review Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.h ('k') | Source/core/rendering/RenderMultiColumnFlowThread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBlockFlow.cpp
diff --git a/Source/core/rendering/RenderBlockFlow.cpp b/Source/core/rendering/RenderBlockFlow.cpp
index 8e86cd9c3a371df555fd7d5b3ae7a4a0cf41af42..07048ce680645a70b866ca6f6c79689cb98f9a31 100644
--- a/Source/core/rendering/RenderBlockFlow.cpp
+++ b/Source/core/rendering/RenderBlockFlow.cpp
@@ -1864,7 +1864,8 @@ void RenderBlockFlow::styleDidChange(StyleDifference diff, const RenderStyle* ol
parentBlockFlow->markSiblingsWithFloatsForLayout();
}
- createMultiColumnFlowThreadIfNeeded();
+ if (diff == StyleDifferenceLayout || !oldStyle)
+ createOrDestroyMultiColumnFlowThreadIfNeeded();
}
void RenderBlockFlow::updateStaticInlinePositionForChild(RenderBox* child, LayoutUnit logicalTop)
@@ -2778,20 +2779,25 @@ RootInlineBox* RenderBlockFlow::createRootInlineBox()
return new RootInlineBox(*this);
}
-void RenderBlockFlow::createMultiColumnFlowThreadIfNeeded()
+void RenderBlockFlow::createOrDestroyMultiColumnFlowThreadIfNeeded()
{
- if ((style()->hasAutoColumnCount() && style()->hasAutoColumnWidth()) || !document().regionBasedColumnsEnabled())
+ if (!document().regionBasedColumnsEnabled())
return;
- if (multiColumnFlowThread())
- return;
-
- setChildrenInline(false);
- RenderMultiColumnFlowThread* flowThread = RenderMultiColumnFlowThread::createAnonymous(document(), style());
- RenderBlock::addChild(flowThread);
- RenderBlockFlowRareData& rareData = ensureRareData();
- ASSERT(!rareData.m_multiColumnFlowThread);
- rareData.m_multiColumnFlowThread = flowThread;
+ bool needsFlowThread = style()->specifiesColumns();
+ if (needsFlowThread != static_cast<bool>(multiColumnFlowThread())) {
+ if (needsFlowThread) {
+ RenderMultiColumnFlowThread* flowThread = RenderMultiColumnFlowThread::createAnonymous(document(), style());
+ addChild(flowThread);
+ flowThread->populate();
+ RenderBlockFlowRareData& rareData = ensureRareData();
+ ASSERT(!rareData.m_multiColumnFlowThread);
+ rareData.m_multiColumnFlowThread = flowThread;
+ } else {
+ multiColumnFlowThread()->evacuateAndDestroy();
+ ASSERT(!multiColumnFlowThread());
+ }
+ }
}
RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData()
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.h ('k') | Source/core/rendering/RenderMultiColumnFlowThread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698