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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 render_text->SetText(seuss); | 328 render_text->SetText(seuss); |
329 render_text->SetObscured(true); | 329 render_text->SetObscured(true); |
330 EXPECT_EQ(seuss, render_text->text()); | 330 EXPECT_EQ(seuss, render_text->text()); |
331 EXPECT_EQ(no_seuss, render_text->GetDisplayText()); | 331 EXPECT_EQ(no_seuss, render_text->GetDisplayText()); |
332 render_text->SetObscured(false); | 332 render_text->SetObscured(false); |
333 EXPECT_EQ(seuss, render_text->text()); | 333 EXPECT_EQ(seuss, render_text->text()); |
334 EXPECT_EQ(seuss, render_text->GetDisplayText()); | 334 EXPECT_EQ(seuss, render_text->GetDisplayText()); |
335 | 335 |
336 // TODO(benrg): No Windows implementation yet. | 336 // TODO(benrg): No Windows implementation yet. |
337 #if !defined(OS_WIN) | 337 #if !defined(OS_WIN) |
338 | |
339 render_text->SetObscured(true); | 338 render_text->SetObscured(true); |
340 | 339 |
341 // Surrogate pairs are counted as one code point. | 340 // Surrogate pairs are counted as one code point. |
342 const char16 invalid_surrogates[] = {0xDC00, 0xD800, 0}; | 341 const char16 invalid_surrogates[] = {0xDC00, 0xD800, 0}; |
343 render_text->SetText(invalid_surrogates); | 342 render_text->SetText(invalid_surrogates); |
344 EXPECT_EQ(ASCIIToUTF16("**"), render_text->GetDisplayText()); | 343 EXPECT_EQ(ASCIIToUTF16("**"), render_text->GetDisplayText()); |
345 const char16 valid_surrogates[] = {0xD800, 0xDC00, 0}; | 344 const char16 valid_surrogates[] = {0xD800, 0xDC00, 0}; |
346 render_text->SetText(valid_surrogates); | 345 render_text->SetText(valid_surrogates); |
347 EXPECT_EQ(ASCIIToUTF16("*"), render_text->GetDisplayText()); | 346 EXPECT_EQ(ASCIIToUTF16("*"), render_text->GetDisplayText()); |
348 EXPECT_EQ(0U, render_text->cursor_position()); | 347 EXPECT_EQ(0U, render_text->cursor_position()); |
349 render_text->MoveCursor(CHARACTER_BREAK, CURSOR_RIGHT, false); | 348 render_text->MoveCursor(CHARACTER_BREAK, CURSOR_RIGHT, false); |
350 EXPECT_EQ(2U, render_text->cursor_position()); | 349 EXPECT_EQ(2U, render_text->cursor_position()); |
351 | 350 |
352 // Cursoring is independent of the underlying characters when the text is | 351 // Cursoring is independent of the underlying characters when the text is |
353 // obscured. | 352 // obscured. |
354 const wchar_t* const texts[] = { | 353 const wchar_t* const texts[] = { |
355 L"hop on pop", // word boundaries | 354 L"hop on pop", // word boundaries |
356 L"ab \x5D0\x5D1" L"12", // bidi embedding level of 2 | 355 L"ab \x5D0\x5D1" L"12", // bidi embedding level of 2 |
357 L"\x5D0\x5D1" L"12", // RTL paragraph direction on Linux | 356 L"\x5D0\x5D1" L"12", // RTL paragraph direction on Linux |
358 L"\x5D0\x5D1" // pure RTL | 357 L"\x5D0\x5D1" // pure RTL |
359 }; | 358 }; |
360 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(texts); ++i) { | 359 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(texts); ++i) { |
361 string16 text = WideToUTF16(texts[i]); | 360 string16 text = WideToUTF16(texts[i]); |
362 TestVisualCursorMotionInObscuredField(render_text.get(), text, false); | 361 TestVisualCursorMotionInObscuredField(render_text.get(), text, false); |
363 TestVisualCursorMotionInObscuredField(render_text.get(), text, true); | 362 TestVisualCursorMotionInObscuredField(render_text.get(), text, true); |
364 } | 363 } |
365 #endif // !defined(OS_WIN) | 364 #endif // !defined(OS_WIN) |
366 } | 365 } |
367 | 366 |
| 367 TEST_F(RenderTextTest, GetTextDirection) { |
| 368 // Ensure that direction is set by the first strong character direction. |
| 369 scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); |
| 370 // Pure LTR. |
| 371 render_text->SetText(ASCIIToUTF16("abc")); |
| 372 EXPECT_EQ(render_text->GetTextDirection(), base::i18n::LEFT_TO_RIGHT); |
| 373 // LTR-RTL |
| 374 render_text->SetText(WideToUTF16(L"abc\x05d0\x05d1\x05d2")); |
| 375 EXPECT_EQ(render_text->GetTextDirection(), base::i18n::LEFT_TO_RIGHT); |
| 376 // LTR-RTL-LTR. |
| 377 render_text->SetText(WideToUTF16(L"a"L"\x05d1"L"b")); |
| 378 EXPECT_EQ(render_text->GetTextDirection(), base::i18n::LEFT_TO_RIGHT); |
| 379 // Pure RTL. |
| 380 render_text->SetText(WideToUTF16(L"\x05d0\x05d1\x05d2")); |
| 381 EXPECT_EQ(render_text->GetTextDirection(), base::i18n::RIGHT_TO_LEFT); |
| 382 // RTL-LTR |
| 383 render_text->SetText(WideToUTF16(L"\x05d0\x05d1\x05d2"L"abc")); |
| 384 EXPECT_EQ(render_text->GetTextDirection(), base::i18n::RIGHT_TO_LEFT); |
| 385 // RTL-LTR-RTL. |
| 386 render_text->SetText(WideToUTF16(L"\x05d0"L"a"L"\x05d1")); |
| 387 EXPECT_EQ(render_text->GetTextDirection(), base::i18n::RIGHT_TO_LEFT); |
| 388 } |
| 389 |
368 void RunMoveCursorLeftRightTest(RenderText* render_text, | 390 void RunMoveCursorLeftRightTest(RenderText* render_text, |
369 const std::vector<SelectionModel>& expected, | 391 const std::vector<SelectionModel>& expected, |
370 VisualCursorDirection direction) { | 392 VisualCursorDirection direction) { |
371 for (size_t i = 0; i < expected.size(); ++i) { | 393 for (size_t i = 0; i < expected.size(); ++i) { |
372 EXPECT_EQ(expected[i], render_text->selection_model()); | 394 EXPECT_EQ(expected[i], render_text->selection_model()); |
373 render_text->MoveCursor(CHARACTER_BREAK, direction, false); | 395 render_text->MoveCursor(CHARACTER_BREAK, direction, false); |
374 } | 396 } |
375 // Check that cursoring is clamped at the line edge. | 397 // Check that cursoring is clamped at the line edge. |
376 EXPECT_EQ(expected.back(), render_text->selection_model()); | 398 EXPECT_EQ(expected.back(), render_text->selection_model()); |
377 // Check that it is the line edge. | 399 // Check that it is the line edge. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 RunMoveCursorLeftRightTest(render_text.get(), expected, CURSOR_LEFT); | 474 RunMoveCursorLeftRightTest(render_text.get(), expected, CURSOR_LEFT); |
453 } | 475 } |
454 | 476 |
455 TEST_F(RenderTextTest, MoveCursorLeftRightInRtl) { | 477 TEST_F(RenderTextTest, MoveCursorLeftRightInRtl) { |
456 scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); | 478 scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); |
457 // Pure RTL. | 479 // Pure RTL. |
458 render_text->SetText(WideToUTF16(L"\x05d0\x05d1\x05d2")); | 480 render_text->SetText(WideToUTF16(L"\x05d0\x05d1\x05d2")); |
459 render_text->MoveCursor(LINE_BREAK, CURSOR_RIGHT, false); | 481 render_text->MoveCursor(LINE_BREAK, CURSOR_RIGHT, false); |
460 std::vector<SelectionModel> expected; | 482 std::vector<SelectionModel> expected; |
461 | 483 |
462 #if defined(OS_LINUX) | |
463 expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); | 484 expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); |
464 #else | |
465 expected.push_back(SelectionModel(3, CURSOR_FORWARD)); | |
466 #endif | |
467 expected.push_back(SelectionModel(1, CURSOR_BACKWARD)); | 485 expected.push_back(SelectionModel(1, CURSOR_BACKWARD)); |
468 expected.push_back(SelectionModel(2, CURSOR_BACKWARD)); | 486 expected.push_back(SelectionModel(2, CURSOR_BACKWARD)); |
469 expected.push_back(SelectionModel(3, CURSOR_BACKWARD)); | 487 expected.push_back(SelectionModel(3, CURSOR_BACKWARD)); |
470 #if defined(OS_LINUX) | |
471 expected.push_back(SelectionModel(3, CURSOR_FORWARD)); | 488 expected.push_back(SelectionModel(3, CURSOR_FORWARD)); |
472 #else | |
473 expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); | |
474 #endif | |
475 RunMoveCursorLeftRightTest(render_text.get(), expected, CURSOR_LEFT); | 489 RunMoveCursorLeftRightTest(render_text.get(), expected, CURSOR_LEFT); |
476 | 490 |
477 expected.clear(); | 491 expected.clear(); |
478 | 492 |
479 #if defined(OS_LINUX) | |
480 expected.push_back(SelectionModel(3, CURSOR_FORWARD)); | 493 expected.push_back(SelectionModel(3, CURSOR_FORWARD)); |
481 #else | |
482 expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); | |
483 #endif | |
484 expected.push_back(SelectionModel(2, CURSOR_FORWARD)); | 494 expected.push_back(SelectionModel(2, CURSOR_FORWARD)); |
485 expected.push_back(SelectionModel(1, CURSOR_FORWARD)); | 495 expected.push_back(SelectionModel(1, CURSOR_FORWARD)); |
486 expected.push_back(SelectionModel(0, CURSOR_FORWARD)); | 496 expected.push_back(SelectionModel(0, CURSOR_FORWARD)); |
487 #if defined(OS_LINUX) | |
488 expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); | 497 expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); |
489 #else | |
490 expected.push_back(SelectionModel(3, CURSOR_FORWARD)); | |
491 #endif | |
492 RunMoveCursorLeftRightTest(render_text.get(), expected, CURSOR_RIGHT); | 498 RunMoveCursorLeftRightTest(render_text.get(), expected, CURSOR_RIGHT); |
493 } | 499 } |
494 | 500 |
495 TEST_F(RenderTextTest, MoveCursorLeftRightInRtlLtr) { | 501 TEST_F(RenderTextTest, MoveCursorLeftRightInRtlLtr) { |
496 scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); | 502 scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); |
497 // RTL-LTR | 503 // RTL-LTR |
498 render_text->SetText(WideToUTF16(L"\x05d0\x05d1\x05d2"L"abc")); | 504 render_text->SetText(WideToUTF16(L"\x05d0\x05d1\x05d2"L"abc")); |
499 render_text->MoveCursor(LINE_BREAK, CURSOR_RIGHT, false); | 505 render_text->MoveCursor(LINE_BREAK, CURSOR_RIGHT, false); |
500 std::vector<SelectionModel> expected; | 506 std::vector<SelectionModel> expected; |
501 #if defined(OS_LINUX) | |
502 expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); | 507 expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); |
503 expected.push_back(SelectionModel(1, CURSOR_BACKWARD)); | 508 expected.push_back(SelectionModel(1, CURSOR_BACKWARD)); |
504 expected.push_back(SelectionModel(2, CURSOR_BACKWARD)); | 509 expected.push_back(SelectionModel(2, CURSOR_BACKWARD)); |
505 expected.push_back(SelectionModel(3, CURSOR_BACKWARD)); | 510 expected.push_back(SelectionModel(3, CURSOR_BACKWARD)); |
506 expected.push_back(SelectionModel(5, CURSOR_FORWARD)); | 511 expected.push_back(SelectionModel(5, CURSOR_FORWARD)); |
507 expected.push_back(SelectionModel(4, CURSOR_FORWARD)); | 512 expected.push_back(SelectionModel(4, CURSOR_FORWARD)); |
508 expected.push_back(SelectionModel(3, CURSOR_FORWARD)); | 513 expected.push_back(SelectionModel(3, CURSOR_FORWARD)); |
509 expected.push_back(SelectionModel(6, CURSOR_FORWARD)); | 514 expected.push_back(SelectionModel(6, CURSOR_FORWARD)); |
510 #else | |
511 expected.push_back(SelectionModel(6, CURSOR_FORWARD)); | |
512 expected.push_back(SelectionModel(5, CURSOR_FORWARD)); | |
513 expected.push_back(SelectionModel(4, CURSOR_FORWARD)); | |
514 expected.push_back(SelectionModel(3, CURSOR_FORWARD)); | |
515 expected.push_back(SelectionModel(1, CURSOR_BACKWARD)); | |
516 expected.push_back(SelectionModel(2, CURSOR_BACKWARD)); | |
517 expected.push_back(SelectionModel(3, CURSOR_BACKWARD)); | |
518 expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); | |
519 #endif | |
520 | |
521 RunMoveCursorLeftRightTest(render_text.get(), expected, CURSOR_LEFT); | 515 RunMoveCursorLeftRightTest(render_text.get(), expected, CURSOR_LEFT); |
522 | 516 |
523 expected.clear(); | 517 expected.clear(); |
524 #if defined(OS_LINUX) | |
525 expected.push_back(SelectionModel(6, CURSOR_FORWARD)); | 518 expected.push_back(SelectionModel(6, CURSOR_FORWARD)); |
526 expected.push_back(SelectionModel(4, CURSOR_BACKWARD)); | 519 expected.push_back(SelectionModel(4, CURSOR_BACKWARD)); |
527 expected.push_back(SelectionModel(5, CURSOR_BACKWARD)); | 520 expected.push_back(SelectionModel(5, CURSOR_BACKWARD)); |
528 expected.push_back(SelectionModel(6, CURSOR_BACKWARD)); | 521 expected.push_back(SelectionModel(6, CURSOR_BACKWARD)); |
529 expected.push_back(SelectionModel(2, CURSOR_FORWARD)); | 522 expected.push_back(SelectionModel(2, CURSOR_FORWARD)); |
530 expected.push_back(SelectionModel(1, CURSOR_FORWARD)); | 523 expected.push_back(SelectionModel(1, CURSOR_FORWARD)); |
531 expected.push_back(SelectionModel(0, CURSOR_FORWARD)); | 524 expected.push_back(SelectionModel(0, CURSOR_FORWARD)); |
532 expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); | 525 expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); |
533 #else | |
534 expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); | |
535 expected.push_back(SelectionModel(2, CURSOR_FORWARD)); | |
536 expected.push_back(SelectionModel(1, CURSOR_FORWARD)); | |
537 expected.push_back(SelectionModel(0, CURSOR_FORWARD)); | |
538 expected.push_back(SelectionModel(4, CURSOR_BACKWARD)); | |
539 expected.push_back(SelectionModel(5, CURSOR_BACKWARD)); | |
540 expected.push_back(SelectionModel(6, CURSOR_BACKWARD)); | |
541 expected.push_back(SelectionModel(6, CURSOR_FORWARD)); | |
542 #endif | |
543 RunMoveCursorLeftRightTest(render_text.get(), expected, CURSOR_RIGHT); | 526 RunMoveCursorLeftRightTest(render_text.get(), expected, CURSOR_RIGHT); |
544 } | 527 } |
545 | 528 |
546 TEST_F(RenderTextTest, MoveCursorLeftRightInRtlLtrRtl) { | 529 TEST_F(RenderTextTest, MoveCursorLeftRightInRtlLtrRtl) { |
547 scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); | 530 scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); |
548 // RTL-LTR-RTL. | 531 // RTL-LTR-RTL. |
549 render_text->SetText(WideToUTF16(L"\x05d0"L"a"L"\x05d1")); | 532 render_text->SetText(WideToUTF16(L"\x05d0"L"a"L"\x05d1")); |
550 render_text->MoveCursor(LINE_BREAK, CURSOR_RIGHT, false); | 533 render_text->MoveCursor(LINE_BREAK, CURSOR_RIGHT, false); |
551 std::vector<SelectionModel> expected; | 534 std::vector<SelectionModel> expected; |
552 #if defined(OS_LINUX) | |
553 expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); | 535 expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); |
554 expected.push_back(SelectionModel(1, CURSOR_BACKWARD)); | 536 expected.push_back(SelectionModel(1, CURSOR_BACKWARD)); |
555 expected.push_back(SelectionModel(1, CURSOR_FORWARD)); | 537 expected.push_back(SelectionModel(1, CURSOR_FORWARD)); |
556 expected.push_back(SelectionModel(3, CURSOR_BACKWARD)); | 538 expected.push_back(SelectionModel(3, CURSOR_BACKWARD)); |
557 expected.push_back(SelectionModel(3, CURSOR_FORWARD)); | 539 expected.push_back(SelectionModel(3, CURSOR_FORWARD)); |
558 #else | |
559 expected.push_back(SelectionModel(3, CURSOR_FORWARD)); | |
560 expected.push_back(SelectionModel(3, CURSOR_BACKWARD)); | |
561 expected.push_back(SelectionModel(1, CURSOR_FORWARD)); | |
562 expected.push_back(SelectionModel(1, CURSOR_BACKWARD)); | |
563 expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); | |
564 #endif | |
565 RunMoveCursorLeftRightTest(render_text.get(), expected, CURSOR_LEFT); | 540 RunMoveCursorLeftRightTest(render_text.get(), expected, CURSOR_LEFT); |
566 | 541 |
567 expected.clear(); | 542 expected.clear(); |
568 #if defined(OS_LINUX) | |
569 expected.push_back(SelectionModel(3, CURSOR_FORWARD)); | 543 expected.push_back(SelectionModel(3, CURSOR_FORWARD)); |
570 expected.push_back(SelectionModel(2, CURSOR_FORWARD)); | 544 expected.push_back(SelectionModel(2, CURSOR_FORWARD)); |
571 expected.push_back(SelectionModel(2, CURSOR_BACKWARD)); | 545 expected.push_back(SelectionModel(2, CURSOR_BACKWARD)); |
572 expected.push_back(SelectionModel(0, CURSOR_FORWARD)); | 546 expected.push_back(SelectionModel(0, CURSOR_FORWARD)); |
573 expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); | 547 expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); |
574 #else | |
575 expected.push_back(SelectionModel(0, CURSOR_BACKWARD)); | |
576 expected.push_back(SelectionModel(0, CURSOR_FORWARD)); | |
577 expected.push_back(SelectionModel(2, CURSOR_BACKWARD)); | |
578 expected.push_back(SelectionModel(2, CURSOR_FORWARD)); | |
579 expected.push_back(SelectionModel(3, CURSOR_FORWARD)); | |
580 #endif | |
581 RunMoveCursorLeftRightTest(render_text.get(), expected, CURSOR_RIGHT); | 548 RunMoveCursorLeftRightTest(render_text.get(), expected, CURSOR_RIGHT); |
582 } | 549 } |
583 | 550 |
584 // TODO(xji): temporarily disable in platform Win since the complex script | 551 // TODO(xji): temporarily disable in platform Win since the complex script |
585 // characters turned into empty square due to font regression. So, not able | 552 // characters turned into empty square due to font regression. So, not able |
586 // to test 2 characters belong to the same grapheme. | 553 // to test 2 characters belong to the same grapheme. |
587 #if defined(OS_LINUX) | 554 #if defined(OS_LINUX) |
588 TEST_F(RenderTextTest, MoveCursorLeftRight_ComplexScript) { | 555 TEST_F(RenderTextTest, MoveCursorLeftRight_ComplexScript) { |
589 scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); | 556 scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); |
590 | 557 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 const string16 kHebrewLatin = WideToUTF16(L"\x05e0\x05b8"L"a"L"\x05e0\x05b8"); | 666 const string16 kHebrewLatin = WideToUTF16(L"\x05e0\x05b8"L"a"L"\x05e0\x05b8"); |
700 | 667 |
701 struct { | 668 struct { |
702 string16 text; | 669 string16 text; |
703 base::i18n::TextDirection expected_text_direction; | 670 base::i18n::TextDirection expected_text_direction; |
704 } cases[] = { | 671 } cases[] = { |
705 { string16(), base::i18n::LEFT_TO_RIGHT }, | 672 { string16(), base::i18n::LEFT_TO_RIGHT }, |
706 { kLatin, base::i18n::LEFT_TO_RIGHT }, | 673 { kLatin, base::i18n::LEFT_TO_RIGHT }, |
707 { kLTRGrapheme, base::i18n::LEFT_TO_RIGHT }, | 674 { kLTRGrapheme, base::i18n::LEFT_TO_RIGHT }, |
708 { kHindiLatin, base::i18n::LEFT_TO_RIGHT }, | 675 { kHindiLatin, base::i18n::LEFT_TO_RIGHT }, |
709 #if defined(OS_LINUX) | |
710 // On Linux, the whole string is displayed RTL, rather than individual runs. | |
711 { kRTLGrapheme, base::i18n::RIGHT_TO_LEFT }, | 676 { kRTLGrapheme, base::i18n::RIGHT_TO_LEFT }, |
712 { kHebrewLatin, base::i18n::RIGHT_TO_LEFT }, | 677 { kHebrewLatin, base::i18n::RIGHT_TO_LEFT }, |
713 #else | |
714 { kRTLGrapheme, base::i18n::LEFT_TO_RIGHT }, | |
715 { kHebrewLatin, base::i18n::LEFT_TO_RIGHT }, | |
716 #endif | |
717 }; | 678 }; |
718 | 679 |
719 // TODO(asvitkine): Disable tests that fail on XP bots due to lack of complete | 680 // TODO(asvitkine): Disable tests that fail on XP bots due to lack of complete |
720 // font support for some scripts - http://crbug.com/106450 | 681 // font support for some scripts - http://crbug.com/106450 |
721 #if defined(OS_WIN) | 682 #if defined(OS_WIN) |
722 if (base::win::GetVersion() < base::win::VERSION_VISTA) | 683 if (base::win::GetVersion() < base::win::VERSION_VISTA) |
723 return; | 684 return; |
724 #endif | 685 #endif |
725 | 686 |
726 scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); | 687 scoped_ptr<RenderText> render_text(RenderText::CreateRenderText()); |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 render_text->SetDisplayRect(Rect(width + 10, 1)); | 1204 render_text->SetDisplayRect(Rect(width + 10, 1)); |
1244 EXPECT_EQ(render_text->display_rect().width() - width - 1, | 1205 EXPECT_EQ(render_text->display_rect().width() - width - 1, |
1245 render_text->GetUpdatedCursorBounds().x()); | 1206 render_text->GetUpdatedCursorBounds().x()); |
1246 | 1207 |
1247 // Reset locale. | 1208 // Reset locale. |
1248 base::i18n::SetICUDefaultLocale(locale); | 1209 base::i18n::SetICUDefaultLocale(locale); |
1249 } | 1210 } |
1250 #endif // !defined(OS_LINUX) || defined(OS_CHROMEOS) | 1211 #endif // !defined(OS_LINUX) || defined(OS_CHROMEOS) |
1251 | 1212 |
1252 } // namespace gfx | 1213 } // namespace gfx |
OLD | NEW |