| 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 #include "ui/gfx/render_text.h" | 5 #include "ui/gfx/render_text.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 const wchar_t kRtl[] = L"\x5d0\x5d1\x5d2"; | 158 const wchar_t kRtl[] = L"\x5d0\x5d1\x5d2"; |
| 159 const wchar_t kLtrRtl[] = L"a" L"\x5d0\x5d1"; | 159 const wchar_t kLtrRtl[] = L"a" L"\x5d0\x5d1"; |
| 160 const wchar_t kLtrRtlLtr[] = L"a" L"\x5d1" L"b"; | 160 const wchar_t kLtrRtlLtr[] = L"a" L"\x5d1" L"b"; |
| 161 const wchar_t kRtlLtr[] = L"\x5d0\x5d1" L"a"; | 161 const wchar_t kRtlLtr[] = L"\x5d0\x5d1" L"a"; |
| 162 const wchar_t kRtlLtrRtl[] = L"\x5d0" L"a" L"\x5d1"; | 162 const wchar_t kRtlLtrRtl[] = L"\x5d0" L"a" L"\x5d1"; |
| 163 | 163 |
| 164 // Bitmasks based on gfx::TextStyle. | 164 // Bitmasks based on gfx::TextStyle. |
| 165 enum { | 165 enum { |
| 166 ITALIC_MASK = 1 << ITALIC, | 166 ITALIC_MASK = 1 << ITALIC, |
| 167 STRIKE_MASK = 1 << STRIKE, | 167 STRIKE_MASK = 1 << STRIKE, |
| 168 DIAGONAL_STRIKE_MASK = 1 << DIAGONAL_STRIKE, | |
| 169 UNDERLINE_MASK = 1 << UNDERLINE, | 168 UNDERLINE_MASK = 1 << UNDERLINE, |
| 170 }; | 169 }; |
| 171 | 170 |
| 172 // Checks whether |range| contains |index|. This is not the same as calling | 171 // Checks whether |range| contains |index|. This is not the same as calling |
| 173 // range.Contains(Range(index)), which returns true if |index| == |range.end()|. | 172 // range.Contains(Range(index)), which returns true if |index| == |range.end()|. |
| 174 bool IndexInRange(const Range& range, size_t index) { | 173 bool IndexInRange(const Range& range, size_t index) { |
| 175 return index >= range.start() && index < range.end(); | 174 return index >= range.start() && index < range.end(); |
| 176 } | 175 } |
| 177 | 176 |
| 178 base::string16 GetSelectedText(RenderText* render_text) { | 177 base::string16 GetSelectedText(RenderText* render_text) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 int font_style = Font::NORMAL; | 243 int font_style = Font::NORMAL; |
| 245 if (style_mask & ITALIC_MASK) | 244 if (style_mask & ITALIC_MASK) |
| 246 font_style |= Font::ITALIC; | 245 font_style |= Font::ITALIC; |
| 247 if (style_mask & UNDERLINE_MASK) | 246 if (style_mask & UNDERLINE_MASK) |
| 248 font_style |= Font::UNDERLINE; | 247 font_style |= Font::UNDERLINE; |
| 249 | 248 |
| 250 const Font font_with_style = font.Derive(0, font_style, weight); | 249 const Font font_with_style = font.Derive(0, font_style, weight); |
| 251 DecoratedText::RangedAttribute attributes(Range(index, index + 1), | 250 DecoratedText::RangedAttribute attributes(Range(index, index + 1), |
| 252 font_with_style); | 251 font_with_style); |
| 253 attributes.strike = style_mask & STRIKE_MASK; | 252 attributes.strike = style_mask & STRIKE_MASK; |
| 254 attributes.diagonal_strike = style_mask & DIAGONAL_STRIKE_MASK; | |
| 255 return attributes; | 253 return attributes; |
| 256 } | 254 } |
| 257 | 255 |
| 258 // Verifies the given DecoratedText instances are equal by comparing the | 256 // Verifies the given DecoratedText instances are equal by comparing the |
| 259 // respective strings and attributes for each index. Note, corresponding | 257 // respective strings and attributes for each index. Note, corresponding |
| 260 // ranged attributes from |expected| and |actual| can't be compared since the | 258 // ranged attributes from |expected| and |actual| can't be compared since the |
| 261 // partition of |actual| into RangedAttributes will depend on the text runs | 259 // partition of |actual| into RangedAttributes will depend on the text runs |
| 262 // generated. | 260 // generated. |
| 263 void VerifyDecoratedWordsAreEqual(const DecoratedText& expected, | 261 void VerifyDecoratedWordsAreEqual(const DecoratedText& expected, |
| 264 const DecoratedText& actual) { | 262 const DecoratedText& actual) { |
| 265 ASSERT_EQ(expected.text, actual.text); | 263 ASSERT_EQ(expected.text, actual.text); |
| 266 | 264 |
| 267 // Compare attributes for each index. | 265 // Compare attributes for each index. |
| 268 for (size_t i = 0; i < expected.text.length(); i++) { | 266 for (size_t i = 0; i < expected.text.length(); i++) { |
| 269 SCOPED_TRACE(base::StringPrintf("Comparing index[%" PRIuS "]", i)); | 267 SCOPED_TRACE(base::StringPrintf("Comparing index[%" PRIuS "]", i)); |
| 270 auto find_attribute_func = [i](const DecoratedText::RangedAttribute& attr) { | 268 auto find_attribute_func = [i](const DecoratedText::RangedAttribute& attr) { |
| 271 return IndexInRange(attr.range, i); | 269 return IndexInRange(attr.range, i); |
| 272 }; | 270 }; |
| 273 const auto expected_attr = | 271 const auto expected_attr = |
| 274 std::find_if(expected.attributes.begin(), expected.attributes.end(), | 272 std::find_if(expected.attributes.begin(), expected.attributes.end(), |
| 275 find_attribute_func); | 273 find_attribute_func); |
| 276 const auto actual_attr = | 274 const auto actual_attr = |
| 277 std::find_if(actual.attributes.begin(), actual.attributes.end(), | 275 std::find_if(actual.attributes.begin(), actual.attributes.end(), |
| 278 find_attribute_func); | 276 find_attribute_func); |
| 279 ASSERT_NE(expected.attributes.end(), expected_attr); | 277 ASSERT_NE(expected.attributes.end(), expected_attr); |
| 280 ASSERT_NE(actual.attributes.end(), actual_attr); | 278 ASSERT_NE(actual.attributes.end(), actual_attr); |
| 281 | 279 |
| 282 EXPECT_EQ(expected_attr->strike, actual_attr->strike); | 280 EXPECT_EQ(expected_attr->strike, actual_attr->strike); |
| 283 EXPECT_EQ(expected_attr->diagonal_strike, actual_attr->diagonal_strike); | |
| 284 EXPECT_EQ(expected_attr->font.GetFontName(), | 281 EXPECT_EQ(expected_attr->font.GetFontName(), |
| 285 actual_attr->font.GetFontName()); | 282 actual_attr->font.GetFontName()); |
| 286 EXPECT_EQ(expected_attr->font.GetFontSize(), | 283 EXPECT_EQ(expected_attr->font.GetFontSize(), |
| 287 actual_attr->font.GetFontSize()); | 284 actual_attr->font.GetFontSize()); |
| 288 EXPECT_EQ(expected_attr->font.GetWeight(), actual_attr->font.GetWeight()); | 285 EXPECT_EQ(expected_attr->font.GetWeight(), actual_attr->font.GetWeight()); |
| 289 EXPECT_EQ(expected_attr->font.GetStyle(), actual_attr->font.GetStyle()); | 286 EXPECT_EQ(expected_attr->font.GetStyle(), actual_attr->font.GetStyle()); |
| 290 } | 287 } |
| 291 } | 288 } |
| 292 | 289 |
| 293 // Helper method to return an obscured string of the given |length|, with the | 290 // Helper method to return an obscured string of the given |length|, with the |
| (...skipping 16 matching lines...) Expand all Loading... |
| 310 class TestSkiaTextRenderer : public internal::SkiaTextRenderer { | 307 class TestSkiaTextRenderer : public internal::SkiaTextRenderer { |
| 311 public: | 308 public: |
| 312 struct TextLog { | 309 struct TextLog { |
| 313 TextLog() : glyph_count(0u), color(SK_ColorTRANSPARENT) {} | 310 TextLog() : glyph_count(0u), color(SK_ColorTRANSPARENT) {} |
| 314 PointF origin; | 311 PointF origin; |
| 315 size_t glyph_count; | 312 size_t glyph_count; |
| 316 SkColor color; | 313 SkColor color; |
| 317 }; | 314 }; |
| 318 | 315 |
| 319 struct DecorationLog { | 316 struct DecorationLog { |
| 320 DecorationLog(int x, int y, int width, bool underline, bool strike, | 317 DecorationLog(int x, int y, int width, bool underline, bool strike) |
| 321 bool diagonal_strike) | 318 : x(x), y(y), width(width), underline(underline), strike(strike) {} |
| 322 : x(x), y(y), width(width), underline(underline), strike(strike), | |
| 323 diagonal_strike(diagonal_strike) {} | |
| 324 int x; | 319 int x; |
| 325 int y; | 320 int y; |
| 326 int width; | 321 int width; |
| 327 bool underline; | 322 bool underline; |
| 328 bool strike; | 323 bool strike; |
| 329 bool diagonal_strike; | |
| 330 }; | 324 }; |
| 331 | 325 |
| 332 explicit TestSkiaTextRenderer(Canvas* canvas) | 326 explicit TestSkiaTextRenderer(Canvas* canvas) |
| 333 : internal::SkiaTextRenderer(canvas) {} | 327 : internal::SkiaTextRenderer(canvas) {} |
| 334 ~TestSkiaTextRenderer() override {} | 328 ~TestSkiaTextRenderer() override {} |
| 335 | 329 |
| 336 void GetTextLogAndReset(std::vector<TextLog>* text_log) { | 330 void GetTextLogAndReset(std::vector<TextLog>* text_log) { |
| 337 text_log_.swap(*text_log); | 331 text_log_.swap(*text_log); |
| 338 text_log_.clear(); | 332 text_log_.clear(); |
| 339 } | 333 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 357 log_entry.origin.SetToMin( | 351 log_entry.origin.SetToMin( |
| 358 PointF(SkScalarToFloat(pos[i].x()), SkScalarToFloat(pos[i].y()))); | 352 PointF(SkScalarToFloat(pos[i].x()), SkScalarToFloat(pos[i].y()))); |
| 359 } | 353 } |
| 360 } | 354 } |
| 361 log_entry.color = | 355 log_entry.color = |
| 362 test::RenderTextTestApi::GetRendererPaint(this).getColor(); | 356 test::RenderTextTestApi::GetRendererPaint(this).getColor(); |
| 363 text_log_.push_back(log_entry); | 357 text_log_.push_back(log_entry); |
| 364 internal::SkiaTextRenderer::DrawPosText(pos, glyphs, glyph_count); | 358 internal::SkiaTextRenderer::DrawPosText(pos, glyphs, glyph_count); |
| 365 } | 359 } |
| 366 | 360 |
| 367 void DrawDecorations(int x, int y, int width, bool underline, bool strike, | 361 void DrawDecorations(int x, |
| 368 bool diagonal_strike) override { | 362 int y, |
| 369 decoration_log_.push_back( | 363 int width, |
| 370 DecorationLog(x, y, width, underline, strike, diagonal_strike)); | 364 bool underline, |
| 371 internal::SkiaTextRenderer::DrawDecorations( | 365 bool strike) override { |
| 372 x, y, width, underline, strike, diagonal_strike); | 366 decoration_log_.push_back(DecorationLog(x, y, width, underline, strike)); |
| 367 internal::SkiaTextRenderer::DrawDecorations(x, y, width, underline, strike); |
| 373 } | 368 } |
| 374 | 369 |
| 375 std::vector<TextLog> text_log_; | 370 std::vector<TextLog> text_log_; |
| 376 std::vector<DecorationLog> decoration_log_; | 371 std::vector<DecorationLog> decoration_log_; |
| 377 | 372 |
| 378 DISALLOW_COPY_AND_ASSIGN(TestSkiaTextRenderer); | 373 DISALLOW_COPY_AND_ASSIGN(TestSkiaTextRenderer); |
| 379 }; | 374 }; |
| 380 | 375 |
| 381 // Given a buffer to test against, this can be used to test various areas of the | 376 // Given a buffer to test against, this can be used to test various areas of the |
| 382 // rectangular buffer against a specific color value. | 377 // rectangular buffer against a specific color value. |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 base::string16 input_text; | 1044 base::string16 input_text; |
| 1050 // Aim for 3 lines of text. | 1045 // Aim for 3 lines of text. |
| 1051 for (int i = 0; i < 20; ++i) | 1046 for (int i = 0; i < 20; ++i) |
| 1052 input_text.append(ASCIIToUTF16("hello world ")); | 1047 input_text.append(ASCIIToUTF16("hello world ")); |
| 1053 render_text->SetText(input_text); | 1048 render_text->SetText(input_text); |
| 1054 // Apply a style that tweaks the layout to make sure elision is calculated | 1049 // Apply a style that tweaks the layout to make sure elision is calculated |
| 1055 // with these styles. This can expose a behavior in layout where text is | 1050 // with these styles. This can expose a behavior in layout where text is |
| 1056 // slightly different width. This must be done after |SetText()|. | 1051 // slightly different width. This must be done after |SetText()|. |
| 1057 render_text->ApplyWeight(Font::Weight::BOLD, Range(1, 20)); | 1052 render_text->ApplyWeight(Font::Weight::BOLD, Range(1, 20)); |
| 1058 render_text->ApplyStyle(ITALIC, true, Range(1, 20)); | 1053 render_text->ApplyStyle(ITALIC, true, Range(1, 20)); |
| 1059 render_text->ApplyStyle(DIAGONAL_STRIKE, true, Range(1, 20)); | |
| 1060 render_text->SetMultiline(true); | 1054 render_text->SetMultiline(true); |
| 1061 render_text->SetElideBehavior(ELIDE_TAIL); | 1055 render_text->SetElideBehavior(ELIDE_TAIL); |
| 1062 render_text->SetMaxLines(3); | 1056 render_text->SetMaxLines(3); |
| 1063 const Size size = render_text->GetStringSize(); | 1057 const Size size = render_text->GetStringSize(); |
| 1064 // Fit in 3 lines. (If we knew the width of a word, we could | 1058 // Fit in 3 lines. (If we knew the width of a word, we could |
| 1065 // anticipate word wrap better.) | 1059 // anticipate word wrap better.) |
| 1066 render_text->SetDisplayRect(Rect((size.width() + 96) / 3, 0)); | 1060 render_text->SetDisplayRect(Rect((size.width() + 96) / 3, 0)); |
| 1067 // Trigger rendering. | 1061 // Trigger rendering. |
| 1068 render_text->GetStringSize(); | 1062 render_text->GetStringSize(); |
| 1069 EXPECT_EQ(input_text, render_text->GetDisplayText()); | 1063 EXPECT_EQ(input_text, render_text->GetDisplayText()); |
| (...skipping 2994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4064 const base::string16 ltr = ASCIIToUTF16(" ab c "); | 4058 const base::string16 ltr = ASCIIToUTF16(" ab c "); |
| 4065 const int kWordOneStartIndex = 2; | 4059 const int kWordOneStartIndex = 2; |
| 4066 const int kWordTwoStartIndex = 6; | 4060 const int kWordTwoStartIndex = 6; |
| 4067 | 4061 |
| 4068 RenderText* render_text = GetRenderText(); | 4062 RenderText* render_text = GetRenderText(); |
| 4069 render_text->SetDisplayRect(Rect(100, 30)); | 4063 render_text->SetDisplayRect(Rect(100, 30)); |
| 4070 render_text->SetText(ltr); | 4064 render_text->SetText(ltr); |
| 4071 render_text->ApplyWeight(Font::Weight::SEMIBOLD, Range(0, 3)); | 4065 render_text->ApplyWeight(Font::Weight::SEMIBOLD, Range(0, 3)); |
| 4072 render_text->ApplyStyle(UNDERLINE, true, Range(1, 5)); | 4066 render_text->ApplyStyle(UNDERLINE, true, Range(1, 5)); |
| 4073 render_text->ApplyStyle(ITALIC, true, Range(3, 8)); | 4067 render_text->ApplyStyle(ITALIC, true, Range(3, 8)); |
| 4074 render_text->ApplyStyle(DIAGONAL_STRIKE, true, Range(5, 7)); | |
| 4075 render_text->ApplyStyle(STRIKE, true, Range(1, 7)); | 4068 render_text->ApplyStyle(STRIKE, true, Range(1, 7)); |
| 4076 const int cursor_y = GetCursorYForTesting(); | 4069 const int cursor_y = GetCursorYForTesting(); |
| 4077 | 4070 |
| 4078 const std::vector<RenderText::FontSpan> font_spans = | 4071 const std::vector<RenderText::FontSpan> font_spans = |
| 4079 render_text->GetFontSpansForTesting(); | 4072 render_text->GetFontSpansForTesting(); |
| 4080 | 4073 |
| 4081 // Create expected decorated text instances. | 4074 // Create expected decorated text instances. |
| 4082 DecoratedText expected_word_1; | 4075 DecoratedText expected_word_1; |
| 4083 expected_word_1.text = ASCIIToUTF16("ab"); | 4076 expected_word_1.text = ASCIIToUTF16("ab"); |
| 4084 // Attributes for the characters 'a' and 'b' at logical indices 2 and 3 | 4077 // Attributes for the characters 'a' and 'b' at logical indices 2 and 3 |
| 4085 // respectively. | 4078 // respectively. |
| 4086 expected_word_1.attributes.push_back(CreateRangedAttribute( | 4079 expected_word_1.attributes.push_back(CreateRangedAttribute( |
| 4087 font_spans, 0, kWordOneStartIndex, Font::Weight::SEMIBOLD, | 4080 font_spans, 0, kWordOneStartIndex, Font::Weight::SEMIBOLD, |
| 4088 UNDERLINE_MASK | STRIKE_MASK)); | 4081 UNDERLINE_MASK | STRIKE_MASK)); |
| 4089 expected_word_1.attributes.push_back(CreateRangedAttribute( | 4082 expected_word_1.attributes.push_back(CreateRangedAttribute( |
| 4090 font_spans, 1, kWordOneStartIndex + 1, Font::Weight::NORMAL, | 4083 font_spans, 1, kWordOneStartIndex + 1, Font::Weight::NORMAL, |
| 4091 UNDERLINE_MASK | ITALIC_MASK | STRIKE_MASK)); | 4084 UNDERLINE_MASK | ITALIC_MASK | STRIKE_MASK)); |
| 4092 const Rect left_glyph_word_1 = render_text->GetCursorBounds( | 4085 const Rect left_glyph_word_1 = render_text->GetCursorBounds( |
| 4093 SelectionModel(kWordOneStartIndex, CURSOR_FORWARD), false); | 4086 SelectionModel(kWordOneStartIndex, CURSOR_FORWARD), false); |
| 4094 | 4087 |
| 4095 DecoratedText expected_word_2; | 4088 DecoratedText expected_word_2; |
| 4096 expected_word_2.text = ASCIIToUTF16("c"); | 4089 expected_word_2.text = ASCIIToUTF16("c"); |
| 4097 // Attributes for character 'c' at logical index |kWordTwoStartIndex|. | 4090 // Attributes for character 'c' at logical index |kWordTwoStartIndex|. |
| 4098 expected_word_2.attributes.push_back(CreateRangedAttribute( | 4091 expected_word_2.attributes.push_back( |
| 4099 font_spans, 0, kWordTwoStartIndex, Font::Weight::NORMAL, | 4092 CreateRangedAttribute(font_spans, 0, kWordTwoStartIndex, |
| 4100 ITALIC_MASK | DIAGONAL_STRIKE_MASK | STRIKE_MASK)); | 4093 Font::Weight::NORMAL, ITALIC_MASK | STRIKE_MASK)); |
| 4101 const Rect left_glyph_word_2 = render_text->GetCursorBounds( | 4094 const Rect left_glyph_word_2 = render_text->GetCursorBounds( |
| 4102 SelectionModel(kWordTwoStartIndex, CURSOR_FORWARD), false); | 4095 SelectionModel(kWordTwoStartIndex, CURSOR_FORWARD), false); |
| 4103 | 4096 |
| 4104 DecoratedText decorated_word; | 4097 DecoratedText decorated_word; |
| 4105 Point baseline_point; | 4098 Point baseline_point; |
| 4106 | 4099 |
| 4107 { | 4100 { |
| 4108 SCOPED_TRACE(base::StringPrintf("Query to the left of text bounds")); | 4101 SCOPED_TRACE(base::StringPrintf("Query to the left of text bounds")); |
| 4109 EXPECT_TRUE(render_text->GetDecoratedWordAtPoint( | 4102 EXPECT_TRUE(render_text->GetDecoratedWordAtPoint( |
| 4110 Point(-5, cursor_y), &decorated_word, &baseline_point)); | 4103 Point(-5, cursor_y), &decorated_word, &baseline_point)); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4149 L"\x0634"); | 4142 L"\x0634"); |
| 4150 const int kWordOneStartIndex = 1; | 4143 const int kWordOneStartIndex = 1; |
| 4151 const int kWordTwoStartIndex = 5; | 4144 const int kWordTwoStartIndex = 5; |
| 4152 | 4145 |
| 4153 RenderText* render_text = GetRenderText(); | 4146 RenderText* render_text = GetRenderText(); |
| 4154 render_text->SetDisplayRect(Rect(100, 30)); | 4147 render_text->SetDisplayRect(Rect(100, 30)); |
| 4155 render_text->SetText(rtl); | 4148 render_text->SetText(rtl); |
| 4156 render_text->ApplyWeight(Font::Weight::SEMIBOLD, Range(2, 3)); | 4149 render_text->ApplyWeight(Font::Weight::SEMIBOLD, Range(2, 3)); |
| 4157 render_text->ApplyStyle(UNDERLINE, true, Range(3, 6)); | 4150 render_text->ApplyStyle(UNDERLINE, true, Range(3, 6)); |
| 4158 render_text->ApplyStyle(ITALIC, true, Range(0, 3)); | 4151 render_text->ApplyStyle(ITALIC, true, Range(0, 3)); |
| 4159 render_text->ApplyStyle(DIAGONAL_STRIKE, true, Range(0, 2)); | |
| 4160 render_text->ApplyStyle(STRIKE, true, Range(2, 5)); | 4152 render_text->ApplyStyle(STRIKE, true, Range(2, 5)); |
| 4161 const int cursor_y = GetCursorYForTesting(); | 4153 const int cursor_y = GetCursorYForTesting(); |
| 4162 | 4154 |
| 4163 const std::vector<RenderText::FontSpan> font_spans = | 4155 const std::vector<RenderText::FontSpan> font_spans = |
| 4164 render_text->GetFontSpansForTesting(); | 4156 render_text->GetFontSpansForTesting(); |
| 4165 | 4157 |
| 4166 // Create expected decorated text instance. | 4158 // Create expected decorated text instance. |
| 4167 DecoratedText expected_word_1; | 4159 DecoratedText expected_word_1; |
| 4168 expected_word_1.text = WideToUTF16(L"\x0634\x0632"); | 4160 expected_word_1.text = WideToUTF16(L"\x0634\x0632"); |
| 4169 // Attributes for characters at logical indices 1 and 2. | 4161 // Attributes for characters at logical indices 1 and 2. |
| 4170 expected_word_1.attributes.push_back(CreateRangedAttribute( | 4162 expected_word_1.attributes.push_back(CreateRangedAttribute( |
| 4171 font_spans, 0, kWordOneStartIndex, Font::Weight::NORMAL, | 4163 font_spans, 0, kWordOneStartIndex, Font::Weight::NORMAL, ITALIC_MASK)); |
| 4172 ITALIC_MASK | DIAGONAL_STRIKE_MASK)); | |
| 4173 expected_word_1.attributes.push_back( | 4164 expected_word_1.attributes.push_back( |
| 4174 CreateRangedAttribute(font_spans, 1, kWordOneStartIndex + 1, | 4165 CreateRangedAttribute(font_spans, 1, kWordOneStartIndex + 1, |
| 4175 Font::Weight::SEMIBOLD, ITALIC_MASK | STRIKE_MASK)); | 4166 Font::Weight::SEMIBOLD, ITALIC_MASK | STRIKE_MASK)); |
| 4176 // The leftmost glyph is the one at logical index 2. | 4167 // The leftmost glyph is the one at logical index 2. |
| 4177 const Rect left_glyph_word_1 = render_text->GetCursorBounds( | 4168 const Rect left_glyph_word_1 = render_text->GetCursorBounds( |
| 4178 SelectionModel(kWordOneStartIndex + 1, CURSOR_FORWARD), false); | 4169 SelectionModel(kWordOneStartIndex + 1, CURSOR_FORWARD), false); |
| 4179 | 4170 |
| 4180 DecoratedText expected_word_2; | 4171 DecoratedText expected_word_2; |
| 4181 expected_word_2.text = WideToUTF16(L"\x0634"); | 4172 expected_word_2.text = WideToUTF16(L"\x0634"); |
| 4182 // Attributes for character at logical index |kWordTwoStartIndex|. | 4173 // Attributes for character at logical index |kWordTwoStartIndex|. |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4549 ::testing::Values(RENDER_TEXT_HARFBUZZ), | 4540 ::testing::Values(RENDER_TEXT_HARFBUZZ), |
| 4550 PrintRenderTextBackend()); | 4541 PrintRenderTextBackend()); |
| 4551 #endif | 4542 #endif |
| 4552 | 4543 |
| 4553 INSTANTIATE_TEST_CASE_P(, | 4544 INSTANTIATE_TEST_CASE_P(, |
| 4554 RenderTextHarfBuzzTest, | 4545 RenderTextHarfBuzzTest, |
| 4555 ::testing::Values(RENDER_TEXT_HARFBUZZ), | 4546 ::testing::Values(RENDER_TEXT_HARFBUZZ), |
| 4556 PrintRenderTextBackend()); | 4547 PrintRenderTextBackend()); |
| 4557 | 4548 |
| 4558 } // namespace gfx | 4549 } // namespace gfx |
| OLD | NEW |