Bug 468658: show 'no results' string when no matches appear in the awesomebar, and be sure to always have it appear even when there are no results, so that search engines are accessible, r=mfinkle, ui-r=madhava

This commit is contained in:
Gavin Sharp 2009-05-26 11:46:39 -04:00
Родитель ac15870e6e
Коммит 774c3832f3
5 изменённых файлов: 44 добавлений и 12 удалений

Просмотреть файл

@ -32,19 +32,19 @@
</binding>
<binding id="popup_autocomplete">
<content hidden="true">
<content hidden="true" noresults="&noResults.label;">
<xul:vbox class="autocomplete-box" flex="1">
<xul:scrollbox orient="vertical"
class="autocomplete-items"
anonid="autocomplete-items"
flex="1000">
<xul:label/>
<xul:label/>
<xul:label/>
<xul:label/>
<xul:label/>
<xul:label/>
<xul:label/>
<xul:label value=""/>
<xul:label value=""/>
<xul:label value=""/>
<xul:label value=""/>
<xul:label value=""/>
<xul:label value=""/>
<xul:label value=""/>
</xul:scrollbox>
<children/>
</xul:vbox>
@ -139,14 +139,14 @@
let controller = this.input.controller;
let searchString = controller.searchString;
let matchCount = this._matchCount;
let children = this._items.childNodes.length;
// Need to iterate over all our existing entries at a minimum, to make
// sure they're either updated or cleared out. We might also have to
// add extra items.
let iterCount = Math.max(children, matchCount);
let matchCount = this._matchCount;
let children = this._items.childNodes;
let iterCount = Math.max(children.length, matchCount);
for (let i = 0; i < iterCount; ++i) {
let label = this._items.childNodes.item(i);
let label = children.item(i);
if (!label) {
// create a new entry
label = document.createElementNS(this._XULNS, "label");
@ -155,6 +155,19 @@
label._index = i;
// Use the third item as a "no results" entry if needed.
// Kind of gross, but using a separate element makes layout more
// complicated outside of the scrollbox, and makes iteration over
// childNodes more complicated inside the scrollbox (also
// getElementsByTagName seems to be broken for the anonymous labels
// hardcoded above in the <content>).
if (i == 3 && matchCount == 0) {
label.setAttribute("value", this.getAttribute("noresults"));
label.setAttribute("class", "autocomplete-item noresults");
continue;
}
// Check whether there's an entry to fill
if (i > matchCount - 1) {
// Just clear out the old item

Просмотреть файл

@ -268,6 +268,7 @@
maxrows="6"
readonly="true"
completeselectedindex="true"
minresultsforpopup="0"
flex="1"
ontextentered="BrowserUI.goToURI();"
clickSelectsAll="true"/>

Просмотреть файл

@ -79,6 +79,8 @@
<!ENTITY downloadResume.label "Resume">
<!ENTITY downloadRetry.label "Retry">
<!ENTITY noResults.label "No results">
<!ENTITY identity.unverifiedsite2 "This web site does not supply identity information.">
<!ENTITY identity.connectedTo "You are connected to">
<!-- Localization note (identity.runBy) : This string appears between a

Просмотреть файл

@ -398,6 +398,14 @@ placeitem .button-text {
background-color: grey;
}
.autocomplete-item.noresults {
text-align: center;
font-style: italic;
color: grey;
background-color: white;
border-bottom: none;
}
.ac-result-type-bookmark {
list-style-image: url("chrome://browser/skin/images/page-starred.png");
width: 16px;

Просмотреть файл

@ -398,6 +398,14 @@ placeitem .button-text {
background-color: grey;
}
.autocomplete-item.noresults {
text-align: center;
font-style: italic;
color: grey;
background-color: white;
border-bottom: none;
}
.ac-result-type-bookmark {
list-style-image: url("chrome://browser/skin/images/page-starred.png");
width: 16px;