Bug 1290490 - Firefox shouldn't RTL the first item in the URL dropdown list when typing a URL. r?mak
MozReview-Commit-ID: IWPYKhdjrDg
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -453,17 +453,18 @@ toolbar:not(#TabsToolbar) > #personal-bo
}
/* ::::: location bar ::::: */
#urlbar {
-moz-binding: url(chrome://browser/content/urlbarBindings.xml#urlbar);
}
/* Always show URLs LTR. */
-.ac-url-text:-moz-locale-dir(rtl) {
+.ac-url-text:-moz-locale-dir(rtl),
+.ac-title-text[lookslikeurl]:-moz-locale-dir(rtl) {
direction: ltr !important;
}
/* For non-action items, hide the action text; for action items, hide the URL
text. */
.ac-url[actiontype],
.ac-action:not([actiontype]) {
display: none;
--- a/toolkit/content/widgets/autocomplete.xml
+++ b/toolkit/content/widgets/autocomplete.xml
@@ -1852,16 +1852,17 @@ extends="chrome://global/content/binding
if (!popup.popupOpen) {
// Removing the max-width and resetting it later when overflow is
// handled is jarring when the item is visible, so skip this when
// the popup is open.
this._removeMaxWidths();
}
let title = this.getAttribute("title");
+ let titleLooksLikeUrl = false;
let displayUrl;
let originalUrl = this.getAttribute("url");
let emphasiseUrl = true;
let type = this.getAttribute("originaltype");
let types = new Set(type.split(/\s+/));
let initialTypes = new Set(types);
@@ -1961,16 +1962,17 @@ extends="chrome://global/content/binding
// recognition).
if (!action.params.alias && !initialTypes.has("favicon")) {
this.removeAttribute("image");
}
} else if (action.type == "visiturl") {
emphasiseUrl = false;
displayUrl = this._unescapeUrl(action.params.url);
title = displayUrl;
+ titleLooksLikeUrl = true;
let visitStr = this._stringBundle.GetStringFromName("visit");
this._setUpDescription(this._actionText, visitStr, true);
}
}
if (!displayUrl) {
let input = popup.input;
let url = typeof(input.trimValue) == "function" ?
@@ -1982,16 +1984,17 @@ extends="chrome://global/content/binding
if (popup.textRunsMaxLen) {
displayUrl = displayUrl.substr(0, popup.textRunsMaxLen);
}
this.setAttribute("displayurl", displayUrl);
// Show the domain as the title if we don't have a title.
if (!title) {
title = displayUrl;
+ titleLooksLikeUrl = true;
try {
let uri = Services.io.newURI(originalUrl, null, null);
// Not all valid URLs have a domain.
if (uri.host)
title = uri.host;
} catch (e) {}
}
@@ -2033,16 +2036,22 @@ extends="chrome://global/content/binding
// we want it to appear as if it were not visible, so set its text
// to the empty string.
this._setUpDescription(this._actionText, "", false);
}
}
this.setAttribute("type", type);
+ if (titleLooksLikeUrl) {
+ this._titleText.setAttribute("lookslikeurl", "true");
+ } else {
+ this._titleText.removeAttribute("lookslikeurl");
+ }
+
if (Array.isArray(title)) {
// For performance reasons we may want to limit the title size.
if (popup.textRunsMaxLen) {
title = title.map(t => t.substr(0, popup.textRunsMaxLen));
}
this._setUpEmphasisedSections(this._titleText, title);
} else {
// For performance reasons we may want to limit the title size.