Bug 575609 - "Switch to Tab" autocomplete entries should have icon decorations (star, magnifier glass, et al.) like other entries. r=gavin, a=blocking-final

This commit is contained in:
Drew Willcoxon 2010-08-25 21:01:22 -07:00
parent 968148df51
commit 8c99f8bd79
6 changed files with 26 additions and 18 deletions

View File

@ -139,7 +139,7 @@ toolbar[mode="icons"] > #reload-button[displaystop] {
/* For results that are actions, their description text is shown instead of
the URL - this needs to follow the locale's direction, unlike URLs. */
richlistitem[type="action"]:-moz-locale-dir(rtl) > .ac-url-box {
richlistitem[type~="action"]:-moz-locale-dir(rtl) > .ac-url-box {
direction: rtl;
}

View File

@ -1080,7 +1080,7 @@ toolbar[iconsize="small"] #fullscreen-button {
color: -moz-nativehyperlinktext;
}
richlistitem[type="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-icon {
richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-icon {
list-style-image: url("chrome://browser/skin/actionicon-tab.png");
}

View File

@ -872,7 +872,7 @@ richlistitem[selected="true"][current="true"] > hbox > .ac-result-type-bookmark,
font-size: 0.95em;
}
richlistitem[type="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-icon {
richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-icon {
list-style-image: url("chrome://browser/skin/actionicon-tab.png");
}

View File

@ -1123,7 +1123,7 @@ toolbar:not([iconsize="small"])[mode="icons"] #forward-button:not([disabled="tru
}
%endif
richlistitem[type="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-icon {
richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-icon {
list-style-image: url("chrome://browser/skin/actionicon-tab.png");
}

View File

@ -1002,10 +1002,10 @@ nsPlacesAutoComplete.prototype = {
// If actions are enabled and the page is open, add only the switch-to-tab
// result. Otherwise, add the normal result.
let [url, style] = this._enableActions && openPageCount > 0 ?
["moz-action:switchtab," + escapedEntryURL, "action"] :
[escapedEntryURL, style];
this._addToResults(entryId, url, title, entryFavicon, style);
let [url, action] = this._enableActions && openPageCount > 0 ?
["moz-action:switchtab," + escapedEntryURL, "action "] :
[escapedEntryURL, ""];
this._addToResults(entryId, url, title, entryFavicon, action + style);
return true;
},

View File

@ -1412,6 +1412,23 @@
var setupUrl = true;
// If the type includes an action, set up the item appropriately.
var types = type.split(/\s+/);
var actionIndex = types.indexOf("action");
if (actionIndex >= 0) {
let [,action, param] = url.match(/^moz-action:([^,]+),(.*)$/);
this.setAttribute("actiontype", action);
url = param;
let desc = "]]>&action.switchToTab.label;<![CDATA[";
this._setUpDescription(this._url, desc, true);
setupUrl = false;
// Remove the "action" substring so that the correct style, if any,
// is applied below.
types.splice(actionIndex, 1);
type = types.join(" ");
}
// If we have a tag match, show the tags and icon
if (type == "tag") {
// Configure the extra box for tags display
@ -1440,7 +1457,7 @@
this._extraBox.childNodes[1].hidden = false;
this._extraBox.pack = "start";
this._titleBox.flex = 0;
// Put the parameters next to the title if we have any
let search = this.getAttribute("text");
let params = "";
@ -1453,15 +1470,6 @@
// Don't emphasize keyword searches in the title or url
this.setAttribute("text", "");
} else if (type == "action") {
let [,action, param] = url.match(/^moz-action:([^,]+),(.*)$/);
this.setAttribute("actiontype", action);
url = param;
this._extraBox.hidden = true;
this._titleBox.flex = 1;
let desc = "]]>&action.switchToTab.label;<![CDATA[";
this._setUpDescription(this._url, desc, true);
setupUrl = false;
} else {
// Hide the title's extra box if we don't need extra stuff
this._extraBox.hidden = true;