Bug 580293 - Next/Previous buttons are enabled when search field is empty [r=mfinkle]

This commit is contained in:
Vivien Nicolas 2010-07-21 11:34:19 +02:00
Родитель 2a249db218
Коммит 8383bd9ab2
2 изменённых файлов: 11 добавлений и 2 удалений

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

@ -1445,6 +1445,9 @@ var FindHelperUI = {
this._textbox = document.getElementById("find-helper-textbox");
this._container = document.getElementById("content-navigator");
this._cmdPrevious = document.getElementById(this.commands.previous);
this._cmdNext = document.getElementById(this.commands.next);
// Listen for form assistant messages from content
messageManager.addMessageListener("FindAssist:Show", this);
@ -1470,8 +1473,8 @@ var FindHelperUI = {
show: function findHelperShow() {
Browser._browserView.ignorePageScroll(true);
Browser.selectedBrowser.messageManager.sendAsyncMessage("FindAssist:Find", { searchString: "" });
this._container.show(this);
this.search("");
this._textbox.focus();
},
@ -1490,9 +1493,15 @@ var FindHelperUI = {
},
search: function findHelperSearch(aValue) {
this.updateCommands(aValue);
Browser.selectedBrowser.messageManager.sendAsyncMessage("FindAssist:Find", { searchString: aValue });
},
updateCommands: function findHelperUpdateCommands(aValue) {
this._cmdPrevious.setAttribute("disabled", aValue == "");
this._cmdNext.setAttribute("disabled", aValue == "");
},
updateFindInPage: function findHelperUpdateFindInPage() {
PageActions.removeItems("findinpage");
let title = Elements.browserBundle.getString("pageactions.findInPage");

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

@ -277,7 +277,7 @@
<vbox id="content-navigator" class="window-width" top="0" spacer="content-navigator-spacer">
<arrowscrollbox id="form-helper-autofill" collapsed="true" align="center" flex="1" orient="horizontal"
onclick="FormHelperUI.doAutoComplete(event.target);"/>
<textbox id="find-helper-textbox" oncommand="FindHelperUI.search(this.value)" type="search" flex="1"/>
<textbox id="find-helper-textbox" oncommand="FindHelperUI.search(this.value)" oninput="FindHelperUI.updateCommands(this.value);" type="search" flex="1"/>
</vbox>
</stack>