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

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

Issue 1968413002: Move some reparenting and anonymous block merge functionality down to LayoutBlockFlow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Is this thing on? 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
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 aa2ca6c0e8c2d607c669084117b148dab9a1247f..b5c5a2a55afa7b321522ef905e1c336a2f8aabd3 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -249,71 +249,6 @@ static bool borderOrPaddingLogicalDimensionChanged(const ComputedStyle& oldStyle
|| oldStyle.paddingBottom() != newStyle.paddingBottom();
}
-static bool isMergeableAnonymousBlock(const LayoutBlockFlow* block)
-{
- return block->isAnonymousBlock() && !block->continuation() && !block->beingDestroyed() && !block->isRubyRun() && !block->isRubyBase();
-}
-
-bool LayoutBlock::mergeSiblingContiguousAnonymousBlock(LayoutBlockFlow* siblingThatMayBeDeleted)
-{
- if (!isLayoutBlockFlow())
- return false;
-
- // Note: |this| and |siblingThatMayBeDeleted| may not be adjacent siblings at this point. There
- // may be an object between them which is about to be removed.
-
- if (!isMergeableAnonymousBlock(toLayoutBlockFlow(this)) || !isMergeableAnonymousBlock(siblingThatMayBeDeleted))
- return false;
-
- setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvalidationReason::AnonymousBlockChange);
-
- // If the inlineness of children of the two block don't match, we'd need special code here
- // (but there should be no need for it).
- ASSERT(siblingThatMayBeDeleted->childrenInline() == childrenInline());
- // Take all the children out of the |next| block and put them in
- // the |prev| block.
- siblingThatMayBeDeleted->moveAllChildrenIncludingFloatsTo(this, siblingThatMayBeDeleted->hasLayer() || hasLayer());
- // Delete the now-empty block's lines and nuke it.
- siblingThatMayBeDeleted->deleteLineBoxTree();
- siblingThatMayBeDeleted->destroy();
- return true;
-}
-
-void LayoutBlock::reparentSubsequentFloatingOrOutOfFlowSiblings()
-{
- if (!parent() || !parent()->isLayoutBlockFlow())
- return;
- if (beingDestroyed() || documentBeingDestroyed())
- return;
- LayoutBlockFlow* parentBlockFlow = toLayoutBlockFlow(parent());
- LayoutObject* child = nextSibling();
- while (child && child->isFloatingOrOutOfFlowPositioned()) {
- LayoutObject* sibling = child->nextSibling();
- parentBlockFlow->moveChildTo(this, child, nullptr, false);
- child = sibling;
- }
-
- if (LayoutObject* next = nextSibling()) {
- if (next->isLayoutBlockFlow())
- mergeSiblingContiguousAnonymousBlock(toLayoutBlockFlow(next));
- }
-}
-
-void LayoutBlock::reparentPrecedingFloatingOrOutOfFlowSiblings()
-{
- if (!parent() || !parent()->isLayoutBlockFlow())
- return;
- if (beingDestroyed() || documentBeingDestroyed())
- return;
- LayoutBlockFlow* parentBlockFlow = toLayoutBlockFlow(parent());
- LayoutObject* child = previousSibling();
- while (child && child->isFloatingOrOutOfFlowPositioned()) {
- LayoutObject* sibling = child->previousSibling();
- parentBlockFlow->moveChildTo(this, child, firstChild(), false);
- child = sibling;
- }
-}
-
void LayoutBlock::styleDidChange(StyleDifference diff, const ComputedStyle* oldStyle)
{
LayoutBox::styleDidChange(diff, oldStyle);
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | third_party/WebKit/Source/core/layout/LayoutBlockFlow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698