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

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

Issue 1968403002: LayoutBlock::removeChild() override no longer needed. (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.cpp ('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/LayoutBlockFlow.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
index 41c2a8b01561d1995b4ed3b97965ec192ad515d5..3f844216afbd00ad0484633185c5fe79f1813bd5 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -2308,7 +2308,29 @@ void LayoutBlockFlow::removeChild(LayoutObject* oldChild)
return;
}
+ // If this child is a block, and if our previous and next siblings are
+ // both anonymous blocks with inline content, then we can go ahead and
+ // fold the inline content back together.
+ LayoutObject* prev = oldChild->previousSibling();
+ LayoutObject* next = oldChild->nextSibling();
+ bool mergedAnonymousBlocks = false;
+ if (prev && next && !oldChild->isInline() && !oldChild->virtualContinuation() && prev->isLayoutBlockFlow() && next->isLayoutBlockFlow()) {
+ if (toLayoutBlockFlow(prev)->mergeSiblingContiguousAnonymousBlock(toLayoutBlockFlow(next))) {
+ mergedAnonymousBlocks = true;
+ next = nullptr;
+ }
+ }
+
LayoutBlock::removeChild(oldChild);
+
+ LayoutObject* child = prev ? prev : next;
+ if (mergedAnonymousBlocks && child && !child->previousSibling() && !child->nextSibling()) {
+ // The removal has knocked us down to containing only a single anonymous
+ // box. We can go ahead and pull the content right back up into our
+ // box.
+ collapseAnonymousBlockChild(this, toLayoutBlock(child));
+ }
+
if (!firstChild()) {
// If this was our last child be sure to clear out our line boxes.
if (childrenInline())
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698