OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NGLineBoxFragmentBuilder_h |
| 6 #define NGLineBoxFragmentBuilder_h |
| 7 |
| 8 #include "core/layout/ng/geometry/ng_logical_offset.h" |
| 9 #include "core/layout/ng/ng_line_height_metrics.h" |
| 10 #include "wtf/Allocator.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class NGInlineNode; |
| 15 class NGPhysicalFragment; |
| 16 class NGPhysicalLineBoxFragment; |
| 17 |
| 18 class CORE_EXPORT NGLineBoxFragmentBuilder final { |
| 19 STACK_ALLOCATED(); |
| 20 |
| 21 public: |
| 22 NGLineBoxFragmentBuilder(NGInlineNode*); |
| 23 |
| 24 NGLineBoxFragmentBuilder& SetDirection(TextDirection); |
| 25 |
| 26 NGLineBoxFragmentBuilder& SetInlineSize(LayoutUnit); |
| 27 |
| 28 NGLineBoxFragmentBuilder& AddChild(RefPtr<NGPhysicalFragment>, |
| 29 const NGLogicalOffset&); |
| 30 void MoveChildrenInBlockDirection(LayoutUnit); |
| 31 |
| 32 const Vector<RefPtr<NGPhysicalFragment>>& Children() const { |
| 33 return children_; |
| 34 } |
| 35 |
| 36 void UniteMetrics(const NGLineHeightMetrics&); |
| 37 const NGLineHeightMetrics& Metrics() const { return metrics_; } |
| 38 |
| 39 // Creates the fragment. Can only be called once. |
| 40 RefPtr<NGPhysicalLineBoxFragment> ToLineBoxFragment(); |
| 41 |
| 42 private: |
| 43 TextDirection direction_; |
| 44 |
| 45 Persistent<NGInlineNode> node_; |
| 46 |
| 47 LayoutUnit inline_size_; |
| 48 |
| 49 Vector<RefPtr<NGPhysicalFragment>> children_; |
| 50 Vector<NGLogicalOffset> offsets_; |
| 51 |
| 52 NGLineHeightMetrics metrics_; |
| 53 }; |
| 54 |
| 55 } // namespace blink |
| 56 |
| 57 #endif // NGLineBoxFragmentBuilder |
OLD | NEW |