OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_GFX_RENDER_TEXT_WIN_H_ | 5 #ifndef UI_GFX_RENDER_TEXT_WIN_H_ |
6 #define UI_GFX_RENDER_TEXT_WIN_H_ | 6 #define UI_GFX_RENDER_TEXT_WIN_H_ |
7 | 7 |
8 #include <usp10.h> | 8 #include <usp10.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 virtual size_t TextIndexToLayoutIndex(size_t index) const OVERRIDE; | 82 virtual size_t TextIndexToLayoutIndex(size_t index) const OVERRIDE; |
83 virtual size_t LayoutIndexToTextIndex(size_t index) const OVERRIDE; | 83 virtual size_t LayoutIndexToTextIndex(size_t index) const OVERRIDE; |
84 virtual bool IsCursorablePosition(size_t position) OVERRIDE; | 84 virtual bool IsCursorablePosition(size_t position) OVERRIDE; |
85 virtual void ResetLayout() OVERRIDE; | 85 virtual void ResetLayout() OVERRIDE; |
86 virtual void EnsureLayout() OVERRIDE; | 86 virtual void EnsureLayout() OVERRIDE; |
87 virtual void DrawVisualText(Canvas* canvas) OVERRIDE; | 87 virtual void DrawVisualText(Canvas* canvas) OVERRIDE; |
88 | 88 |
89 private: | 89 private: |
90 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Win_BreakRunsByUnicodeBlocks); | 90 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Win_BreakRunsByUnicodeBlocks); |
91 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Win_LogicalClusters); | 91 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Win_LogicalClusters); |
| 92 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_MinWidth); |
| 93 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_NormalWidth); |
92 | 94 |
93 void ItemizeLogicalText(); | 95 void ItemizeLogicalText(); |
94 void LayoutVisualText(); | 96 void LayoutVisualText(); |
95 void LayoutTextRun(internal::TextRun* run); | 97 void LayoutTextRun(internal::TextRun* run); |
96 | 98 |
97 // Helper function that calls |ScriptShape()| on the run, which has logic to | 99 // Helper function that calls |ScriptShape()| on the run, which has logic to |
98 // handle E_OUTOFMEMORY return codes. | 100 // handle E_OUTOFMEMORY return codes. |
99 HRESULT ShapeTextRunWithFont(internal::TextRun* run, const Font& font); | 101 HRESULT ShapeTextRunWithFont(internal::TextRun* run, const Font& font); |
100 | 102 |
101 // Returns the number of characters in |run| that have missing glyphs. | 103 // Returns the number of characters in |run| that have missing glyphs. |
(...skipping 14 matching lines...) Expand all Loading... |
116 static HDC cached_hdc_; | 118 static HDC cached_hdc_; |
117 | 119 |
118 // Cached map from font name to the last successful substitute font used. | 120 // Cached map from font name to the last successful substitute font used. |
119 // TODO(asvitkine): Move the caching logic to font_fallback_win.cc. | 121 // TODO(asvitkine): Move the caching logic to font_fallback_win.cc. |
120 static std::map<std::string, Font> successful_substitute_fonts_; | 122 static std::map<std::string, Font> successful_substitute_fonts_; |
121 | 123 |
122 SCRIPT_CONTROL script_control_; | 124 SCRIPT_CONTROL script_control_; |
123 SCRIPT_STATE script_state_; | 125 SCRIPT_STATE script_state_; |
124 | 126 |
125 ScopedVector<internal::TextRun> runs_; | 127 ScopedVector<internal::TextRun> runs_; |
126 Size string_size_; | |
127 | 128 |
128 // A common vertical baseline for all the text runs. This is computed as the | 129 // Single line width of the layout text. |
129 // largest baseline over all the runs' fonts. | 130 int string_width_; |
130 int common_baseline_; | 131 |
| 132 // Wrapped multiline size of the layout text. |
| 133 Size multiline_string_size_; |
131 | 134 |
132 scoped_ptr<int[]> visual_to_logical_; | 135 scoped_ptr<int[]> visual_to_logical_; |
133 scoped_ptr<int[]> logical_to_visual_; | 136 scoped_ptr<int[]> logical_to_visual_; |
134 | 137 |
135 bool needs_layout_; | 138 bool needs_layout_; |
136 | 139 |
137 DISALLOW_COPY_AND_ASSIGN(RenderTextWin); | 140 DISALLOW_COPY_AND_ASSIGN(RenderTextWin); |
138 }; | 141 }; |
139 | 142 |
140 } // namespace gfx | 143 } // namespace gfx |
141 | 144 |
142 #endif // UI_GFX_RENDER_TEXT_WIN_H_ | 145 #endif // UI_GFX_RENDER_TEXT_WIN_H_ |
OLD | NEW |