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