| 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_physical_text_fragment.h" |
| 12 #include "wtf/Allocator.h" | 13 #include "wtf/Allocator.h" |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 class NGLayoutResult; | 17 class NGLayoutResult; |
| 17 class NGPhysicalTextFragment; | |
| 18 | 18 |
| 19 class CORE_EXPORT NGFragmentBuilder final { | 19 class CORE_EXPORT NGFragmentBuilder final { |
| 20 DISALLOW_NEW(); | 20 DISALLOW_NEW(); |
| 21 | 21 |
| 22 public: | 22 public: |
| 23 NGFragmentBuilder(NGPhysicalFragment::NGFragmentType, NGLayoutInputNode*); | 23 NGFragmentBuilder(NGPhysicalFragment::NGFragmentType, NGLayoutInputNode*); |
| 24 | 24 |
| 25 using WeakBoxList = PersistentHeapLinkedHashSet<WeakMember<NGBlockNode>>; | 25 using WeakBoxList = PersistentHeapLinkedHashSet<WeakMember<NGBlockNode>>; |
| 26 | 26 |
| 27 NGFragmentBuilder& SetWritingMode(NGWritingMode); | 27 NGFragmentBuilder& SetWritingMode(NGWritingMode); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 // Offsets are not supposed to be set during fragment construction, so we | 97 // Offsets are not supposed to be set during fragment construction, so we |
| 98 // do not provide a setter here. | 98 // do not provide a setter here. |
| 99 | 99 |
| 100 // Creates the fragment. Can only be called once. | 100 // Creates the fragment. Can only be called once. |
| 101 RefPtr<NGLayoutResult> ToBoxFragment(); | 101 RefPtr<NGLayoutResult> ToBoxFragment(); |
| 102 RefPtr<NGPhysicalTextFragment> ToTextFragment(unsigned index, | 102 RefPtr<NGPhysicalTextFragment> ToTextFragment(unsigned index, |
| 103 unsigned start_offset, | 103 unsigned start_offset, |
| 104 unsigned end_offset); | 104 unsigned end_offset); |
| 105 | 105 |
| 106 Vector<RefPtr<NGPhysicalFragment>>& MutableChildren() { return children_; } |
| 107 |
| 108 Vector<NGLogicalOffset>& MutableOffsets() { return offsets_; } |
| 109 |
| 106 // Mutable list of floats that need to be positioned. | 110 // Mutable list of floats that need to be positioned. |
| 107 Vector<RefPtr<NGFloatingObject>>& MutableUnpositionedFloats() { | 111 Vector<RefPtr<NGFloatingObject>>& MutableUnpositionedFloats() { |
| 108 return unpositioned_floats_; | 112 return unpositioned_floats_; |
| 109 } | 113 } |
| 110 | 114 |
| 111 // List of floats that need to be positioned. | 115 // List of floats that need to be positioned. |
| 112 const Vector<RefPtr<NGFloatingObject>>& UnpositionedFloats() const { | 116 const Vector<RefPtr<NGFloatingObject>>& UnpositionedFloats() const { |
| 113 return unpositioned_floats_; | 117 return unpositioned_floats_; |
| 114 } | 118 } |
| 115 | 119 |
| 116 const WTF::Optional<NGLogicalOffset>& BfcOffset() const { | 120 const WTF::Optional<NGLogicalOffset>& BfcOffset() const { |
| 117 return bfc_offset_; | 121 return bfc_offset_; |
| 118 } | 122 } |
| 119 | 123 |
| 124 const Vector<RefPtr<NGPhysicalFragment>>& Children() const { |
| 125 return children_; |
| 126 } |
| 127 |
| 120 bool DidBreak() const { return did_break_; } | 128 bool DidBreak() const { return did_break_; } |
| 121 | 129 |
| 122 private: | 130 private: |
| 123 // Out-of-flow descendant placement information. | 131 // Out-of-flow descendant placement information. |
| 124 // The generated fragment must compute NGStaticPosition for all | 132 // The generated fragment must compute NGStaticPosition for all |
| 125 // out-of-flow descendants. | 133 // out-of-flow descendants. |
| 126 // The resulting NGStaticPosition gets derived from: | 134 // The resulting NGStaticPosition gets derived from: |
| 127 // 1. The offset of fragment's child. | 135 // 1. The offset of fragment's child. |
| 128 // 2. The static position of descendant wrt child. | 136 // 2. The static position of descendant wrt child. |
| 129 // | 137 // |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 Vector<NGLogicalOffset> floating_object_offsets_; | 176 Vector<NGLogicalOffset> floating_object_offsets_; |
| 169 Vector<RefPtr<NGFloatingObject>> positioned_floats_; | 177 Vector<RefPtr<NGFloatingObject>> positioned_floats_; |
| 170 | 178 |
| 171 WTF::Optional<NGLogicalOffset> bfc_offset_; | 179 WTF::Optional<NGLogicalOffset> bfc_offset_; |
| 172 NGMarginStrut end_margin_strut_; | 180 NGMarginStrut end_margin_strut_; |
| 173 }; | 181 }; |
| 174 | 182 |
| 175 } // namespace blink | 183 } // namespace blink |
| 176 | 184 |
| 177 #endif // NGFragmentBuilder | 185 #endif // NGFragmentBuilder |
| OLD | NEW |