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_fragment.h" | 8 #include "core/layout/ng/ng_fragment.h" |
9 #include "core/layout/ng/ng_units.h" | 9 #include "core/layout/ng/ng_units.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class CORE_EXPORT NGFragmentBuilder final | 13 class CORE_EXPORT NGFragmentBuilder final |
14 : public GarbageCollectedFinalized<NGFragmentBuilder> { | 14 : public GarbageCollectedFinalized<NGFragmentBuilder> { |
15 public: | 15 public: |
16 NGFragmentBuilder(NGPhysicalFragmentBase::NGFragmentType); | 16 NGFragmentBuilder(NGPhysicalFragmentBase::NGFragmentType); |
17 | 17 |
| 18 using WeakBoxList = HeapLinkedHashSet<WeakMember<NGBox>>; |
| 19 |
18 NGFragmentBuilder& SetWritingMode(NGWritingMode); | 20 NGFragmentBuilder& SetWritingMode(NGWritingMode); |
19 NGFragmentBuilder& SetDirection(TextDirection); | 21 NGFragmentBuilder& SetDirection(TextDirection); |
20 | 22 |
21 NGFragmentBuilder& SetInlineSize(LayoutUnit); | 23 NGFragmentBuilder& SetInlineSize(LayoutUnit); |
22 NGFragmentBuilder& SetBlockSize(LayoutUnit); | 24 NGFragmentBuilder& SetBlockSize(LayoutUnit); |
23 | 25 |
24 NGFragmentBuilder& SetInlineOverflow(LayoutUnit); | 26 NGFragmentBuilder& SetInlineOverflow(LayoutUnit); |
25 NGFragmentBuilder& SetBlockOverflow(LayoutUnit); | 27 NGFragmentBuilder& SetBlockOverflow(LayoutUnit); |
26 | 28 |
27 NGFragmentBuilder& AddChild(NGFragmentBase*, NGLogicalOffset); | 29 NGFragmentBuilder& AddChild(NGFragmentBase*, NGLogicalOffset); |
28 | 30 |
| 31 NGFragmentBuilder& SetOutOfFlowDescendants(WeakBoxList&, |
| 32 Vector<NGLogicalOffset>&); |
| 33 |
29 // Sets MarginStrut for the resultant fragment. | 34 // Sets MarginStrut for the resultant fragment. |
30 NGFragmentBuilder& SetMarginStrutBlockStart(const NGMarginStrut& from); | 35 NGFragmentBuilder& SetMarginStrutBlockStart(const NGMarginStrut& from); |
31 NGFragmentBuilder& SetMarginStrutBlockEnd(const NGMarginStrut& from); | 36 NGFragmentBuilder& SetMarginStrutBlockEnd(const NGMarginStrut& from); |
32 | 37 |
33 // Offsets are not supposed to be set during fragment construction, so we | 38 // Offsets are not supposed to be set during fragment construction, so we |
34 // do not provide a setter here. | 39 // do not provide a setter here. |
35 | 40 |
36 // Creates the fragment. Can only be called once. | 41 // Creates the fragment. Can only be called once. |
37 NGPhysicalFragment* ToFragment(); | 42 NGPhysicalFragment* ToFragment(); |
38 | 43 |
39 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(children_); } | 44 DECLARE_VIRTUAL_TRACE(); |
40 | 45 |
41 private: | 46 private: |
42 NGPhysicalFragmentBase::NGFragmentType type_; | 47 NGPhysicalFragmentBase::NGFragmentType type_; |
43 NGWritingMode writing_mode_; | 48 NGWritingMode writing_mode_; |
44 TextDirection direction_; | 49 TextDirection direction_; |
45 | 50 |
46 NGLogicalSize size_; | 51 NGLogicalSize size_; |
47 NGLogicalSize overflow_; | 52 NGLogicalSize overflow_; |
48 | 53 |
49 NGMarginStrut margin_strut_; | 54 NGMarginStrut margin_strut_; |
50 | 55 |
51 HeapVector<Member<NGPhysicalFragmentBase>> children_; | 56 HeapVector<Member<NGPhysicalFragmentBase>> children_; |
52 Vector<NGLogicalOffset> offsets_; | 57 Vector<NGLogicalOffset> offsets_; |
| 58 WeakBoxList out_of_flow_descendants_; |
| 59 Vector<NGLogicalOffset> out_of_flow_offsets_; |
53 }; | 60 }; |
54 | 61 |
55 } // namespace blink | 62 } // namespace blink |
56 | 63 |
57 #endif // NGFragmentBuilder | 64 #endif // NGFragmentBuilder |
OLD | NEW |