Chromium Code Reviews| 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" | |
| 10 #include "core/layout/ng/ng_writing_mode.h" | |
| 9 #include "core/style/ComputedStyle.h" | 11 #include "core/style/ComputedStyle.h" |
| 10 #include "platform/fonts/shaping/CachingWordShaper.h" | 12 #include "platform/fonts/shaping/CachingWordShaper.h" |
| 11 #include "platform/fonts/shaping/ShapeResult.h" | 13 #include "platform/fonts/shaping/ShapeResult.h" |
| 12 #include "platform/heap/Handle.h" | 14 #include "platform/heap/Handle.h" |
| 13 #include "wtf/Vector.h" | 15 #include "wtf/Vector.h" |
| 14 #include "wtf/text/WTFString.h" | 16 #include "wtf/text/WTFString.h" |
| 17 #include <unicode/uscript.h> | |
| 15 | 18 |
| 16 namespace blink { | 19 namespace blink { |
| 17 | 20 |
| 18 // Struct representing a single text node or styled inline element with text | 21 // Struct representing a single text node or styled inline element with text |
| 19 // content. In this representation TextNodes are merged up into their parent | 22 // content segmented by style, text direction, writing mode and script (but not |
|
drott
2016/09/09 11:11:21
See below.
| |
| 20 // inline element where possible. | 23 // by font). |
| 24 // In this representation TextNodes are merged up into their parent inline | |
| 25 // element where possible. | |
| 21 struct NGLayoutInputTextItem { | 26 struct NGLayoutInputTextItem { |
| 22 unsigned start_offset; | 27 unsigned start_offset; |
| 23 unsigned end_offset; | 28 unsigned end_offset; |
| 29 NGDirection direction; | |
| 30 NGWritingMode writing_mode; | |
|
drott
2016/09/09 11:11:21
Rather than NGWritingMode this probably should rep
| |
| 31 UScriptCode script; | |
| 24 RefPtr<ComputedStyle> style; | 32 RefPtr<ComputedStyle> style; |
| 33 RefPtr<ShapeResult> shape_result; | |
| 25 }; | 34 }; |
| 26 | 35 |
| 27 // Class representing all text content for a given inline layout root in the | 36 // Class representing all text content for a given inline layout root in the |
| 28 // layout input tree. | 37 // layout input tree. |
| 29 // The content is stored as a single string with collapsed white-space (if | 38 // The content is stored as a single string with collapsed white-space (if |
| 30 // applicable) to allow cross-element shaping. Each item contains a start and | 39 // applicable) to allow cross-element shaping. Each item contains a start and |
| 31 // end offset representing the content of said item. | 40 // end offset representing the content of said item. |
| 32 class CORE_EXPORT NGLayoutInputText final | 41 class CORE_EXPORT NGLayoutInputText final |
| 33 : public GarbageCollectedFinalized<NGLayoutInputText> { | 42 : public GarbageCollectedFinalized<NGLayoutInputText> { |
| 34 public: | 43 public: |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 46 DEFINE_INLINE_TRACE() {} | 55 DEFINE_INLINE_TRACE() {} |
| 47 | 56 |
| 48 private: | 57 private: |
| 49 // TODO(eae): This should probably always be utf-8 to reduce the | 58 // TODO(eae): This should probably always be utf-8 to reduce the |
| 50 // memory and conversion overhead. We can't really re-use the | 59 // memory and conversion overhead. We can't really re-use the |
| 51 // TextContent string as this is stored post white-space | 60 // TextContent string as this is stored post white-space |
| 52 // collapsing. Also note that shaping can be done in either | 61 // collapsing. Also note that shaping can be done in either |
| 53 // utf-8 or utf-16. Currently we always shape in utf16 and | 62 // utf-8 or utf-16. Currently we always shape in utf16 and |
| 54 // upconvert latin-1. | 63 // upconvert latin-1. |
| 55 String text_; | 64 String text_; |
| 56 RefPtr<ShapeResult> shape_result_; | |
| 57 Vector<NGLayoutInputTextItem> items_; | 65 Vector<NGLayoutInputTextItem> items_; |
| 58 }; | 66 }; |
| 59 | 67 |
| 60 } // namespace blink | 68 } // namespace blink |
| 61 | 69 |
| 62 #endif // NGLayoutInputText_h | 70 #endif // NGLayoutInputText_h |
| OLD | NEW |