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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 layout_box_(nullptr), | 79 layout_box_(nullptr), |
80 style_(style) { | 80 style_(style) { |
81 DCHECK(style_); | 81 DCHECK(style_); |
82 } | 82 } |
83 | 83 |
84 // Need an explicit destructor in the .cc file, or the MSWIN compiler will | 84 // Need an explicit destructor in the .cc file, or the MSWIN compiler will |
85 // produce an error when attempting to generate a default one, if the .h file is | 85 // produce an error when attempting to generate a default one, if the .h file is |
86 // included from a compilation unit that lacks the ComputedStyle definition. | 86 // included from a compilation unit that lacks the ComputedStyle definition. |
87 NGBlockNode::~NGBlockNode() {} | 87 NGBlockNode::~NGBlockNode() {} |
88 | 88 |
89 RefPtr<NGLayoutResult> NGBlockNode::Layout( | 89 RefPtr<NGLayoutResult> NGBlockNode::Layout(NGConstraintSpace* constraint_space, |
90 NGConstraintSpace* constraint_space) { | 90 NGBreakToken* break_token) { |
91 // Use the old layout code and synthesize a fragment. | 91 // Use the old layout code and synthesize a fragment. |
92 if (!CanUseNewLayout()) { | 92 if (!CanUseNewLayout()) { |
93 DCHECK(layout_box_); | 93 DCHECK(layout_box_); |
94 layout_result_ = RunOldLayout(*constraint_space); | 94 layout_result_ = RunOldLayout(*constraint_space); |
95 return layout_result_; | 95 return layout_result_; |
96 } | 96 } |
97 | 97 |
98 layout_result_ = | 98 layout_result_ = NGBlockLayoutAlgorithm(this, constraint_space, |
99 NGBlockLayoutAlgorithm(this, constraint_space, CurrentBreakToken()) | 99 toNGBlockBreakToken(break_token)) |
100 .Layout(); | 100 .Layout(); |
101 | 101 |
102 CopyFragmentDataToLayoutBox(*constraint_space); | 102 CopyFragmentDataToLayoutBox(*constraint_space); |
103 return layout_result_; | 103 return layout_result_; |
104 } | 104 } |
105 | 105 |
106 MinAndMaxContentSizes NGBlockNode::ComputeMinAndMaxContentSizes() { | 106 MinAndMaxContentSizes NGBlockNode::ComputeMinAndMaxContentSizes() { |
107 MinAndMaxContentSizes sizes; | 107 MinAndMaxContentSizes sizes; |
108 if (!CanUseNewLayout()) { | 108 if (!CanUseNewLayout()) { |
109 DCHECK(layout_box_); | 109 DCHECK(layout_box_); |
110 // TODO(layout-ng): This could be somewhat optimized by directly calling | 110 // TODO(layout-ng): This could be somewhat optimized by directly calling |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 // Save static position for legacy AbsPos layout. | 369 // Save static position for legacy AbsPos layout. |
370 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) { | 370 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) { |
371 DCHECK(layout_box_); | 371 DCHECK(layout_box_); |
372 DCHECK(layout_box_->isOutOfFlowPositioned()); | 372 DCHECK(layout_box_->isOutOfFlowPositioned()); |
373 DCHECK(layout_box_->layer()); | 373 DCHECK(layout_box_->layer()); |
374 layout_box_->layer()->setStaticBlockPosition(offset.block_offset); | 374 layout_box_->layer()->setStaticBlockPosition(offset.block_offset); |
375 layout_box_->layer()->setStaticInlinePosition(offset.inline_offset); | 375 layout_box_->layer()->setStaticInlinePosition(offset.inline_offset); |
376 } | 376 } |
377 | 377 |
378 } // namespace blink | 378 } // namespace blink |
OLD | NEW |