diff options
author | xji@chromium.org <xji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-07 23:13:11 +0000 |
---|---|---|
committer | xji@chromium.org <xji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-07 23:13:11 +0000 |
commit | da244100d3ac663a1f827fc712dc508c7761d207 (patch) | |
tree | 4f8457737df65fb3e204498d867d379f2cee0c79 /base/i18n/rtl.cc | |
parent | 7b3fbe1dee9db971861c3af0796f0f0fbeaae271 (diff) | |
download | chromium_src-da244100d3ac663a1f827fc712dc508c7761d207.zip chromium_src-da244100d3ac663a1f827fc712dc508c7761d207.tar.gz chromium_src-da244100d3ac663a1f827fc712dc508c7761d207.tar.bz2 |
This CL fixes issue 42867 - "OK" button disabled on "Edit Exception" dialog box
when URL is modified in non-empty input field - RTL
In RTL chrome in windows, the text get from "Pattern" text field is wrapped
with LRE/POP, which makes the pattern invalid. Trim explicit bidi control characters
off in NativeTextfieldWin::GetText().
BUG=http://crbug.com/42867
TEST=
1. Launch Chrome with RTL language UI
2. click Wrench => Options => Under the Hood => Content settings => Exceptions
=> Edit...
3. modify an existing url on the Pattern field.
The "OK" button should not be grayed out.
Review URL: http://codereview.chromium.org/1703026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46751 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/i18n/rtl.cc')
-rw-r--r-- | base/i18n/rtl.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/base/i18n/rtl.cc b/base/i18n/rtl.cc index 4755a94..9fbf35e 100644 --- a/base/i18n/rtl.cc +++ b/base/i18n/rtl.cc @@ -225,6 +225,21 @@ std::wstring GetDisplayStringInLTRDirectionality(std::wstring* text) { return *text; } +const string16 StripWrappingBidiControlCharacters(const string16& text) { + if (text.empty()) + return text; + size_t begin_index = 0; + char16 begin = text[begin_index]; + if (begin == kLeftToRightEmbeddingMark || + begin == kRightToLeftEmbeddingMark || + begin == kLeftToRightOverride || + begin == kRightToLeftOverride) + ++begin_index; + size_t end_index = text.length() - 1; + if (text[end_index] == kPopDirectionalFormatting) + --end_index; + return text.substr(begin_index, end_index - begin_index + 1); +} + } // namespace i18n } // namespace base - |