| 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())
|
|
|