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_fragment_builder.h" | 5 #include "core/layout/ng/ng_fragment_builder.h" |
6 | 6 |
7 #include "core/layout/ng/ng_block_node.h" | 7 #include "core/layout/ng/ng_block_node.h" |
8 #include "core/layout/ng/ng_fragment_base.h" | 8 #include "core/layout/ng/ng_fragment_base.h" |
9 #include "core/layout/ng/ng_physical_fragment.h" | 9 #include "core/layout/ng/ng_physical_fragment.h" |
10 #include "core/layout/ng/ng_physical_text_fragment.h" | 10 #include "core/layout/ng/ng_physical_text_fragment.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 NGFragmentBuilder& NGFragmentBuilder::SetInlineOverflow(LayoutUnit size) { | 41 NGFragmentBuilder& NGFragmentBuilder::SetInlineOverflow(LayoutUnit size) { |
42 overflow_.inline_size = size; | 42 overflow_.inline_size = size; |
43 return *this; | 43 return *this; |
44 } | 44 } |
45 | 45 |
46 NGFragmentBuilder& NGFragmentBuilder::SetBlockOverflow(LayoutUnit size) { | 46 NGFragmentBuilder& NGFragmentBuilder::SetBlockOverflow(LayoutUnit size) { |
47 overflow_.block_size = size; | 47 overflow_.block_size = size; |
48 return *this; | 48 return *this; |
49 } | 49 } |
50 | 50 |
51 NGFragmentBuilder& NGFragmentBuilder::AddChild(NGFragmentBase* child, | 51 NGFragmentBuilder& NGFragmentBuilder::AddChild( |
52 NGLogicalOffset child_offset) { | 52 NGFragmentBase* child, |
| 53 const NGLogicalOffset& child_offset) { |
53 DCHECK_EQ(type_, NGPhysicalFragmentBase::kFragmentBox) | 54 DCHECK_EQ(type_, NGPhysicalFragmentBase::kFragmentBox) |
54 << "Only box fragments can have children"; | 55 << "Only box fragments can have children"; |
55 children_.append(child->PhysicalFragment()); | 56 children_.append(child->PhysicalFragment()); |
56 offsets_.append(child_offset); | 57 offsets_.append(child_offset); |
57 // Collect child's out of flow descendants. | 58 // Collect child's out of flow descendants. |
58 const NGPhysicalFragmentBase* physical_fragment = child->PhysicalFragment(); | 59 const NGPhysicalFragmentBase* physical_fragment = child->PhysicalFragment(); |
59 const Vector<NGStaticPosition>& oof_positions = | 60 const Vector<NGStaticPosition>& oof_positions = |
60 physical_fragment->OutOfFlowPositions(); | 61 physical_fragment->OutOfFlowPositions(); |
61 size_t oof_index = 0; | 62 size_t oof_index = 0; |
62 for (auto& oof_node : physical_fragment->OutOfFlowDescendants()) { | 63 for (auto& oof_node : physical_fragment->OutOfFlowDescendants()) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 out_of_flow_positions_); | 164 out_of_flow_positions_); |
164 } | 165 } |
165 | 166 |
166 DEFINE_TRACE(NGFragmentBuilder) { | 167 DEFINE_TRACE(NGFragmentBuilder) { |
167 visitor->trace(children_); | 168 visitor->trace(children_); |
168 visitor->trace(out_of_flow_descendant_candidates_); | 169 visitor->trace(out_of_flow_descendant_candidates_); |
169 visitor->trace(out_of_flow_descendants_); | 170 visitor->trace(out_of_flow_descendants_); |
170 } | 171 } |
171 | 172 |
172 } // namespace blink | 173 } // namespace blink |
OLD | NEW |