diff options
author | szym@chromium.org <szym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-13 18:03:15 +0000 |
---|---|---|
committer | szym@chromium.org <szym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-13 18:03:15 +0000 |
commit | 2b93ff8e3b519b5925012e1e7566793e25b127d5 (patch) | |
tree | fa752bfbc4dccb90c7a39caed2547a16514ad67a /base/i18n | |
parent | dd2cb504afa07f30ce1e6f73066d0c8575c4ac0a (diff) | |
download | chromium_src-2b93ff8e3b519b5925012e1e7566793e25b127d5.zip chromium_src-2b93ff8e3b519b5925012e1e7566793e25b127d5.tar.gz chromium_src-2b93ff8e3b519b5925012e1e7566793e25b127d5.tar.bz2 |
Revert of https://codereview.chromium.org/112063003/
Reason for revert: RenderTextTest.ElidedText fails on XP Tests (3)
TBR=msw@chromium.org,pkasting@chromium.org,jshin@chromium.org,skanuj@chromium.org
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.chromium.org/103493003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240694 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/i18n')
-rw-r--r-- | base/i18n/rtl.cc | 15 | ||||
-rw-r--r-- | base/i18n/rtl.h | 4 | ||||
-rw-r--r-- | base/i18n/rtl_unittest.cc | 64 |
3 files changed, 1 insertions, 82 deletions
diff --git a/base/i18n/rtl.cc b/base/i18n/rtl.cc index 851b036..d9818e8 100644 --- a/base/i18n/rtl.cc +++ b/base/i18n/rtl.cc @@ -163,21 +163,6 @@ TextDirection GetFirstStrongCharacterDirection(const string16& text) { return LEFT_TO_RIGHT; } -TextDirection GetLastStrongCharacterDirection(const string16& text) { - const UChar* string = text.c_str(); - size_t position = text.length(); - while (position > 0) { - UChar32 character; - size_t prev_position = position; - U16_PREV(string, 0, prev_position, character); - TextDirection direction = GetCharacterDirection(character); - if (direction != UNKNOWN_DIRECTION) - return direction; - position = prev_position; - } - return LEFT_TO_RIGHT; -} - TextDirection GetStringDirection(const string16& text) { const UChar* string = text.c_str(); size_t length = text.length(); diff --git a/base/i18n/rtl.h b/base/i18n/rtl.h index aa5f681..c80d2f8 100644 --- a/base/i18n/rtl.h +++ b/base/i18n/rtl.h @@ -64,7 +64,7 @@ BASE_I18N_EXPORT bool ICUIsRTL(); BASE_I18N_EXPORT TextDirection GetTextDirectionForLocale( const char* locale_name); -// Given the string in |text|, returns the directionality of the first or last +// Given the string in |text|, returns the directionality of the first // character with strong directionality in the string. If no character in the // text has strong directionality, LEFT_TO_RIGHT is returned. The Bidi // character types L, LRE, LRO, R, AL, RLE, and RLO are considered as strong @@ -72,8 +72,6 @@ BASE_I18N_EXPORT TextDirection GetTextDirectionForLocale( // for more information. BASE_I18N_EXPORT TextDirection GetFirstStrongCharacterDirection( const string16& text); -BASE_I18N_EXPORT TextDirection GetLastStrongCharacterDirection( - const string16& text); // Given the string in |text|, returns LEFT_TO_RIGHT or RIGHT_TO_LEFT if all the // strong directionality characters in the string are of the same diff --git a/base/i18n/rtl_unittest.cc b/base/i18n/rtl_unittest.cc index 8faaccf..58772b0 100644 --- a/base/i18n/rtl_unittest.cc +++ b/base/i18n/rtl_unittest.cc @@ -46,8 +46,6 @@ TEST_F(RTLTest, GetFirstStrongCharacterDirection) { } cases[] = { // Test pure LTR string. { L"foo bar", LEFT_TO_RIGHT }, - // Test pure RTL string. - { L"\x05d0\x05d1\x05d2 \x05d3\x0d4\x05d5", RIGHT_TO_LEFT}, // Test bidi string in which the first character with strong directionality // is a character with type L. { L"foo \x05d0 bar", LEFT_TO_RIGHT }, @@ -109,68 +107,6 @@ TEST_F(RTLTest, GetFirstStrongCharacterDirection) { GetFirstStrongCharacterDirection(WideToUTF16(cases[i].text))); } - -// Note that the cases with LRE, LRO, RLE and RLO are invalid for -// GetLastStrongCharacterDirection because they should be followed by PDF -// character. -TEST_F(RTLTest, GetLastStrongCharacterDirection) { - struct { - const wchar_t* text; - TextDirection direction; - } cases[] = { - // Test pure LTR string. - { L"foo bar", LEFT_TO_RIGHT }, - // Test pure RTL string. - { L"\x05d0\x05d1\x05d2 \x05d3\x0d4\x05d5", RIGHT_TO_LEFT}, - // Test bidi string in which the last character with strong directionality - // is a character with type L. - { L"foo \x05d0 bar", LEFT_TO_RIGHT }, - // Test bidi string in which the last character with strong directionality - // is a character with type R. - { L"\x05d0 foo bar \x05d3", RIGHT_TO_LEFT }, - // Test bidi string which ends with a character with weak directionality - // and in which the last character with strong directionality is a - // character with type L. - { L"!foo \x05d0 bar!", LEFT_TO_RIGHT }, - // Test bidi string which ends with a character with weak directionality - // and in which the last character with strong directionality is a - // character with type R. - { L",\x05d0 foo bar \x05d1,", RIGHT_TO_LEFT }, - // Test bidi string in which the last character with strong directionality - // is a character with type AL. - { L"\x0622 foo \x05d0 bar \x0622", RIGHT_TO_LEFT }, - // Test a string without strong directionality characters. - { L",!.{}", LEFT_TO_RIGHT }, - // Test empty string. - { L"", LEFT_TO_RIGHT }, - // Test characters in non-BMP (e.g. Phoenician letters. Please refer to - // http://demo.icu-project.org/icu-bin/ubrowse?scr=151&b=10910 for more - // information). - { -#if defined(WCHAR_T_IS_UTF32) - L"abc 123" L" ! \x10910 !", -#elif defined(WCHAR_T_IS_UTF16) - L"abc 123" L" ! \xd802\xdd10 !", -#else -#error wchar_t should be either UTF-16 or UTF-32 -#endif - RIGHT_TO_LEFT }, - { -#if defined(WCHAR_T_IS_UTF32) - L"abc 123" L" ! \x10401 !", -#elif defined(WCHAR_T_IS_UTF16) - L"abc 123" L" ! \xd801\xdc01 !", -#else -#error wchar_t should be either UTF-16 or UTF-32 -#endif - LEFT_TO_RIGHT }, - }; - - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) - EXPECT_EQ(cases[i].direction, - GetLastStrongCharacterDirection(WideToUTF16(cases[i].text))); -} - TEST_F(RTLTest, GetStringDirection) { struct { const wchar_t* text; |