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 #ifndef NGFragmentBuilder_h | 5 #ifndef NGFragmentBuilder_h |
6 #define NGFragmentBuilder_h | 6 #define NGFragmentBuilder_h |
7 | 7 |
8 #include "core/layout/ng/ng_break_token.h" | 8 #include "core/layout/ng/ng_break_token.h" |
9 #include "core/layout/ng/ng_constraint_space.h" | 9 #include "core/layout/ng/ng_constraint_space.h" |
10 #include "core/layout/ng/ng_floating_object.h" | 10 #include "core/layout/ng/ng_floating_object.h" |
11 #include "core/layout/ng/ng_physical_fragment.h" | 11 #include "core/layout/ng/ng_physical_fragment.h" |
12 #include "core/layout/ng/ng_units.h" | 12 #include "core/layout/ng/ng_units.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class NGInlineNode; | 16 class NGInlineNode; |
17 class NGPhysicalBoxFragment; | 17 class NGLayoutResult; |
18 class NGPhysicalTextFragment; | 18 class NGPhysicalTextFragment; |
19 | 19 |
20 class CORE_EXPORT NGFragmentBuilder final { | 20 class CORE_EXPORT NGFragmentBuilder final { |
21 public: | 21 public: |
22 NGFragmentBuilder(NGPhysicalFragment::NGFragmentType, LayoutObject*); | 22 NGFragmentBuilder(NGPhysicalFragment::NGFragmentType, LayoutObject*); |
23 | 23 |
24 using WeakBoxList = PersistentHeapLinkedHashSet<WeakMember<NGBlockNode>>; | 24 using WeakBoxList = PersistentHeapLinkedHashSet<WeakMember<NGBlockNode>>; |
25 | 25 |
26 NGFragmentBuilder& SetWritingMode(NGWritingMode); | 26 NGFragmentBuilder& SetWritingMode(NGWritingMode); |
27 NGFragmentBuilder& SetDirection(TextDirection); | 27 NGFragmentBuilder& SetDirection(TextDirection); |
28 | 28 |
29 NGFragmentBuilder& SetInlineSize(LayoutUnit); | 29 NGFragmentBuilder& SetInlineSize(LayoutUnit); |
30 NGFragmentBuilder& SetBlockSize(LayoutUnit); | 30 NGFragmentBuilder& SetBlockSize(LayoutUnit); |
31 NGLogicalSize Size() const { return size_; } | 31 NGLogicalSize Size() const { return size_; } |
32 | 32 |
33 NGFragmentBuilder& SetInlineOverflow(LayoutUnit); | 33 NGFragmentBuilder& SetInlineOverflow(LayoutUnit); |
34 NGFragmentBuilder& SetBlockOverflow(LayoutUnit); | 34 NGFragmentBuilder& SetBlockOverflow(LayoutUnit); |
35 | 35 |
| 36 NGFragmentBuilder& AddChild(RefPtr<NGLayoutResult>, const NGLogicalOffset&); |
36 NGFragmentBuilder& AddChild(RefPtr<NGPhysicalFragment>, | 37 NGFragmentBuilder& AddChild(RefPtr<NGPhysicalFragment>, |
37 const NGLogicalOffset&); | 38 const NGLogicalOffset&); |
38 NGFragmentBuilder& AddFloatingObject(NGFloatingObject*, | 39 NGFragmentBuilder& AddFloatingObject(NGFloatingObject*, |
39 const NGLogicalOffset&); | 40 const NGLogicalOffset&); |
40 | 41 |
41 NGFragmentBuilder& SetBfcOffset(const NGLogicalOffset& offset); | 42 NGFragmentBuilder& SetBfcOffset(const NGLogicalOffset& offset); |
42 | 43 |
43 NGFragmentBuilder& AddUnpositionedFloat(NGFloatingObject* floating_object); | 44 NGFragmentBuilder& AddUnpositionedFloat(NGFloatingObject* floating_object); |
44 | 45 |
45 // Builder has non-trivial out-of-flow descendant methods. | 46 // Builder has non-trivial out-of-flow descendant methods. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 84 |
84 NGFragmentBuilder& SetEndMarginStrut(const NGMarginStrut& from) { | 85 NGFragmentBuilder& SetEndMarginStrut(const NGMarginStrut& from) { |
85 end_margin_strut_ = from; | 86 end_margin_strut_ = from; |
86 return *this; | 87 return *this; |
87 } | 88 } |
88 | 89 |
89 // Offsets are not supposed to be set during fragment construction, so we | 90 // Offsets are not supposed to be set during fragment construction, so we |
90 // do not provide a setter here. | 91 // do not provide a setter here. |
91 | 92 |
92 // Creates the fragment. Can only be called once. | 93 // Creates the fragment. Can only be called once. |
93 RefPtr<NGPhysicalBoxFragment> ToBoxFragment(); | 94 RefPtr<NGLayoutResult> ToBoxFragment(); |
94 RefPtr<NGPhysicalTextFragment> ToTextFragment(NGInlineNode*, | 95 RefPtr<NGPhysicalTextFragment> ToTextFragment(NGInlineNode*, |
95 unsigned index, | 96 unsigned index, |
96 unsigned start_offset, | 97 unsigned start_offset, |
97 unsigned end_offset); | 98 unsigned end_offset); |
98 | 99 |
99 // Mutable list of floats that need to be positioned. | 100 // Mutable list of floats that need to be positioned. |
100 Vector<Persistent<NGFloatingObject>>& MutableUnpositionedFloats() { | 101 Vector<Persistent<NGFloatingObject>>& MutableUnpositionedFloats() { |
101 return unpositioned_floats_; | 102 return unpositioned_floats_; |
102 } | 103 } |
103 | 104 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 157 |
157 Persistent<NGBreakToken> break_token_; | 158 Persistent<NGBreakToken> break_token_; |
158 | 159 |
159 WTF::Optional<NGLogicalOffset> bfc_offset_; | 160 WTF::Optional<NGLogicalOffset> bfc_offset_; |
160 NGMarginStrut end_margin_strut_; | 161 NGMarginStrut end_margin_strut_; |
161 }; | 162 }; |
162 | 163 |
163 } // namespace blink | 164 } // namespace blink |
164 | 165 |
165 #endif // NGFragmentBuilder | 166 #endif // NGFragmentBuilder |
OLD | NEW |