| 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" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 NGFragmentBuilder& SetBlockSize(LayoutUnit); | 31 NGFragmentBuilder& SetBlockSize(LayoutUnit); |
| 32 NGLogicalSize Size() const { return size_; } | 32 NGLogicalSize Size() const { return size_; } |
| 33 | 33 |
| 34 NGFragmentBuilder& SetInlineOverflow(LayoutUnit); | 34 NGFragmentBuilder& SetInlineOverflow(LayoutUnit); |
| 35 NGFragmentBuilder& SetBlockOverflow(LayoutUnit); | 35 NGFragmentBuilder& SetBlockOverflow(LayoutUnit); |
| 36 | 36 |
| 37 NGFragmentBuilder& AddChild(RefPtr<NGLayoutResult>, const NGLogicalOffset&); | 37 NGFragmentBuilder& AddChild(RefPtr<NGLayoutResult>, const NGLogicalOffset&); |
| 38 NGFragmentBuilder& AddChild(RefPtr<NGPhysicalFragment>, | 38 NGFragmentBuilder& AddChild(RefPtr<NGPhysicalFragment>, |
| 39 const NGLogicalOffset&); | 39 const NGLogicalOffset&); |
| 40 | 40 |
| 41 NGFragmentBuilder& AddFloatingObject(NGFloatingObject*, | 41 NGFragmentBuilder& AddFloatingObject(RefPtr<NGFloatingObject>, |
| 42 const NGLogicalOffset&); | 42 const NGLogicalOffset&); |
| 43 | 43 |
| 44 NGFragmentBuilder& SetBfcOffset(const NGLogicalOffset& offset); | 44 NGFragmentBuilder& SetBfcOffset(const NGLogicalOffset& offset); |
| 45 | 45 |
| 46 NGFragmentBuilder& AddUnpositionedFloat(NGFloatingObject* floating_object); | 46 NGFragmentBuilder& AddUnpositionedFloat( |
| 47 RefPtr<NGFloatingObject> floating_object); |
| 47 | 48 |
| 48 // Builder has non-trivial out-of-flow descendant methods. | 49 // Builder has non-trivial out-of-flow descendant methods. |
| 49 // These methods are building blocks for implementation of | 50 // These methods are building blocks for implementation of |
| 50 // out-of-flow descendants by layout algorithms. | 51 // out-of-flow descendants by layout algorithms. |
| 51 // | 52 // |
| 52 // They are intended to be used by layout algorithm like this: | 53 // They are intended to be used by layout algorithm like this: |
| 53 // | 54 // |
| 54 // Part 1: layout algorithm positions in-flow children. | 55 // Part 1: layout algorithm positions in-flow children. |
| 55 // out-of-flow children, and out-of-flow descendants of fragments | 56 // out-of-flow children, and out-of-flow descendants of fragments |
| 56 // are stored inside builder. | 57 // are stored inside builder. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // 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 |
| 97 // do not provide a setter here. | 98 // do not provide a setter here. |
| 98 | 99 |
| 99 // Creates the fragment. Can only be called once. | 100 // Creates the fragment. Can only be called once. |
| 100 RefPtr<NGLayoutResult> ToBoxFragment(); | 101 RefPtr<NGLayoutResult> ToBoxFragment(); |
| 101 RefPtr<NGPhysicalTextFragment> ToTextFragment(unsigned index, | 102 RefPtr<NGPhysicalTextFragment> ToTextFragment(unsigned index, |
| 102 unsigned start_offset, | 103 unsigned start_offset, |
| 103 unsigned end_offset); | 104 unsigned end_offset); |
| 104 | 105 |
| 105 // Mutable list of floats that need to be positioned. | 106 // Mutable list of floats that need to be positioned. |
| 106 Vector<Persistent<NGFloatingObject>>& MutableUnpositionedFloats() { | 107 Vector<RefPtr<NGFloatingObject>>& MutableUnpositionedFloats() { |
| 107 return unpositioned_floats_; | 108 return unpositioned_floats_; |
| 108 } | 109 } |
| 109 | 110 |
| 110 // List of floats that need to be positioned. | 111 // List of floats that need to be positioned. |
| 111 const Vector<Persistent<NGFloatingObject>>& UnpositionedFloats() const { | 112 const Vector<RefPtr<NGFloatingObject>>& UnpositionedFloats() const { |
| 112 return unpositioned_floats_; | 113 return unpositioned_floats_; |
| 113 } | 114 } |
| 114 | 115 |
| 115 const WTF::Optional<NGLogicalOffset>& BfcOffset() const { | 116 const WTF::Optional<NGLogicalOffset>& BfcOffset() const { |
| 116 return bfc_offset_; | 117 return bfc_offset_; |
| 117 } | 118 } |
| 118 | 119 |
| 119 bool DidBreak() const { return did_break_; } | 120 bool DidBreak() const { return did_break_; } |
| 120 | 121 |
| 121 private: | 122 private: |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 Vector<RefPtr<NGBreakToken>> child_break_tokens_; | 156 Vector<RefPtr<NGBreakToken>> child_break_tokens_; |
| 156 | 157 |
| 157 WeakBoxList out_of_flow_descendant_candidates_; | 158 WeakBoxList out_of_flow_descendant_candidates_; |
| 158 Vector<OutOfFlowPlacement> out_of_flow_candidate_placements_; | 159 Vector<OutOfFlowPlacement> out_of_flow_candidate_placements_; |
| 159 | 160 |
| 160 WeakBoxList out_of_flow_descendants_; | 161 WeakBoxList out_of_flow_descendants_; |
| 161 Vector<NGStaticPosition> out_of_flow_positions_; | 162 Vector<NGStaticPosition> out_of_flow_positions_; |
| 162 | 163 |
| 163 // Floats that need to be positioned by the next in-flow fragment that can | 164 // Floats that need to be positioned by the next in-flow fragment that can |
| 164 // determine its block position in space. | 165 // determine its block position in space. |
| 165 Vector<Persistent<NGFloatingObject>> unpositioned_floats_; | 166 Vector<RefPtr<NGFloatingObject>> unpositioned_floats_; |
| 166 | 167 |
| 167 Vector<NGLogicalOffset> floating_object_offsets_; | 168 Vector<NGLogicalOffset> floating_object_offsets_; |
| 168 Vector<Persistent<NGFloatingObject>> positioned_floats_; | 169 Vector<RefPtr<NGFloatingObject>> positioned_floats_; |
| 169 | 170 |
| 170 WTF::Optional<NGLogicalOffset> bfc_offset_; | 171 WTF::Optional<NGLogicalOffset> bfc_offset_; |
| 171 NGMarginStrut end_margin_strut_; | 172 NGMarginStrut end_margin_strut_; |
| 172 }; | 173 }; |
| 173 | 174 |
| 174 } // namespace blink | 175 } // namespace blink |
| 175 | 176 |
| 176 #endif // NGFragmentBuilder | 177 #endif // NGFragmentBuilder |
| OLD | NEW |