Commit 3d6f67f3 authored by Chris Thompson's avatar Chris Thompson Committed by Commit Bot

Fix RTL URL handling in status bar

The existing code applies an LTR directionality embedding on the elided
URL text, but then overrides it later. This changes SetURL to apply the
LTR directionality to the status bar URL text just before setting the
label text to ensure it is applied to the text that is displayed.

Bug: 1059509
Change-Id: I3907a40ec1a19cfad095a9f0394985a851ad4395
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2094625Reviewed-by: default avatarAllen Bauer <kylixrd@chromium.org>
Commit-Queue: Christopher Thompson <cthomp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748816}
parent a10f8b64
......@@ -785,11 +785,6 @@ void StatusBubbleViews::SetURL(const GURL& url) {
size_.width() - (kShadowThickness + kTextHorizPadding) * 2 - 1);
url_text_ = url_formatter::ElideUrl(url, GetFont(), text_width);
// An URL is always treated as a left-to-right string. On right-to-left UIs
// we need to explicitly mark the URL as LTR to make sure it is displayed
// correctly.
url_text_ = base::i18n::GetDisplayStringInLTRDirectionality(url_text_);
// Get the width of the URL if the bubble width is the maximum size.
base::string16 full_size_elided_url =
url_formatter::ElideUrl(url, GetFont(), GetMaxStatusBubbleWidth());
......@@ -827,7 +822,11 @@ void StatusBubbleViews::SetURL(const GURL& url) {
expand_timer_factory_.GetWeakPtr()),
base::TimeDelta::FromMilliseconds(kExpandHoverDelayMS));
}
view_->SetText(url_text_, true);
// An URL is always treated as a left-to-right string. On right-to-left UIs
// we need to explicitly mark the URL as LTR to make sure it is displayed
// correctly.
view_->SetText(base::i18n::GetDisplayStringInLTRDirectionality(url_text_),
true);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment