| 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 540dbd3c8de5a9112a7b7c59384ef6b698f2e479..b55ccb4938fff98a52d03d2d5294a7bd7cc70d4f 100644
|
| --- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
|
| @@ -2986,8 +2986,30 @@ void LayoutBlockFlow::AddChild(LayoutObject* new_child,
|
| // 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.
|
| - bool child_is_block_level =
|
| - !new_child->IsInline() && !new_child->IsFloatingOrOutOfFlowPositioned();
|
| + bool child_is_block_level = !new_child->IsInline();
|
| +
|
| + // ** LayoutNG **
|
| + // We want to use the block layout for out of flow positioned
|
| + // objects when they go in front of inline blocks or if they are just
|
| + // standalone objects.
|
| + // Example 1:
|
| + // <div id="zero"><div id="oof"></div></div>
|
| + // Legacy Layout: #oof is in inline context.
|
| + // LayoutNG: #oof is in block context.
|
| + //
|
| + // Example 2:
|
| + // <div id=container><oof></oof>Hello!</div>
|
| + // Legacy Layout: oof is in inline context.
|
| + // LayoutNG: oof is in block context.
|
| + //
|
| + // Example 3:
|
| + // <div id=container>Hello!<oof></oof></div>
|
| + // Legacy Layout: oof is in inline context.
|
| + // LayoutNG: oof is in inline context.
|
| + bool layout_ng_enabled = RuntimeEnabledFeatures::layoutNGEnabled();
|
| + if (new_child->IsFloatingOrOutOfFlowPositioned())
|
| + child_is_block_level = layout_ng_enabled && !FirstChild();
|
| +
|
| if (ChildrenInline()) {
|
| if (child_is_block_level) {
|
| // Wrap the inline content in anonymous blocks, to allow for the new block
|
| @@ -3021,7 +3043,8 @@ void LayoutBlockFlow::AddChild(LayoutObject* new_child,
|
| LayoutBlockFlow* new_block = ToLayoutBlockFlow(CreateAnonymousBlock());
|
| LayoutBox::AddChild(new_block, before_child);
|
| // Reparent adjacent floating or out-of-flow siblings to the new box.
|
| - new_block->ReparentPrecedingFloatingOrOutOfFlowSiblings();
|
| + if (!layout_ng_enabled)
|
| + new_block->ReparentPrecedingFloatingOrOutOfFlowSiblings();
|
| new_block->AddChild(new_child);
|
| new_block->ReparentSubsequentFloatingOrOutOfFlowSiblings();
|
| return;
|
|
|