Bug 391385 - Split PopupAutoComplete in three: UrlbarAutoComplete, SearchAutoComplete and ContentAutoComplete, patch by Simon Bünzli <zeniko@gmail.com>, r=gavin

This commit is contained in:
philringnalda@gmail.com 2007-08-26 14:27:26 -07:00
Родитель cf63818e55
Коммит 4a27aaed4a
5 изменённых файлов: 50 добавлений и 11 удалений

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

@ -1,13 +1,18 @@
/* ::::: search bar ::::: */
searchbar {
-moz-binding: url("chrome://browser/content/search/search.xml#searchbar");
}
#SearchAutoComplete {
-moz-binding: url("chrome://browser/content/search/search.xml#searchbar-result-popup");
}
/* ::::: location bar ::::: */
#urlbar {
-moz-binding: url(chrome://browser/content/urlbarBindings.xml#urlbar);
}
#PopupAutoComplete {
#UrlbarAutoComplete {
-moz-binding: url("chrome://browser/content/urlbarBindings.xml#urlbar-result-popup");
}

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

@ -98,7 +98,9 @@
onclick="checkForMiddleClick(this, event);"/>
<tooltip id="aHTMLTooltip" onpopupshowing="return FillInHTMLTooltip(document.tooltipNode);"/>
<panel type="autocomplete" chromedir="&locale.dir;" id="PopupAutoComplete" noautofocus="true"/>
<panel type="autocomplete" chromedir="&locale.dir;" id="UrlbarAutoComplete" noautofocus="true"/>
<panel type="autocomplete" chromedir="&locale.dir;" id="SearchAutoComplete" noautofocus="true"/>
<panel type="autocomplete" chromedir="&locale.dir;" id="ContentAutoComplete" noautofocus="true"/>
<panel id="editBookmarkPanel" orient="vertical">
<vbox id="editBookmarkPanelContent" flex="1"/>
@ -220,7 +222,7 @@
chromedir="&locale.dir;"
type="autocomplete"
autocompletesearch="history"
autocompletepopup="PopupAutoComplete"
autocompletepopup="UrlbarAutoComplete"
completeselectedindex="true"
tabscrolling="true"
showcommentcolumn="true"
@ -300,7 +302,8 @@
<toolbaritem id="search-container" title="&searchItem.title;"
align="center" class="chromeclass-toolbar-additional"
flex="100" persist="width">
<searchbar id="searchbar" flex="1" chromedir="&locale.dir;"/>
<searchbar id="searchbar" flex="1" chromedir="&locale.dir;"
autocompletepopup="SearchAutoComplete"/>
</toolbaritem>
<toolbarbutton id="print-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
@ -430,7 +433,7 @@
flex="1" contenttooltip="aHTMLTooltip"
contentcontextmenu="contentAreaContextMenu"
onnewtab="BrowserOpenTab();"
autocompletepopup="PopupAutoComplete"
autocompletepopup="ContentAutoComplete"
ondragdrop="nsDragAndDrop.drop(event, contentAreaDNDObserver);"
onclick="return contentAreaClick(event, false);"/>
</vbox>

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

@ -504,7 +504,8 @@
</binding>
<binding id="urlbar-result-popup" extends="chrome://global/content/bindings/autocomplete.xml#autocomplete-result-popup">
<binding id="urlbar-result-popup"
extends="chrome://global/content/bindings/autocomplete.xml#autocomplete-result-popup">
<implementation>
<method name="onPopupClick">
<parameter name="aEvent"/>

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

@ -90,7 +90,6 @@
anonid="searchbar-textbox"
type="autocomplete"
flex="1"
autocompletepopup="PopupAutoComplete"
autocompletesearch="search-autocomplete"
autocompletesearchparam="searchbar-history"
timeout="250"
@ -98,7 +97,7 @@
completeselectedindex="true"
showcommentcolumn="true"
tabscrolling="true"
xbl:inherits="disabled,disableautocomplete,searchengine,src">
xbl:inherits="disabled,disableautocomplete,autocompletepopup,searchengine,src">
</xul:textbox>
</xul:hbox>
@ -839,4 +838,35 @@
<children/>
</content>
</binding>
<binding id="searchbar-result-popup"
extends="chrome://global/content/bindings/autocomplete.xml#autocomplete-result-popup">
<implementation>
<method name="onPopupClick">
<parameter name="aEvent"/>
<body><![CDATA[
var controller = this.view.QueryInterface(Components.interfaces.nsIAutoCompleteController);
// default action on unmodified left-click
if (aEvent.button == 0 && !aEvent.shiftKey && !aEvent.ctrlKey &&
!aEvent.altKey && !aEvent.metaKey) {
controller.handleEnter();
}
// completely ignore right-clicks
else if (aEvent.button != 2) {
// handle search bar click
var search = controller.getValueAt(this.tree.view.selection.currentIndex);
var textbox = this.mInput;
// close the autocomplete popup and copy the selected value to the search box
this.closePopup();
textbox.value = search;
// open the search results according to the clicking subtlety
var where = whereToOpenLink(aEvent, false, true);
textbox._getParentSearchbar().doSearch(search, where);
}
]]></body>
</method>
</implementation>
</binding>
</bindings>

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

@ -914,15 +914,15 @@ toolbar[iconsize="small"] #paste-button:not([disabled="true"]):hover:active {
direction: ltr;
}
#PopupAutoComplete {
#UrlbarAutoComplete {
direction: ltr !important;
}
#PopupAutoComplete[chromedir="rtl"] > tree > treerows {
#UrlbarAutoComplete[chromedir="rtl"] > tree > treerows {
direction: rtl;
}
#PopupAutoComplete .autocomplete-treebody {
#UrlbarAutoComplete .autocomplete-treebody {
direction: ltr;
}