зеркало из https://github.com/mozilla/gecko-dev.git
Don't let sidebar panels take focus unless the user just selected the panel (i.e. don't focus them when a new window is opened). Bug 76621. r=blake, sr=jag.
This commit is contained in:
Родитель
455c527ce5
Коммит
e184ed27d1
|
@ -49,7 +49,13 @@ var gHistoryStatus;
|
||||||
var gHistoryGrouping = "";
|
var gHistoryGrouping = "";
|
||||||
var gWindowManager = null;
|
var gWindowManager = null;
|
||||||
|
|
||||||
function HistoryInit()
|
function HistoryWindowInit()
|
||||||
|
{
|
||||||
|
HistoryCommonInit();
|
||||||
|
gHistoryTree.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
function HistoryCommonInit()
|
||||||
{
|
{
|
||||||
gHistoryTree = document.getElementById("historyTree");
|
gHistoryTree = document.getElementById("historyTree");
|
||||||
gDeleteByHostname = document.getElementById("menu_deleteByHostname");
|
gDeleteByHostname = document.getElementById("menu_deleteByHostname");
|
||||||
|
@ -102,7 +108,7 @@ function HistoryInit()
|
||||||
pbi.addObserver("browser.history.grouping", groupObserver, false);
|
pbi.addObserver("browser.history.grouping", groupObserver, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gHistoryTree.focus();
|
|
||||||
gHistoryTree.treeBoxObject.view.selection.select(0);
|
gHistoryTree.treeBoxObject.view.selection.select(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -466,7 +466,6 @@ function SearchPanelStartup()
|
||||||
else
|
else
|
||||||
switchTab(1);
|
switchTab(1);
|
||||||
}
|
}
|
||||||
focusTextBox();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function haveSearchResults()
|
function haveSearchResults()
|
||||||
|
@ -572,12 +571,6 @@ function loadEngines(aCategory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function focusTextBox()
|
|
||||||
{
|
|
||||||
var textBox = document.getElementById("sidebar-search-text");
|
|
||||||
textBox.focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
function SearchPanelShutdown()
|
function SearchPanelShutdown()
|
||||||
{
|
{
|
||||||
var tree = document.getElementById("resultList");
|
var tree = document.getElementById("resultList");
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||||
orient="vertical" onload="SearchPanelStartup();"
|
orient="vertical" onload="SearchPanelStartup();"
|
||||||
onunload="SearchPanelShutdown();">
|
onunload="SearchPanelShutdown();" elementtofocus="sidebar-search-text">
|
||||||
|
|
||||||
<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js"/>
|
<script type="application/x-javascript" src="chrome://global/content/nsUserSettings.js"/>
|
||||||
<script type="application/x-javascript" src="chrome://global/content/nsJSComponentManager.js"/>
|
<script type="application/x-javascript" src="chrome://global/content/nsJSComponentManager.js"/>
|
||||||
|
|
|
@ -284,6 +284,16 @@ function panel_loader() {
|
||||||
this.removeAttribute('collapsed');
|
this.removeAttribute('collapsed');
|
||||||
this.setAttribute('loadstate','loaded');
|
this.setAttribute('loadstate','loaded');
|
||||||
this.parentNode.firstChild.setAttribute('hidden','true');
|
this.parentNode.firstChild.setAttribute('hidden','true');
|
||||||
|
|
||||||
|
if (this.hasAttribute('focusOnLoad')) {
|
||||||
|
var elementToFocus = this.contentDocument.documentElement.getAttribute('elementtofocus');
|
||||||
|
if (elementToFocus) {
|
||||||
|
var element = this.contentDocument.getElementById(elementToFocus);
|
||||||
|
if (element)
|
||||||
|
element.focus();
|
||||||
|
}
|
||||||
|
this.removeAttribute('focusOnLoad');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sbPanelList.prototype.update =
|
sbPanelList.prototype.update =
|
||||||
function (force_reload)
|
function (force_reload)
|
||||||
|
@ -956,6 +966,8 @@ function SidebarSelectPanel(header, should_popopen, should_unhide) {
|
||||||
}
|
}
|
||||||
if (unhide) SidebarShowHide();
|
if (unhide) SidebarShowHide();
|
||||||
if (popopen) SidebarExpandCollapse();
|
if (popopen) SidebarExpandCollapse();
|
||||||
|
|
||||||
|
panel.get_iframe().setAttribute('focusOnLoad', true);
|
||||||
if (!panel.is_selected()) panel.select(false);
|
if (!panel.is_selected()) panel.select(false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче