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 0cea0eb22dae2576fade4e41ee74a0fa4bd7d5a5..4b6967b4b463ef9316d89724eb2a2abc1776ce3d 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp |
@@ -375,6 +375,26 @@ void LayoutBlock::invalidateDisplayItemClients(const LayoutBoxModelObject& paint |
invalidateDisplayItemClientForStartOfContinuationsIfNeeded(*this); |
} |
+static void addSubsequentFloatingOrOutOfFlowSiblingsToBlock(LayoutBlock* block, LayoutBlock* container) |
mstensho (USE GERRIT)
2015/11/03 20:53:17
As an antonym to "Previous", maybe "Next" instead
|
+{ |
+ 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) { |
@@ -449,19 +469,9 @@ 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. |
- LayoutObject* child = newBox->previousSibling(); |
- while (child && child->isFloatingOrOutOfFlowPositioned()) { |
- LayoutObject* sibling = child->previousSibling(); |
- moveChildTo(newBox, child, newBox->firstChild(), false); |
- child = sibling; |
- } |
+ addPreviousFloatingOrOutOfFlowSiblingsToBlock(newBox, this); |
newBox->addChild(newChild); |
- child = newBox->nextSibling(); |
- while (child && child->isFloatingOrOutOfFlowPositioned()) { |
- LayoutObject* sibling = child->nextSibling(); |
- moveChildTo(newBox, child, nullptr, false); |
- child = sibling; |
- } |
+ addSubsequentFloatingOrOutOfFlowSiblingsToBlock(newBox, this); |
return; |
} |
} |
@@ -729,6 +739,10 @@ void LayoutBlock::removeChild(LayoutObject* oldChild) |
&& (!anonymousBlock->nextSibling() || (anonymousBlock->nextSibling()->style()->styleType() != NOPSEUDO && anonymousBlock->nextSibling()->isFloating() && !anonymousBlock->nextSibling()->nextSibling()))) { |
collapseAnonymousBlockChild(this, anonymousBlock); |
} |
+ if (prev && prev->isAnonymousBlock()) |
+ addSubsequentFloatingOrOutOfFlowSiblingsToBlock(toLayoutBlock(prev), this); |
+ if (next && next->isAnonymousBlock()) |
mstensho (USE GERRIT)
2015/11/03 20:53:17
else if?
|
+ addPreviousFloatingOrOutOfFlowSiblingsToBlock(toLayoutBlock(next), this); |
} |
if (!firstChild()) { |