OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/layout/ng/ng_block_node.h" | 5 #include "core/layout/ng/ng_block_node.h" |
6 | 6 |
7 #include "core/layout/LayoutBlockFlow.h" | 7 #include "core/layout/LayoutBlockFlow.h" |
8 #include "core/layout/api/LineLayoutAPIShim.h" | 8 #include "core/layout/api/LineLayoutAPIShim.h" |
9 #include "core/layout/line/InlineIterator.h" | 9 #include "core/layout/line/InlineIterator.h" |
10 #include "core/layout/ng/layout_ng_block_flow.h" | 10 #include "core/layout/ng/layout_ng_block_flow.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 floating_object->setY(fragment_->TopOffset()); | 222 floating_object->setY(fragment_->TopOffset()); |
223 floating_object->setIsPlaced(true); | 223 floating_object->setIsPlaced(true); |
224 } | 224 } |
225 } | 225 } |
226 | 226 |
227 bool NGBlockNode::CanUseNewLayout() { | 227 bool NGBlockNode::CanUseNewLayout() { |
228 if (!layout_box_) | 228 if (!layout_box_) |
229 return true; | 229 return true; |
230 if (!layout_box_->isLayoutBlockFlow()) | 230 if (!layout_box_->isLayoutBlockFlow()) |
231 return false; | 231 return false; |
232 if (RuntimeEnabledFeatures::layoutNGInlineEnabled()) | 232 return RuntimeEnabledFeatures::layoutNGInlineEnabled() || |
233 return true; | 233 !HasInlineChildren(); |
234 if (HasInlineChildren()) | |
235 return false; | |
236 return true; | |
237 } | 234 } |
238 | 235 |
239 bool NGBlockNode::HasInlineChildren() { | 236 bool NGBlockNode::HasInlineChildren() { |
240 if (!layout_box_) | 237 if (!layout_box_) |
241 return false; | 238 return false; |
242 | 239 |
243 const LayoutBlockFlow* block_flow = toLayoutBlockFlow(layout_box_); | 240 const LayoutBlockFlow* block_flow = toLayoutBlockFlow(layout_box_); |
244 LayoutObject* child = block_flow->firstChild(); | 241 LayoutObject* child = block_flow->firstChild(); |
245 while (child) { | 242 while (child) { |
246 if (child->isInline()) | 243 if (child->isInline()) |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 .SetBlockSize(layout_box_->logicalHeight()) | 312 .SetBlockSize(layout_box_->logicalHeight()) |
316 .SetDirection(layout_box_->styleRef().direction()) | 313 .SetDirection(layout_box_->styleRef().direction()) |
317 .SetWritingMode( | 314 .SetWritingMode( |
318 FromPlatformWritingMode(layout_box_->styleRef().getWritingMode())) | 315 FromPlatformWritingMode(layout_box_->styleRef().getWritingMode())) |
319 .SetInlineOverflow(overflow.width()) | 316 .SetInlineOverflow(overflow.width()) |
320 .SetBlockOverflow(overflow.height()); | 317 .SetBlockOverflow(overflow.height()); |
321 return builder.ToFragment(); | 318 return builder.ToFragment(); |
322 } | 319 } |
323 | 320 |
324 } // namespace blink | 321 } // namespace blink |
OLD | NEW |