Bug 1446982 - Show the url when a remote tab entry is selected/hovered in the Address Bar. r=adw
MozReview-Commit-ID: 63fmwkESd4w
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -616,20 +616,28 @@ html|input.urlbar-input[textoverflow]:no
/* For non-action items, hide the action text; for action items, hide the URL
text. Don't show the separator for keyword results. */
#PopupAutoCompleteRichResult > richlistbox > richlistitem > .ac-type-icon,
#PopupAutoCompleteRichResult > richlistbox > richlistitem > .ac-site-icon,
#PopupAutoCompleteRichResult > richlistbox > richlistitem > .ac-tags:not([empty]),
#PopupAutoCompleteRichResult > richlistbox > richlistitem > .ac-separator:not([type=keyword]),
#PopupAutoCompleteRichResult > richlistbox > richlistitem > .ac-url:not([actiontype]),
-#PopupAutoCompleteRichResult > richlistbox > richlistitem > .ac-action[actiontype] {
+#PopupAutoCompleteRichResult > richlistbox > richlistitem > .ac-action[actiontype],
+#PopupAutoCompleteRichResult > richlistbox > richlistitem[selected] > .ac-url[actiontype=remotetab],
+#PopupAutoCompleteRichResult > richlistbox > richlistitem:hover > .ac-url[actiontype=remotetab]
+{
display: -moz-box;
}
+#PopupAutoCompleteRichResult > richlistbox > richlistitem[selected] > .ac-action[actiontype=remotetab],
+#PopupAutoCompleteRichResult > richlistbox > richlistitem:hover > .ac-action[actiontype=remotetab] {
+ display: none;
+}
+
/* Only show the "Search with" label on hover or selection. */
#PopupAutoCompleteRichResult > richlistbox > richlistitem:not([selected]):not(:hover) > .ac-action[actiontype=searchengine],
#PopupAutoCompleteRichResult > richlistbox > richlistitem:not([selected]):not(:hover) > .ac-separator[actiontype=searchengine] {
display: none;
}
#PopupAutoCompleteRichResult > richlistbox > richlistitem > .ac-site-icon {
margin-inline-start: 0;
--- a/toolkit/content/widgets/autocomplete.xml
+++ b/toolkit/content/widgets/autocomplete.xml
@@ -1806,58 +1806,62 @@
let title = this.getAttribute("ac-comment");
this.setAttribute("url", originalUrl);
this.setAttribute("image", this.getAttribute("ac-image"));
this.setAttribute("title", title);
this.setAttribute("text", this.getAttribute("ac-text"));
let popup = this.parentNode.parentNode;
let titleLooksLikeUrl = false;
- let displayUrl;
+ let displayUrl = originalUrl;
let emphasiseUrl = true;
+ let trimDisplayUrl = true;
let type = this.getAttribute("originaltype");
let types = new Set(type.split(/\s+/));
let initialTypes = new Set(types);
// Remove types that should ultimately not be in the `type` string.
types.delete("action");
types.delete("autofill");
types.delete("heuristic");
type = [...types][0] || "";
let action;
if (initialTypes.has("autofill")) {
// Treat autofills as visiturl actions.
action = {
type: "visiturl",
- params: {
- url: this.getAttribute("title"),
- },
+ params: { url: title },
};
}
this.removeAttribute("actiontype");
this.classList.remove("overridable-action");
// If the type includes an action, set up the item appropriately.
if (initialTypes.has("action") || action) {
action = action || this._parseActionUrl(originalUrl);
this.setAttribute("actiontype", action.type);
- if (action.type == "switchtab") {
+ switch (action.type) {
+ case "switchtab": {
this.classList.add("overridable-action");
- displayUrl = this._unescapeUrl(action.params.url);
+ displayUrl = action.params.url;
let desc = this._stringBundle.GetStringFromName("switchToTab2");
this._setUpDescription(this._actionText, desc, true);
- } else if (action.type == "remotetab") {
- displayUrl = this._unescapeUrl(action.params.url);
+ break;
+ }
+ case "remotetab": {
+ displayUrl = action.params.url;
let desc = action.params.deviceName;
this._setUpDescription(this._actionText, desc, true);
- } else if (action.type == "searchengine") {
+ break;
+ }
+ case "searchengine": {
emphasiseUrl = false;
// The order here is not localizable, we default to appending
// "- Search with Engine" to the search string, to be able to
// properly generate emphasis pairs. That said, no localization
// changed the order while it was possible, so doesn't look like
// there's a strong need for that.
let {engineName, searchSuggestion, searchQuery} = action.params;
@@ -1909,53 +1913,59 @@
// can style it ourselves with a generic search icon.
// We don't do this when matching an aliased search engine,
// because the icon helps with recognising which engine will be
// used (when using the default engine, we don't need that
// recognition).
if (!action.params.alias && !initialTypes.has("favicon")) {
this.removeAttribute("image");
}
- } else if (action.type == "visiturl") {
+ break;
+ }
+ case "visiturl": {
emphasiseUrl = false;
- displayUrl = this._unescapeUrl(action.params.url);
- title = displayUrl;
+ displayUrl = action.params.url;
titleLooksLikeUrl = true;
let visitStr = this._stringBundle.GetStringFromName("visit");
this._setUpDescription(this._actionText, visitStr, true);
- } else if (action.type == "extension") {
+ break;
+ }
+ case "extension": {
let content = action.params.content;
displayUrl = content;
+ trimDisplayUrl = false;
this._setUpDescription(this._actionText, content, true);
+ break;
+ }
}
}
- if (!displayUrl) {
+ if (trimDisplayUrl) {
let input = popup.input;
- let url = typeof(input.trimValue) == "function" ?
- input.trimValue(originalUrl) :
- originalUrl;
- displayUrl = this._unescapeUrl(url);
+ if (typeof input.trimValue == "function")
+ displayUrl = input.trimValue(displayUrl);
+ displayUrl = this._unescapeUrl(displayUrl);
}
// For performance reasons we may want to limit the displayUrl size.
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);
// Not all valid URLs have a domain.
if (uri.host)
title = uri.host;
} catch (e) {}
+ if (!title)
+ title = displayUrl;
}
this._tags.setAttribute("empty", "true");
if (type == "tag" || type == "bookmark-tag") {
// The title is separated from the tags by an endash
let tags;
[, title, tags] = title.match(/^(.+) \u2013 (.+)$/);