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

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

Issue 1411543009: Manually revert "Fold out-of-flow objects into anonymous blocks when removing children" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 b5ce33d2ffee005deef37a95dcb24d22a85c7855..f6994d99dbcf34b9f94ca755cf8d9da66e32f058 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -375,26 +375,6 @@ void LayoutBlock::invalidateDisplayItemClients(const LayoutBoxModelObject& paint
invalidateDisplayItemClientForStartOfContinuationsIfNeeded(*this);
}
-static void addNextFloatingOrOutOfFlowSiblingsToBlock(LayoutBlock* block, LayoutBlock* container)
-{
- LayoutObject* child = block->nextSibling();
- while (child && child->isFloatingOrOutOfFlowPositioned()) {
- LayoutObject* sibling = child->nextSibling();
- container->moveChildTo(block, child, nullptr, false);
- child = sibling;
- }
-}
-
-static void addPreviousFloatingOrOutOfFlowSiblingsToBlock(LayoutBlock* block, LayoutBlock* container)
-{
- LayoutObject* child = block->previousSibling();
- while (child && child->isFloatingOrOutOfFlowPositioned()) {
- LayoutObject* sibling = child->previousSibling();
- container->moveChildTo(block, child, block->firstChild(), false);
- child = sibling;
- }
-}
-
void LayoutBlock::addChildIgnoringContinuation(LayoutObject* newChild, LayoutObject* beforeChild)
{
if (beforeChild && beforeChild->parent() != this) {
@@ -469,9 +449,19 @@ void LayoutBlock::addChildIgnoringContinuation(LayoutObject* newChild, LayoutObj
LayoutBlock* newBox = createAnonymousBlock();
LayoutBox::addChild(newBox, beforeChild);
// Reparent adjacent floating or out-of-flow siblings to the new box.
- addPreviousFloatingOrOutOfFlowSiblingsToBlock(newBox, this);
+ LayoutObject* child = newBox->previousSibling();
+ while (child && child->isFloatingOrOutOfFlowPositioned()) {
+ LayoutObject* sibling = child->previousSibling();
+ moveChildTo(newBox, child, newBox->firstChild(), false);
+ child = sibling;
+ }
newBox->addChild(newChild);
- addNextFloatingOrOutOfFlowSiblingsToBlock(newBox, this);
+ child = newBox->nextSibling();
+ while (child && child->isFloatingOrOutOfFlowPositioned()) {
+ LayoutObject* sibling = child->nextSibling();
+ moveChildTo(newBox, child, nullptr, false);
+ child = sibling;
+ }
return;
}
}
@@ -742,13 +732,6 @@ void LayoutBlock::removeChild(LayoutObject* oldChild)
&& (!anonymousBlock->previousSibling() || (anonymousBlock->previousSibling()->style()->styleType() != NOPSEUDO && anonymousBlock->previousSibling()->isFloating() && !anonymousBlock->previousSibling()->previousSibling()))
&& (!anonymousBlock->nextSibling() || (anonymousBlock->nextSibling()->style()->styleType() != NOPSEUDO && anonymousBlock->nextSibling()->isFloating() && !anonymousBlock->nextSibling()->nextSibling()))) {
collapseAnonymousBlockChild(this, anonymousBlock);
- } else {
- // If we have floating or out-of-flow siblings now adjacent to an anonymous block, fold them
- // into it.
- if (prev && prev->isAnonymousBlock())
- addNextFloatingOrOutOfFlowSiblingsToBlock(toLayoutBlock(prev), this);
- else if (next && next->isAnonymousBlock())
- addPreviousFloatingOrOutOfFlowSiblingsToBlock(toLayoutBlock(next), this);
}
}
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/win/fast/block/float/remove-div-after-float-and-before-anonymous-block-container-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698