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

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

Issue 1964983002: Turn adjacent out-of-flow sibling reparenters into proper methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bc46a2b38b836012f8081342507ed02f5b264f16..86641b44091ab45caf75ed53843c81dffef6a41d 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -284,35 +284,35 @@ static bool mergeContiguousAnonymousBlocks(LayoutObject* prev, LayoutObject*& ne
return true;
}
-static void addNextFloatingOrOutOfFlowSiblingsToBlock(LayoutBlock* block)
+void LayoutBlock::reparentSubsequentFloatingOrOutOfFlowSiblings()
{
- if (!block->parent() || !block->parent()->isLayoutBlockFlow())
+ if (!parent() || !parent()->isLayoutBlockFlow())
return;
- if (block->beingDestroyed() || block->documentBeingDestroyed())
+ if (beingDestroyed() || documentBeingDestroyed())
return;
-
- LayoutObject* child = block->nextSibling();
+ LayoutBlockFlow* parentBlockFlow = toLayoutBlockFlow(parent());
+ LayoutObject* child = nextSibling();
while (child && child->isFloatingOrOutOfFlowPositioned()) {
LayoutObject* sibling = child->nextSibling();
- toLayoutBlock(block->parent())->moveChildTo(block, child, nullptr, false);
+ parentBlockFlow->moveChildTo(this, child, nullptr, false);
child = sibling;
}
- LayoutObject* next = block->nextSibling();
- mergeContiguousAnonymousBlocks(block, next);
+ LayoutObject* next = nextSibling();
+ mergeContiguousAnonymousBlocks(this, next);
}
-static void addPreviousFloatingOrOutOfFlowSiblingsToBlock(LayoutBlock* block)
+void LayoutBlock::reparentPrecedingFloatingOrOutOfFlowSiblings()
{
- if (!block->parent() || !block->parent()->isLayoutBlockFlow())
+ if (!parent() || !parent()->isLayoutBlockFlow())
return;
- if (block->beingDestroyed() || block->documentBeingDestroyed())
+ if (beingDestroyed() || documentBeingDestroyed())
return;
-
- LayoutObject* child = block->previousSibling();
+ LayoutBlockFlow* parentBlockFlow = toLayoutBlockFlow(parent());
+ LayoutObject* child = previousSibling();
while (child && child->isFloatingOrOutOfFlowPositioned()) {
LayoutObject* sibling = child->previousSibling();
- toLayoutBlock(block->parent())->moveChildTo(block, child, block->firstChild(), false);
+ parentBlockFlow->moveChildTo(this, child, firstChild(), false);
child = sibling;
}
}
@@ -328,7 +328,7 @@ void LayoutBlock::styleDidChange(StyleDifference diff, const ComputedStyle* oldS
LayoutBlock* newParent = toLayoutBlock(previousSibling());
toLayoutBlock(parent())->moveChildTo(newParent, this, nullptr, false);
// The anonymous block we've moved to may now be adjacent to former siblings of ours that it can contain also.
- addNextFloatingOrOutOfFlowSiblingsToBlock(newParent);
+ newParent->reparentSubsequentFloatingOrOutOfFlowSiblings();
} else if (nextSibling() && nextSibling()->isAnonymousBlock()) {
toLayoutBlock(parent())->moveChildTo(toLayoutBlock(nextSibling()), this, nextSibling()->slowFirstChild(), false);
}
@@ -478,9 +478,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.
- addPreviousFloatingOrOutOfFlowSiblingsToBlock(newBox);
+ newBox->reparentPrecedingFloatingOrOutOfFlowSiblings();
newBox->addChild(newChild);
- addNextFloatingOrOutOfFlowSiblingsToBlock(newBox);
+ newBox->reparentSubsequentFloatingOrOutOfFlowSiblings();
return;
}
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698