| 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_line_height_metrics.h" | 9 #include "core/layout/ng/inline/ng_line_height_metrics.h" |
| 10 #include "platform/text/TextDirection.h" | 10 #include "platform/text/TextDirection.h" |
| 11 #include "platform/wtf/Allocator.h" | 11 #include "platform/wtf/Allocator.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class NGInlineNode; | 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& SetInlineSize(LayoutUnit); | 26 NGTextFragmentBuilder& SetSize(const NGLogicalSize&); |
| 27 NGTextFragmentBuilder& SetBlockSize(LayoutUnit); | |
| 28 | 27 |
| 29 void UniteMetrics(const NGLineHeightMetrics&); | 28 void UniteMetrics(const NGLineHeightMetrics&); |
| 30 const NGLineHeightMetrics& Metrics() const { return metrics_; } | 29 const NGLineHeightMetrics& Metrics() const { return metrics_; } |
| 31 | 30 |
| 32 // Creates the fragment. Can only be called once. | 31 // Creates the fragment. Can only be called once. |
| 33 RefPtr<NGPhysicalTextFragment> ToTextFragment(unsigned index, | 32 RefPtr<NGPhysicalTextFragment> ToTextFragment(unsigned index, |
| 34 unsigned start_offset, | 33 unsigned start_offset, |
| 35 unsigned end_offset); | 34 unsigned end_offset); |
| 36 | 35 |
| 37 private: | 36 private: |
| 38 TextDirection direction_; | 37 TextDirection direction_; |
| 39 | 38 |
| 40 Persistent<NGInlineNode> node_; | 39 Persistent<NGInlineNode> node_; |
| 41 | 40 |
| 42 NGLogicalSize size_; | 41 NGLogicalSize size_; |
| 43 | 42 |
| 44 NGLineHeightMetrics metrics_; | 43 NGLineHeightMetrics metrics_; |
| 45 }; | 44 }; |
| 46 | 45 |
| 47 } // namespace blink | 46 } // namespace blink |
| 48 | 47 |
| 49 #endif // NGTextFragmentBuilder | 48 #endif // NGTextFragmentBuilder |
| OLD | NEW |