зеркало из https://github.com/mozilla/gecko-dev.git
Bug 317369: make use of textbox's clickSelectsAll property for help, r=mconnor
This commit is contained in:
Родитель
928759c634
Коммит
159dfdebf8
|
@ -101,10 +101,6 @@ var helpFileDS;
|
|||
# reduction on all links within the current help set.
|
||||
var helpBaseURI;
|
||||
|
||||
var gIgnoreFocus = false;
|
||||
var gClickSelectsAll;
|
||||
var gIgnoreClick = false;
|
||||
|
||||
/* defaultTopic is either set
|
||||
1. in the openHelp() call, passed as an argument to the Help window and
|
||||
evaluated in init(), or
|
||||
|
@ -179,8 +175,9 @@ function init() {
|
|||
|
||||
webProgress.addProgressListener(window.XULBrowserWindow, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
||||
|
||||
gClickSelectsAll = getBoolPref("browser.urlbar.clickSelectsAll", true);
|
||||
|
||||
var searchBox = document.getElementById("findText");
|
||||
searchBox.clickSelectsAll = getBoolPref("browser.urlbar.clickSelectsAll", true);
|
||||
|
||||
setTimeout(focusSearch, 0);
|
||||
}
|
||||
|
||||
|
@ -632,33 +629,6 @@ function onselect_loadURI(tree) {
|
|||
}// when switching between tabs a spurious row number is returned.
|
||||
}
|
||||
|
||||
// copied from browser.js to handle the searchbar
|
||||
function SearchbarFocusHandler(aEvent, aElt)
|
||||
{
|
||||
if (gIgnoreFocus)
|
||||
gIgnoreFocus = false;
|
||||
else if (gClickSelectsAll)
|
||||
aElt.select();
|
||||
}
|
||||
|
||||
function SearchbarMouseDownHandler(aEvent, aElt)
|
||||
{
|
||||
if (aElt.hasAttribute("focused")) {
|
||||
gIgnoreClick = true;
|
||||
} else {
|
||||
gIgnoreFocus = true;
|
||||
gIgnoreClick = false;
|
||||
aElt.setSelectionRange(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
function SearchbarClickHandler(aEvent, aElt)
|
||||
{
|
||||
if (!gIgnoreClick && gClickSelectsAll && aElt.selectionStart == aElt.selectionEnd)
|
||||
aElt.select();
|
||||
}
|
||||
|
||||
|
||||
function focusSearch() {
|
||||
var searchBox = document.getElementById("findText");
|
||||
searchBox.focus();
|
||||
|
|
|
@ -185,9 +185,6 @@
|
|||
<label value="&searchtab.label;" accesskey="&searchtab.accesskey;"
|
||||
control="findText"/>
|
||||
<textbox id="findText" type="timed" timeout="500"
|
||||
onfocus="SearchbarFocusHandler(event, this);"
|
||||
onmousedown="SearchbarMouseDownHandler(event, this);"
|
||||
onclick="SearchbarClickHandler(event, this);"
|
||||
oncommand="doFind();"/>
|
||||
</toolbaritem>
|
||||
</toolbar>
|
||||
|
|
Загрузка…
Ссылка в новой задаче