зеркало из https://github.com/mozilla/pjs.git
Bug 120148 Tabs don't remember which element [frame, textfield, etc] was focused when switching tabs
patch by tryandguessit@yahoo.com r=caillon sr=bryner
This commit is contained in:
Родитель
5571870865
Коммит
b693cafc7a
|
@ -305,6 +305,14 @@
|
|||
null
|
||||
</field>
|
||||
|
||||
<field name="focusedWindow">
|
||||
null
|
||||
</field>
|
||||
|
||||
<field name="focusedElement">
|
||||
null
|
||||
</field>
|
||||
|
||||
<property name="userTypedValue"
|
||||
onget="return this._userTypedValue;"
|
||||
onset="this.userTypedClear = false; return this._userTypedValue = val;"/>
|
||||
|
|
|
@ -302,8 +302,10 @@
|
|||
|
||||
if (next && next != startTab) {
|
||||
this.selectedItem = next;
|
||||
next.focus();
|
||||
document.commandDispatcher.advanceFocusIntoSubtree(next);
|
||||
if (this.getAttribute("setfocus") != "false") {
|
||||
next.focus();
|
||||
document.commandDispatcher.advanceFocusIntoSubtree(next);
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
|
||||
<xul:tabs class="tabbrowser-tabs" closebutton="true" flex="1"
|
||||
tooltiptextnew="&newTabButton.tooltip;"
|
||||
setfocus="false"
|
||||
onclick="this.parentNode.parentNode.parentNode.onTabClick(event);"
|
||||
onmousedown="this.parentNode.parentNode.parentNode.updateContextTab(event);"
|
||||
ondragover="nsDragAndDrop.dragOver(event, this.parentNode.parentNode.parentNode);
|
||||
|
@ -500,8 +501,11 @@
|
|||
<body>
|
||||
<![CDATA[
|
||||
var newBrowser = this.mPanelContainer.childNodes[this.mPanelContainer.selectedIndex];
|
||||
if (this.mCurrentBrowser)
|
||||
if (this.mCurrentBrowser) {
|
||||
this.mCurrentBrowser.focusedWindow = document.commandDispatcher.focusedWindow;
|
||||
this.mCurrentBrowser.focusedElement = document.commandDispatcher.focusedElement;
|
||||
this.mCurrentBrowser.setAttribute("type", "content");
|
||||
}
|
||||
|
||||
newBrowser.setAttribute("type", "content-primary");
|
||||
this.mCurrentBrowser = newBrowser;
|
||||
|
@ -558,8 +562,22 @@
|
|||
}
|
||||
}
|
||||
|
||||
// Focus our new content area.
|
||||
setTimeout("window._content.focus()", 0);
|
||||
function setFocus(element) {
|
||||
Components.lookupMethod(element, "focus").call(element);
|
||||
}
|
||||
|
||||
// Focus the previously focused element or window
|
||||
if (newBrowser.focusedElement) {
|
||||
try {
|
||||
setFocus(newBrowser.focusedElement);
|
||||
} catch (e) {
|
||||
setFocus(newBrowser.focusedWindow);
|
||||
}
|
||||
}
|
||||
else if (newBrowser.focusedWindow)
|
||||
setFocus(newBrowser.focusedWindow);
|
||||
else // new tab, focus our new content area
|
||||
setTimeout(setFocus, 0, window.content);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
|
Загрузка…
Ссылка в новой задаче