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 9fd14255efb568cc83fcfc7da64129b8aba15919..3e9abd5d671ba8aaeedaf0b269388036334bdd4c 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
@@ -2984,8 +2984,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. |
ikilpatrick
2017/04/27 20:34:23
did we want the end children in the 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 |