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

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

Issue 1974753002: Move block container specific parts of addChild() to LayoutBlockFlow. (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 | « no previous file | third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp » ('j') | 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 377bd5f9b16e91611a1d9f95c57d1609e5d6595c..e53c6eebc0eecbde43527091f4f866e44e950c0d 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -416,22 +416,10 @@ void LayoutBlock::addChild(LayoutObject* newChild, LayoutObject* beforeChild)
return;
}
- bool madeBoxesNonInline = false;
-
- // A block has to either have all of its children inline, or all of its children as blocks.
- // So, if our children are currently inline and a block child has to be inserted, we move all our
- // inline children into anonymous block boxes.
- if (childrenInline() && !newChild->isInline() && !newChild->isFloatingOrOutOfFlowPositioned()) {
- // This is a block with inline content. Wrap the inline content in anonymous blocks.
- makeChildrenNonInline(beforeChild);
- madeBoxesNonInline = true;
-
- if (beforeChild && beforeChild->parent() != this) {
- beforeChild = beforeChild->parent();
- ASSERT(beforeChild->isAnonymousBlock());
- ASSERT(beforeChild->parent() == this);
- }
- } else if (!childrenInline() && (newChild->isFloatingOrOutOfFlowPositioned() || newChild->isInline())) {
+ // Only LayoutBlockFlow should have inline children, and then we shouldn't be here.
+ ASSERT(!childrenInline());
+
+ if (newChild->isInline() || newChild->isFloatingOrOutOfFlowPositioned()) {
// If we're inserting an inline child but all of our children are blocks, then we have to make sure
// it is put into an anomyous block box. We try to use an existing anonymous box if possible, otherwise
// a new one is created and inserted into our list of children in the appropriate position.
@@ -446,19 +434,12 @@ void LayoutBlock::addChild(LayoutObject* newChild, LayoutObject* beforeChild)
// No suitable existing anonymous box - create a new one.
LayoutBlock* newBox = createAnonymousBlock();
LayoutBox::addChild(newBox, beforeChild);
- // Reparent adjacent floating or out-of-flow siblings to the new box.
- newBox->reparentPrecedingFloatingOrOutOfFlowSiblings();
newBox->addChild(newChild);
- newBox->reparentSubsequentFloatingOrOutOfFlowSiblings();
return;
}
}
LayoutBox::addChild(newChild, beforeChild);
-
- if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isLayoutBlock())
- toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this);
- // this object may be dead here
}
static void getInlineRun(LayoutObject* start, LayoutObject* boundary,
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698