OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 NGLayoutInputText_h | 5 #ifndef NGLayoutInputText_h |
6 #define NGLayoutInputText_h | 6 #define NGLayoutInputText_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/layout/ng/ng_direction.h" | 9 #include "core/layout/ng/ng_direction.h" |
10 #include "core/style/ComputedStyle.h" | 10 #include "core/style/ComputedStyle.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 bool rotate_sideways; | 32 bool rotate_sideways; |
33 RefPtr<ComputedStyle> style; | 33 RefPtr<ComputedStyle> style; |
34 RefPtr<ShapeResult> shape_result; | 34 RefPtr<ShapeResult> shape_result; |
35 }; | 35 }; |
36 | 36 |
37 // Class representing all text content for a given inline layout root in the | 37 // Class representing all text content for a given inline layout root in the |
38 // layout input tree. | 38 // layout input tree. |
39 // The content is stored as a single string with collapsed white-space (if | 39 // The content is stored as a single string with collapsed white-space (if |
40 // applicable) to allow cross-element shaping. Each item contains a start and | 40 // applicable) to allow cross-element shaping. Each item contains a start and |
41 // end offset representing the content of said item. | 41 // end offset representing the content of said item. |
42 class CORE_EXPORT NGLayoutInputText final | 42 class CORE_EXPORT NGLayoutInputText final { |
43 : public GarbageCollectedFinalized<NGLayoutInputText> { | |
44 public: | 43 public: |
45 using const_iterator = Vector<NGLayoutInputTextItem>::const_iterator; | 44 using const_iterator = Vector<NGLayoutInputTextItem>::const_iterator; |
46 | 45 |
47 NGLayoutInputText() {} | 46 NGLayoutInputText() {} |
48 | 47 |
49 void Shape(); | 48 void Shape(); |
50 const_iterator begin() const { return items_.begin(); } | 49 const_iterator begin() const { return items_.begin(); } |
51 const_iterator end() const { return items_.end(); } | 50 const_iterator end() const { return items_.end(); } |
52 String Text(unsigned start_offset, unsigned end_offset) const { | 51 String Text(unsigned start_offset, unsigned end_offset) const { |
53 return text_.substring(start_offset, end_offset); | 52 return text_.substring(start_offset, end_offset); |
54 } | 53 } |
55 | 54 |
56 DEFINE_INLINE_TRACE() {} | |
57 | |
58 private: | 55 private: |
59 // TODO(eae): This should probably always be utf-8 to reduce the | 56 // TODO(eae): This should probably always be utf-8 to reduce the |
60 // memory and conversion overhead. We can't really re-use the | 57 // memory and conversion overhead. We can't really re-use the |
61 // TextContent string as this is stored post white-space | 58 // TextContent string as this is stored post white-space |
62 // collapsing. Also note that shaping can be done in either | 59 // collapsing. Also note that shaping can be done in either |
63 // utf-8 or utf-16. Currently we always shape in utf16 and | 60 // utf-8 or utf-16. Currently we always shape in utf16 and |
64 // upconvert latin-1. | 61 // upconvert latin-1. |
65 String text_; | 62 String text_; |
66 Vector<NGLayoutInputTextItem> items_; | 63 Vector<NGLayoutInputTextItem> items_; |
67 }; | 64 }; |
68 | 65 |
69 } // namespace blink | 66 } // namespace blink |
70 | 67 |
71 #endif // NGLayoutInputText_h | 68 #endif // NGLayoutInputText_h |
OLD | NEW |