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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
192 | 192 |
193 DEFINE_TRACE(NGBlockNode) { | 193 DEFINE_TRACE(NGBlockNode) { |
194 visitor->trace(next_sibling_); | 194 visitor->trace(next_sibling_); |
195 visitor->trace(first_child_); | 195 visitor->trace(first_child_); |
196 NGLayoutInputNode::trace(visitor); | 196 NGLayoutInputNode::trace(visitor); |
197 } | 197 } |
198 | 198 |
199 bool NGBlockNode::CanUseNewLayout() { | 199 bool NGBlockNode::CanUseNewLayout() { |
200 if (!layout_box_->isLayoutBlockFlow()) | 200 if (!layout_box_->isLayoutBlockFlow()) |
201 return false; | 201 return false; |
202 return RuntimeEnabledFeatures::layoutNGInlineEnabled() || | 202 return RuntimeEnabledFeatures::layoutNGEnabled() || !HasInlineChildren(); |
cbiesinger1
2017/03/21 23:07:11
You can now always return true here. This code is
| |
203 !HasInlineChildren(); | |
204 } | 203 } |
205 | 204 |
206 bool NGBlockNode::HasInlineChildren() { | 205 bool NGBlockNode::HasInlineChildren() { |
207 if (!layout_box_->isLayoutBlockFlow()) | 206 if (!layout_box_->isLayoutBlockFlow()) |
208 return false; | 207 return false; |
209 | 208 |
210 const LayoutBlockFlow* block_flow = toLayoutBlockFlow(layout_box_); | 209 const LayoutBlockFlow* block_flow = toLayoutBlockFlow(layout_box_); |
211 if (!block_flow->childrenInline()) | 210 if (!block_flow->childrenInline()) |
212 return false; | 211 return false; |
213 LayoutObject* child = block_flow->firstChild(); | 212 LayoutObject* child = block_flow->firstChild(); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
327 | 326 |
328 // Save static position for legacy AbsPos layout. | 327 // Save static position for legacy AbsPos layout. |
329 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) { | 328 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) { |
330 DCHECK(layout_box_->isOutOfFlowPositioned()); | 329 DCHECK(layout_box_->isOutOfFlowPositioned()); |
331 DCHECK(layout_box_->layer()); | 330 DCHECK(layout_box_->layer()); |
332 layout_box_->layer()->setStaticBlockPosition(offset.block_offset); | 331 layout_box_->layer()->setStaticBlockPosition(offset.block_offset); |
333 layout_box_->layer()->setStaticInlinePosition(offset.inline_offset); | 332 layout_box_->layer()->setStaticInlinePosition(offset.inline_offset); |
334 } | 333 } |
335 | 334 |
336 } // namespace blink | 335 } // namespace blink |
OLD | NEW |