| 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/style/ComputedStyle.h" | 10 #include "core/style/ComputedStyle.h" |
| 11 #include "platform/fonts/FontFallbackPriority.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, sideways rotation, font fallback |
| 20 // inline element where possible. | 23 // priority (text, symbol, emoji, etc) and script (but not 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 UScriptCode script; |
| 31 FontFallbackPriority fallback_priority; |
| 32 bool rotate_sideways; |
| 24 RefPtr<ComputedStyle> style; | 33 RefPtr<ComputedStyle> style; |
| 34 RefPtr<ShapeResult> shape_result; |
| 25 }; | 35 }; |
| 26 | 36 |
| 27 // 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 |
| 28 // layout input tree. | 38 // layout input tree. |
| 29 // 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 |
| 30 // 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 |
| 31 // end offset representing the content of said item. | 41 // end offset representing the content of said item. |
| 32 class CORE_EXPORT NGLayoutInputText final | 42 class CORE_EXPORT NGLayoutInputText final |
| 33 : public GarbageCollectedFinalized<NGLayoutInputText> { | 43 : public GarbageCollectedFinalized<NGLayoutInputText> { |
| 34 public: | 44 public: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 46 DEFINE_INLINE_TRACE() {} | 56 DEFINE_INLINE_TRACE() {} |
| 47 | 57 |
| 48 private: | 58 private: |
| 49 // TODO(eae): This should probably always be utf-8 to reduce the | 59 // TODO(eae): This should probably always be utf-8 to reduce the |
| 50 // memory and conversion overhead. We can't really re-use the | 60 // memory and conversion overhead. We can't really re-use the |
| 51 // TextContent string as this is stored post white-space | 61 // TextContent string as this is stored post white-space |
| 52 // collapsing. Also note that shaping can be done in either | 62 // collapsing. Also note that shaping can be done in either |
| 53 // utf-8 or utf-16. Currently we always shape in utf16 and | 63 // utf-8 or utf-16. Currently we always shape in utf16 and |
| 54 // upconvert latin-1. | 64 // upconvert latin-1. |
| 55 String text_; | 65 String text_; |
| 56 RefPtr<ShapeResult> shape_result_; | |
| 57 Vector<NGLayoutInputTextItem> items_; | 66 Vector<NGLayoutInputTextItem> items_; |
| 58 }; | 67 }; |
| 59 | 68 |
| 60 } // namespace blink | 69 } // namespace blink |
| 61 | 70 |
| 62 #endif // NGLayoutInputText_h | 71 #endif // NGLayoutInputText_h |
| OLD | NEW |