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 NGTextFragmentBuilder_h | 5 #ifndef NGTextFragmentBuilder_h |
6 #define NGTextFragmentBuilder_h | 6 #define NGTextFragmentBuilder_h |
7 | 7 |
8 #include "core/layout/ng/geometry/ng_logical_size.h" | 8 #include "core/layout/ng/geometry/ng_logical_size.h" |
| 9 #include "core/layout/ng/inline/ng_inline_node.h" |
9 #include "core/layout/ng/inline/ng_line_height_metrics.h" | 10 #include "core/layout/ng/inline/ng_line_height_metrics.h" |
10 #include "platform/text/TextDirection.h" | 11 #include "platform/text/TextDirection.h" |
11 #include "platform/wtf/Allocator.h" | 12 #include "platform/wtf/Allocator.h" |
12 | 13 |
13 namespace blink { | 14 namespace blink { |
14 | 15 |
15 class NGInlineNode; | |
16 class NGPhysicalTextFragment; | 16 class NGPhysicalTextFragment; |
17 | 17 |
18 class CORE_EXPORT NGTextFragmentBuilder final { | 18 class CORE_EXPORT NGTextFragmentBuilder final { |
19 STACK_ALLOCATED(); | 19 STACK_ALLOCATED(); |
20 | 20 |
21 public: | 21 public: |
22 NGTextFragmentBuilder(NGInlineNode*); | 22 NGTextFragmentBuilder(NGInlineNode); |
23 | 23 |
24 NGTextFragmentBuilder& SetDirection(TextDirection); | 24 NGTextFragmentBuilder& SetDirection(TextDirection); |
25 | 25 |
26 NGTextFragmentBuilder& SetSize(const NGLogicalSize&); | 26 NGTextFragmentBuilder& SetSize(const NGLogicalSize&); |
27 | 27 |
28 void UniteMetrics(const NGLineHeightMetrics&); | 28 void UniteMetrics(const NGLineHeightMetrics&); |
29 const NGLineHeightMetrics& Metrics() const { return metrics_; } | 29 const NGLineHeightMetrics& Metrics() const { return metrics_; } |
30 | 30 |
31 // Creates the fragment. Can only be called once. | 31 // Creates the fragment. Can only be called once. |
32 RefPtr<NGPhysicalTextFragment> ToTextFragment(unsigned index, | 32 RefPtr<NGPhysicalTextFragment> ToTextFragment(unsigned index, |
33 unsigned start_offset, | 33 unsigned start_offset, |
34 unsigned end_offset); | 34 unsigned end_offset); |
35 | 35 |
36 private: | 36 private: |
37 TextDirection direction_; | 37 TextDirection direction_; |
38 | 38 |
39 Persistent<NGInlineNode> node_; | 39 NGInlineNode node_; |
40 | 40 |
41 NGLogicalSize size_; | 41 NGLogicalSize size_; |
42 | 42 |
43 NGLineHeightMetrics metrics_; | 43 NGLineHeightMetrics metrics_; |
44 }; | 44 }; |
45 | 45 |
46 } // namespace blink | 46 } // namespace blink |
47 | 47 |
48 #endif // NGTextFragmentBuilder | 48 #endif // NGTextFragmentBuilder |
OLD | NEW |