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

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

Issue 2004363003: Only re-use an anonymous block for continuations if it's contained by a block flow. (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/LayoutTests/fast/deprecated-flexbox/inline-with-block-child-expected.html ('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/LayoutInline.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutInline.cpp b/third_party/WebKit/Source/core/layout/LayoutInline.cpp
index 193b17d34d493921a5ba0d7d15b422d7b7cb9006..87e25350d49835990f3f724a0e88aecfd9e8f8e2 100644
--- a/third_party/WebKit/Source/core/layout/LayoutInline.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutInline.cpp
@@ -437,29 +437,33 @@ void LayoutInline::splitFlow(LayoutObject* beforeChild, LayoutBlock* newBlockBox
// Delete our line boxes before we do the inline split into continuations.
containingBlockFlow->deleteLineBoxTree();
- bool madeNewBeforeBlock = false;
- if (block->isAnonymousBlock() && (!block->parent() || !block->parent()->createsAnonymousWrapper())) {
- // We can reuse this block and make it the preBlock of the next continuation.
- containingBlockFlow->removePositionedObjects(nullptr);
- containingBlockFlow->removeFloatingObjects();
- pre = containingBlockFlow;
- block = block->containingBlock();
- } else {
- // No anonymous block available for use. Make one.
- pre = block->createAnonymousBlock();
- madeNewBeforeBlock = true;
+ bool reusedAnonymousBlock = false;
+ if (block->isAnonymousBlock()) {
+ LayoutBlock* outerContainingBlock = block->containingBlock();
+ if (outerContainingBlock
+ && outerContainingBlock->isLayoutBlockFlow()
+ && !outerContainingBlock->createsAnonymousWrapper()) {
+ // We can reuse this block and make it the preBlock of the next continuation.
+ containingBlockFlow->removePositionedObjects(nullptr);
+ containingBlockFlow->removeFloatingObjects();
+ pre = containingBlockFlow;
+ block = outerContainingBlock;
+ reusedAnonymousBlock = true;
+ }
}
+ if (!reusedAnonymousBlock)
+ pre = block->createAnonymousBlock(); // No anonymous block available for use. Make one.
LayoutBlock* post = toLayoutBlock(pre->createAnonymousBoxWithSameTypeAs(block));
- LayoutObject* boxFirst = madeNewBeforeBlock ? block->firstChild() : pre->nextSibling();
- if (madeNewBeforeBlock)
+ LayoutObject* boxFirst = !reusedAnonymousBlock ? block->firstChild() : pre->nextSibling();
+ if (!reusedAnonymousBlock)
block->children()->insertChildNode(block, pre, boxFirst);
block->children()->insertChildNode(block, newBlockBox, boxFirst);
block->children()->insertChildNode(block, post, boxFirst);
block->setChildrenInline(false);
- if (madeNewBeforeBlock) {
+ if (!reusedAnonymousBlock) {
LayoutObject* o = boxFirst;
while (o) {
LayoutObject* no = o;
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/deprecated-flexbox/inline-with-block-child-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698