| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_HARFBUZZ_H_ | 5 #ifndef UI_GFX_RENDER_TEXT_HARFBUZZ_H_ |
| 6 #define UI_GFX_RENDER_TEXT_HARFBUZZ_H_ | 6 #define UI_GFX_RENDER_TEXT_HARFBUZZ_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 size_t DisplayIndexToTextIndex(size_t index) override; | 172 size_t DisplayIndexToTextIndex(size_t index) override; |
| 173 bool IsValidCursorIndex(size_t index) override; | 173 bool IsValidCursorIndex(size_t index) override; |
| 174 void OnLayoutTextAttributeChanged(bool text_changed) override; | 174 void OnLayoutTextAttributeChanged(bool text_changed) override; |
| 175 void OnDisplayTextAttributeChanged() override; | 175 void OnDisplayTextAttributeChanged() override; |
| 176 void EnsureLayout() override; | 176 void EnsureLayout() override; |
| 177 void DrawVisualText(internal::SkiaTextRenderer* renderer) override; | 177 void DrawVisualText(internal::SkiaTextRenderer* renderer) override; |
| 178 | 178 |
| 179 private: | 179 private: |
| 180 friend class test::RenderTextTestApi; | 180 friend class test::RenderTextTestApi; |
| 181 | 181 |
| 182 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_HorizontalAlignment); | 182 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, |
| 183 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_NormalWidth); | 183 Multiline_HorizontalAlignment); |
| 184 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_WordWrapBehavior); | 184 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, Multiline_NormalWidth); |
| 185 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_RunDirection); | 185 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, Multiline_WordWrapBehavior); |
| 186 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_HorizontalPositions); | 186 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, HarfBuzz_RunDirection); |
| 187 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, | 187 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, |
| 188 HarfBuzz_TextPositionWithFractionalSize); | 188 HarfBuzz_HorizontalPositions); |
| 189 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_BreakRunsByUnicodeBlocks); | 189 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, |
| 190 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_BreakRunsByEmoji); | 190 HarfBuzz_BreakRunsByUnicodeBlocks); |
| 191 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_BreakRunsByAscii); | 191 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, HarfBuzz_BreakRunsByEmoji); |
| 192 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_SubglyphGraphemeCases); | 192 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, HarfBuzz_BreakRunsByAscii); |
| 193 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_SubglyphGraphemePartition); | 193 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, |
| 194 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_NonExistentFont); | 194 HarfBuzz_SubglyphGraphemeCases); |
| 195 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_UniscribeFallback); | 195 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, |
| 196 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_UnicodeFallback); | 196 HarfBuzz_SubglyphGraphemePartition); |
| 197 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_LineBreakerBehavior); | 197 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, HarfBuzz_NonExistentFont); |
| 198 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, | 198 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, HarfBuzz_UniscribeFallback); |
| 199 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, HarfBuzz_UnicodeFallback); |
| 200 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, |
| 201 Multiline_LineBreakerBehavior); |
| 202 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, |
| 199 Multiline_SurrogatePairsOrCombiningChars); | 203 Multiline_SurrogatePairsOrCombiningChars); |
| 200 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Multiline_ZeroWidthChars); | 204 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, Multiline_ZeroWidthChars); |
| 201 | 205 |
| 202 // Specify the width of a glyph for test. The width of glyphs is very | 206 // Specify the width of a glyph for test. The width of glyphs is very |
| 203 // platform-dependent and environment-dependent. Otherwise multiline test | 207 // platform-dependent and environment-dependent. Otherwise multiline test |
| 204 // will become really flaky. | 208 // will become really flaky. |
| 205 void set_glyph_width_for_test(float test_width) { | 209 void set_glyph_width_for_test(float test_width) { |
| 206 glyph_width_for_test_ = test_width; | 210 glyph_width_for_test_ = test_width; |
| 207 } | 211 } |
| 208 | 212 |
| 209 // Return the run index that contains the argument; or the length of the | 213 // Return the run index that contains the argument; or the length of the |
| 210 // |runs_| vector if argument exceeds the text length or width. | 214 // |runs_| vector if argument exceeds the text length or width. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 283 |
| 280 // Fixed width of glyphs. This should only be set in test environments. | 284 // Fixed width of glyphs. This should only be set in test environments. |
| 281 float glyph_width_for_test_; | 285 float glyph_width_for_test_; |
| 282 | 286 |
| 283 DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz); | 287 DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz); |
| 284 }; | 288 }; |
| 285 | 289 |
| 286 } // namespace gfx | 290 } // namespace gfx |
| 287 | 291 |
| 288 #endif // UI_GFX_RENDER_TEXT_HARFBUZZ_H_ | 292 #endif // UI_GFX_RENDER_TEXT_HARFBUZZ_H_ |
| OLD | NEW |