| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 NGLineBoxFragmentBuilder_h | 5 #ifndef NGLineBoxFragmentBuilder_h |
| 6 #define NGLineBoxFragmentBuilder_h | 6 #define NGLineBoxFragmentBuilder_h |
| 7 | 7 |
| 8 #include "core/layout/ng/geometry/ng_logical_offset.h" | 8 #include "core/layout/ng/geometry/ng_logical_offset.h" |
| 9 #include "core/layout/ng/ng_line_height_metrics.h" | 9 #include "core/layout/ng/ng_line_height_metrics.h" |
| 10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class NGInlineBreakToken; |
| 14 class NGInlineNode; | 15 class NGInlineNode; |
| 15 class NGPhysicalFragment; | 16 class NGPhysicalFragment; |
| 16 class NGPhysicalLineBoxFragment; | 17 class NGPhysicalLineBoxFragment; |
| 17 | 18 |
| 18 class CORE_EXPORT NGLineBoxFragmentBuilder final { | 19 class CORE_EXPORT NGLineBoxFragmentBuilder final { |
| 19 STACK_ALLOCATED(); | 20 STACK_ALLOCATED(); |
| 20 | 21 |
| 21 public: | 22 public: |
| 22 NGLineBoxFragmentBuilder(NGInlineNode*); | 23 NGLineBoxFragmentBuilder(NGInlineNode*); |
| 23 | 24 |
| 24 NGLineBoxFragmentBuilder& SetDirection(TextDirection); | 25 NGLineBoxFragmentBuilder& SetDirection(TextDirection); |
| 25 | 26 |
| 26 NGLineBoxFragmentBuilder& SetInlineSize(LayoutUnit); | 27 NGLineBoxFragmentBuilder& SetInlineSize(LayoutUnit); |
| 27 | 28 |
| 28 NGLineBoxFragmentBuilder& AddChild(RefPtr<NGPhysicalFragment>, | 29 NGLineBoxFragmentBuilder& AddChild(RefPtr<NGPhysicalFragment>, |
| 29 const NGLogicalOffset&); | 30 const NGLogicalOffset&); |
| 30 void MoveChildrenInBlockDirection(LayoutUnit); | 31 void MoveChildrenInBlockDirection(LayoutUnit); |
| 31 | 32 |
| 32 const Vector<RefPtr<NGPhysicalFragment>>& Children() const { | 33 const Vector<RefPtr<NGPhysicalFragment>>& Children() const { |
| 33 return children_; | 34 return children_; |
| 34 } | 35 } |
| 35 | 36 |
| 36 void UniteMetrics(const NGLineHeightMetrics&); | 37 void UniteMetrics(const NGLineHeightMetrics&); |
| 37 const NGLineHeightMetrics& Metrics() const { return metrics_; } | 38 const NGLineHeightMetrics& Metrics() const { return metrics_; } |
| 38 | 39 |
| 40 // Set the break token for the fragment to build. |
| 41 // A finished break token will be attached if not set. |
| 42 void SetBreakToken(RefPtr<NGInlineBreakToken>); |
| 43 |
| 39 // Creates the fragment. Can only be called once. | 44 // Creates the fragment. Can only be called once. |
| 40 RefPtr<NGPhysicalLineBoxFragment> ToLineBoxFragment(); | 45 RefPtr<NGPhysicalLineBoxFragment> ToLineBoxFragment(); |
| 41 | 46 |
| 42 private: | 47 private: |
| 43 TextDirection direction_; | 48 TextDirection direction_; |
| 44 | 49 |
| 45 Persistent<NGInlineNode> node_; | 50 Persistent<NGInlineNode> node_; |
| 46 | 51 |
| 47 LayoutUnit inline_size_; | 52 LayoutUnit inline_size_; |
| 48 | 53 |
| 49 Vector<RefPtr<NGPhysicalFragment>> children_; | 54 Vector<RefPtr<NGPhysicalFragment>> children_; |
| 50 Vector<NGLogicalOffset> offsets_; | 55 Vector<NGLogicalOffset> offsets_; |
| 51 | 56 |
| 52 NGLineHeightMetrics metrics_; | 57 NGLineHeightMetrics metrics_; |
| 58 |
| 59 RefPtr<NGInlineBreakToken> break_token_; |
| 53 }; | 60 }; |
| 54 | 61 |
| 55 } // namespace blink | 62 } // namespace blink |
| 56 | 63 |
| 57 #endif // NGLineBoxFragmentBuilder | 64 #endif // NGLineBoxFragmentBuilder |
| OLD | NEW |