summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorxji@chromium.org <xji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-16 07:29:21 +0000
committerxji@chromium.org <xji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-16 07:29:21 +0000
commit8a5da801541e61deddb35fae6e8916e69fb90826 (patch)
treed32af3085e37238ccbd907649454b5aa89616ebf /chrome
parentccbbc250ad912fec03f79247835c930f5b0deefc (diff)
downloadchromium_src-8a5da801541e61deddb35fae6e8916e69fb90826.zip
chromium_src-8a5da801541e61deddb35fae6e8916e69fb90826.tar.gz
chromium_src-8a5da801541e61deddb35fae6e8916e69fb90826.tar.bz2
This change list fix issue 3233: RTL: Wrong URL showing on Javascript pop up window
( http://crbug.com/3233) The fix put LTR-PDF pair around URL to force URL to be LTR always. test step: 1. open RTL Chrome 2. open http://www.w3.org/International/tests/test-rtl-chrome-4 3. click any "click me" button without the fix, the ending "/" in the URL appears at left-most in the alert window title. with the fix, the ending "/" in the URL appears correctly. Review URL: http://codereview.chromium.org/18088 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8170 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/jsmessage_box_handler.cc5
-rw-r--r--chrome/common/gfx/text_elider.h6
2 files changed, 10 insertions, 1 deletions
diff --git a/chrome/browser/jsmessage_box_handler.cc b/chrome/browser/jsmessage_box_handler.cc
index 47b0998..bf8b65d 100644
--- a/chrome/browser/jsmessage_box_handler.cc
+++ b/chrome/browser/jsmessage_box_handler.cc
@@ -71,9 +71,12 @@ std::wstring JavascriptMessageBoxHandler::GetWindowTitle() const {
GURL clean_url = url.ReplaceComponents(replacements);
// TODO(brettw) it should be easier than this to do the correct language
- // handling without getting the accept language from the profil.
+ // handling without getting the accept language from the profile.
std::wstring base_address = gfx::ElideUrl(clean_url, ChromeFont(), 0,
web_contents_->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages));
+ // Force URL to have LTR directionality.
+ if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT)
+ l10n_util::WrapStringWithLTRFormatting(&base_address);
return l10n_util::GetStringF(IDS_JAVASCRIPT_MESSAGEBOX_TITLE, base_address);
}
diff --git a/chrome/common/gfx/text_elider.h b/chrome/common/gfx/text_elider.h
index e13dab6..92d7d9e 100644
--- a/chrome/common/gfx/text_elider.h
+++ b/chrome/common/gfx/text_elider.h
@@ -22,6 +22,12 @@ namespace gfx {
// string is returned. |languages| is a comma separted list of ISO 639
// language codes and is used to determine what characters are understood
// by a user. It should come from |prefs::kAcceptLanguages|.
+//
+// Note: in RTL locales, if the URL returned by this function is going to be
+// displayed in the UI, then it is likely that the string needs to be marked
+// as an LTR string (using l10n_util::WrapStringWithLTRFormatting()) so that it
+// is displayed properly in an RTL context. Please refer to
+// http://crbug.com/6487 for more information.
std::wstring ElideUrl(const GURL& url,
const ChromeFont& font,
int available_pixel_width,