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

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

Issue 1310253005: Strip anonymous wrappers when a block flow no longer requires them (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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: Source/core/layout/LayoutBlock.cpp
diff --git a/Source/core/layout/LayoutBlock.cpp b/Source/core/layout/LayoutBlock.cpp
index 116c979367c9b7c7fc0eb820d6eeff761531ee70..bd2ae4a4dacab025edc67144fad8e415dd676973 100644
--- a/Source/core/layout/LayoutBlock.cpp
+++ b/Source/core/layout/LayoutBlock.cpp
@@ -449,6 +449,21 @@ void LayoutBlock::addChildIgnoringContinuation(LayoutObject* newChild, LayoutObj
LayoutBlock* newBox = createAnonymousBlock();
LayoutBox::addChild(newBox, beforeChild);
newBox->addChild(newChild);
+ LayoutObject* nextChild = beforeChild;
+ // Reparent adjacent inline siblings to the new box.
mstensho (USE GERRIT) 2015/08/26 19:44:15 As szager has already pointed out, how could there
+ while (nextChild && (nextChild->isFloatingOrOutOfFlowPositioned() || nextChild->isInline() || nextChild->isAnonymousBlock())) {
szager1 2015/08/26 17:04:40 nextChild->isInline() should never be true here
+ LayoutObject* sibling = nextChild->nextSibling();
+ if (nextChild->isAnonymousBlock()) {
+ LayoutBlockFlow* nextBlock = toLayoutBlockFlow(nextChild);
+ nextBlock->moveAllChildrenIncludingFloatsTo(newBox, true);
+ // Delete the now-empty block's lines and nuke it.
+ nextBlock->deleteLineBoxTree();
szager1 2015/08/26 17:04:40 Redundant? nextBlock->moveAllChildrenIncludingFlo
+ nextBlock->destroy();
+ } else {
+ moveChildTo(newBox, nextChild, 0, true);
+ }
+ nextChild = sibling;
+ }
return;
}
}

Powered by Google App Engine
This is Rietveld 408576698