Bug 1106432 - Allow search bar icon to indicate when a page offers OpenSearch. ui-r=shorlander, r=florian.

This commit is contained in:
Blake Winton 2014-12-18 15:25:21 -05:00
parent bb626226c0
commit 5c65e92619
12 changed files with 92 additions and 4 deletions

View File

@ -444,6 +444,13 @@ panel[noactions] > richlistbox > richlistitem[type~="action"] > .ac-url-box > .a
margin-left: -23px;
}
/* Overlay a badge on top of the icon of additional open search providers
in the search panel. */
.addengine-item > .button-box > .button-icon {
-moz-binding: url("chrome://browser/content/urlbarBindings.xml#addengine-icon");
display: -moz-stack;
}
searchbar[oneoffui] {
-moz-binding: url("chrome://browser/content/search/search.xml#searchbar-flare") !important;
}

View File

@ -3308,8 +3308,32 @@ const BrowserSearch = {
if (hidden)
browser.hiddenEngines = engines;
else
else {
browser.engines = engines;
if (browser == gBrowser.selectedBrowser)
this.updateSearchButton();
}
},
/**
* Update the browser UI to show whether or not additional engines are
* available when a page is loaded or the user switches tabs to a page that
* has search engines.
*/
updateSearchButton: function() {
var searchBar = this.searchBar;
// The search bar binding might not be applied even though the element is
// in the document (e.g. when the navigation toolbar is hidden), so check
// for .searchButton specifically.
if (!searchBar || !searchBar.searchButton)
return;
var engines = gBrowser.selectedBrowser.engines;
if (engines && engines.length > 0)
searchBar.setAttribute("addengines", "true");
else
searchBar.removeAttribute("addengines");
},
/**
@ -4326,6 +4350,7 @@ var XULBrowserWindow = {
asyncUpdateUI: function () {
FeedHandler.updateFeeds();
BrowserSearch.updateSearchButton();
},
// Left here for add-on compatibility, see bug 752434

View File

@ -1234,6 +1234,13 @@
</handlers>
</binding>
<!-- Used for additional open search providers in the search panel. -->
<binding id="addengine-icon" extends="xul:box">
<content>
<xul:image class="addengine-icon" xbl:inherits="src"/>
<xul:image class="addengine-badge"/>
</content>
</binding>
<binding id="urlbar-rich-result-popup" extends="chrome://global/content/bindings/autocomplete.xml#autocomplete-rich-result-popup">
<implementation>

View File

@ -270,6 +270,7 @@
}
}
}
BrowserSearch.updateSearchButton();
]]></body>
</method>
@ -295,6 +296,7 @@
}
}
}
BrowserSearch.updateSearchButton();
]]></body>
</method>
@ -605,6 +607,7 @@
<xul:hbox class="searchbar-search-button-container">
<xul:image class="searchbar-search-button"
anonid="searchbar-search-button"
xbl:inherits="addengines"
tooltiptext="&searchEndCap.label;"/>
</xul:hbox>
<xul:button class="searchbar-engine-button"

View File

@ -72,6 +72,7 @@ browser.jar:
skin/classic/browser/search-indicator-add-engine.png (../shared/search/search-indicator-add-engine.png)
skin/classic/browser/search-engine-placeholder.png (../shared/search/search-engine-placeholder.png)
skin/classic/browser/badge-add-engine.png (../shared/search/badge-add-engine.png)
skin/classic/browser/search-indicator-badge-add.png (../shared/search/search-indicator-badge-add.png)
skin/classic/browser/Secure.png
skin/classic/browser/Security-broken.png
skin/classic/browser/setDesktopBackground.css

View File

@ -82,6 +82,10 @@ menuitem[cmd="cmd_clearhistory"][disabled] {
margin: -2px -2px;
}
.searchbar-search-button[addengines="true"] {
list-style-image: url("chrome://browser/skin/search-indicator-badge-add.png");
}
.searchbar-search-button:hover {
-moz-image-region: rect(0, 40px, 20px, 20px);
}
@ -202,10 +206,17 @@ searchbar[oneoffui] .search-go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon
color: HighlightText;
}
.addengine-item > .button-box > .button-icon {
.addengine-icon {
width: 16px;
}
.addengine-badge {
width: 16px;
height: 16px;
margin: -7px -9px 7px 9px;
list-style-image: url("chrome://browser/skin/badge-add-engine.png");
}
.addengine-item > .button-box > .button-text {
-moz-box-flex: 1;
text-align: start;

View File

@ -113,6 +113,8 @@ browser.jar:
skin/classic/browser/search-engine-placeholder@2x.png (../shared/search/search-engine-placeholder@2x.png)
skin/classic/browser/badge-add-engine.png (../shared/search/badge-add-engine.png)
skin/classic/browser/badge-add-engine@2x.png (../shared/search/badge-add-engine@2x.png)
skin/classic/browser/search-indicator-badge-add.png (../shared/search/search-indicator-badge-add.png)
skin/classic/browser/search-indicator-badge-add@2x.png (../shared/search/search-indicator-badge-add@2x.png)
skin/classic/browser/Secure-Glyph.png
skin/classic/browser/Secure-Glyph@2x.png
skin/classic/browser/slowStartup-16.png

View File

@ -63,6 +63,10 @@
margin: 0 -3px;
}
.searchbar-search-button[addengines="true"] {
list-style-image: url("chrome://browser/skin/search-indicator-badge-add.png");
}
.searchbar-search-button:hover {
-moz-image-region: rect(0, 40px, 20px, 20px);
}
@ -105,6 +109,10 @@ searchbar[oneoffui] .search-go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon
-moz-image-region: rect(0, 40px, 40px, 0);
}
.searchbar-search-button[addengines="true"] {
list-style-image: url("chrome://browser/skin/search-indicator-badge-add@2x.png");
}
.searchbar-search-button:hover {
-moz-image-region: rect(0, 80px, 40px, 40px);
}
@ -213,10 +221,17 @@ searchbar[oneoffui] .search-go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon
color: HighlightText;
}
.addengine-item > .button-box > .button-icon {
.addengine-icon {
width: 16px;
}
.addengine-badge {
width: 16px;
height: 16px;
margin: -7px -9px 7px 9px;
list-style-image: url("chrome://browser/skin/badge-add-engine.png");
}
.addengine-item > .button-box > .button-text {
-moz-box-flex: 1;
text-align: start;
@ -228,6 +243,10 @@ searchbar[oneoffui] .search-go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon
}
@media (min-resolution: 2dppx) {
.addengine-badge {
list-style-image: url("chrome://browser/skin/badge-add-engine@2x.png");
}
.addengine-item:not([image]) {
list-style-image: url("chrome://browser/skin/search-engine-placeholder@2x.png");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1000 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -87,6 +87,7 @@ browser.jar:
skin/classic/browser/search-indicator-add-engine.png (../shared/search/search-indicator-add-engine.png)
skin/classic/browser/search-engine-placeholder.png (../shared/search/search-engine-placeholder.png)
skin/classic/browser/badge-add-engine.png (../shared/search/badge-add-engine.png)
skin/classic/browser/search-indicator-badge-add.png (../shared/search/search-indicator-badge-add.png)
skin/classic/browser/Secure24.png
skin/classic/browser/setDesktopBackground.css
skin/classic/browser/slowStartup-16.png
@ -538,6 +539,7 @@ browser.jar:
skin/classic/aero/browser/search-indicator-add-engine.png (../shared/search/search-indicator-add-engine.png)
skin/classic/aero/browser/search-engine-placeholder.png (../shared/search/search-engine-placeholder.png)
skin/classic/aero/browser/badge-add-engine.png (../shared/search/badge-add-engine.png)
skin/classic/aero/browser/search-indicator-badge-add.png (../shared/search/search-indicator-badge-add.png)
skin/classic/aero/browser/Secure24.png (Secure24-aero.png)
skin/classic/aero/browser/setDesktopBackground.css
skin/classic/aero/browser/slowStartup-16.png

View File

@ -93,6 +93,10 @@
margin: -2px -2px;
}
.searchbar-search-button[addengines="true"] {
list-style-image: url("chrome://browser/skin/search-indicator-badge-add.png");
}
.searchbar-search-button:hover {
-moz-image-region: rect(0, 40px, 20px, 20px);
}
@ -212,10 +216,17 @@ searchbar[oneoffui] .search-go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon
color: HighlightText;
}
.addengine-item > .button-box > .button-icon {
.addengine-icon {
width: 16px;
}
.addengine-badge {
width: 16px;
height: 16px;
margin: -7px -9px 7px 9px;
list-style-image: url("chrome://browser/skin/badge-add-engine.png");
}
.addengine-item > .button-box > .button-text {
-moz-box-flex: 1;
text-align: start;