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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBlock.cpp

Issue 1406163003: Fold out-of-flow objects into anonymous blocks when removing children (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@523282-3
Patch Set: Updated Created 5 years, 2 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
Index: third_party/WebKit/Source/core/layout/LayoutBlock.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
index 75fabaddfae7c3372eb547349e52000fce1ab42a..5e38121ab0a62c05194c4846c950c5706fa1a7fe 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -369,6 +369,16 @@ void LayoutBlock::invalidateDisplayItemClients(const LayoutBoxModelObject& paint
invalidateDisplayItemClientForStartOfContinuationsIfNeeded(*this);
}
+static void addSubsequentFloatingSiblingsToBlock(LayoutBlock* block, LayoutBlock* container)
mstensho (USE GERRIT) 2015/10/29 20:00:26 FloatingOrOutOfFlowSiblings
+{
+ LayoutObject* child = block->nextSibling();
+ while (child && child->isFloatingOrOutOfFlowPositioned()) {
+ LayoutObject* sibling = child->nextSibling();
+ container->moveChildTo(block, child, nullptr, false);
+ child = sibling;
+ }
+}
+
void LayoutBlock::addChildIgnoringContinuation(LayoutObject* newChild, LayoutObject* beforeChild)
{
if (beforeChild && beforeChild->parent() != this) {
@@ -435,6 +445,7 @@ void LayoutBlock::addChildIgnoringContinuation(LayoutObject* newChild, LayoutObj
if (afterChild && afterChild->isAnonymousBlock()) {
afterChild->addChild(newChild);
+ addSubsequentFloatingSiblingsToBlock(toLayoutBlock(afterChild), this);
mstensho (USE GERRIT) 2015/10/29 20:00:26 Why would there be subsequent floats or out-of-flo
return;
}
@@ -450,12 +461,7 @@ void LayoutBlock::addChildIgnoringContinuation(LayoutObject* newChild, LayoutObj
child = sibling;
}
newBox->addChild(newChild);
- child = newBox->nextSibling();
- while (child && child->isFloatingOrOutOfFlowPositioned()) {
- LayoutObject* sibling = child->nextSibling();
- moveChildTo(newBox, child, nullptr, false);
- child = sibling;
- }
+ addSubsequentFloatingSiblingsToBlock(newBox, this);
return;
}
}

Powered by Google App Engine
This is Rietveld 408576698