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/LayoutMultiColumnFlowThread.h" | 8 #include "core/layout/LayoutMultiColumnFlowThread.h" |
9 #include "core/layout/LayoutMultiColumnSet.h" | 9 #include "core/layout/LayoutMultiColumnSet.h" |
10 #include "core/layout/api/LineLayoutAPIShim.h" | 10 #include "core/layout/api/LineLayoutAPIShim.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 return first_child_; | 231 return first_child_; |
232 } | 232 } |
233 | 233 |
234 DEFINE_TRACE(NGBlockNode) { | 234 DEFINE_TRACE(NGBlockNode) { |
235 visitor->trace(next_sibling_); | 235 visitor->trace(next_sibling_); |
236 visitor->trace(first_child_); | 236 visitor->trace(first_child_); |
237 NGLayoutInputNode::trace(visitor); | 237 NGLayoutInputNode::trace(visitor); |
238 } | 238 } |
239 | 239 |
240 bool NGBlockNode::CanUseNewLayout() { | 240 bool NGBlockNode::CanUseNewLayout() { |
| 241 // [Multicol]: for the 1st phase of LayoutNG's multicol implementation we want |
| 242 // to utilize the existing ColumnBalancer class. That's why a multicol block |
| 243 // should be processed by Legacy Layout engine. |
| 244 if (Style().specifiesColumns()) |
| 245 return false; |
| 246 |
241 if (!layout_box_->isLayoutBlockFlow()) | 247 if (!layout_box_->isLayoutBlockFlow()) |
242 return false; | 248 return false; |
243 return RuntimeEnabledFeatures::layoutNGEnabled() || !HasInlineChildren(); | 249 return RuntimeEnabledFeatures::layoutNGEnabled() || !HasInlineChildren(); |
244 } | 250 } |
245 | 251 |
246 bool NGBlockNode::HasInlineChildren() { | 252 bool NGBlockNode::HasInlineChildren() { |
247 if (!layout_box_->isLayoutBlockFlow()) | 253 if (!layout_box_->isLayoutBlockFlow()) |
248 return false; | 254 return false; |
249 | 255 |
250 const LayoutBlockFlow* block_flow = toLayoutBlockFlow(layout_box_); | 256 const LayoutBlockFlow* block_flow = toLayoutBlockFlow(layout_box_); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 375 |
370 // Save static position for legacy AbsPos layout. | 376 // Save static position for legacy AbsPos layout. |
371 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) { | 377 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) { |
372 DCHECK(layout_box_->isOutOfFlowPositioned()); | 378 DCHECK(layout_box_->isOutOfFlowPositioned()); |
373 DCHECK(layout_box_->layer()); | 379 DCHECK(layout_box_->layer()); |
374 layout_box_->layer()->setStaticBlockPosition(offset.block_offset); | 380 layout_box_->layer()->setStaticBlockPosition(offset.block_offset); |
375 layout_box_->layer()->setStaticInlinePosition(offset.inline_offset); | 381 layout_box_->layer()->setStaticInlinePosition(offset.inline_offset); |
376 } | 382 } |
377 | 383 |
378 } // namespace blink | 384 } // namespace blink |
OLD | NEW |