зеркало из 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
|
null
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
|
<field name="focusedWindow">
|
||||||
|
null
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field name="focusedElement">
|
||||||
|
null
|
||||||
|
</field>
|
||||||
|
|
||||||
<property name="userTypedValue"
|
<property name="userTypedValue"
|
||||||
onget="return this._userTypedValue;"
|
onget="return this._userTypedValue;"
|
||||||
onset="this.userTypedClear = false; return this._userTypedValue = val;"/>
|
onset="this.userTypedClear = false; return this._userTypedValue = val;"/>
|
||||||
|
|
|
@ -302,8 +302,10 @@
|
||||||
|
|
||||||
if (next && next != startTab) {
|
if (next && next != startTab) {
|
||||||
this.selectedItem = next;
|
this.selectedItem = next;
|
||||||
next.focus();
|
if (this.getAttribute("setfocus") != "false") {
|
||||||
document.commandDispatcher.advanceFocusIntoSubtree(next);
|
next.focus();
|
||||||
|
document.commandDispatcher.advanceFocusIntoSubtree(next);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]]>
|
]]>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -82,6 +82,7 @@
|
||||||
|
|
||||||
<xul:tabs class="tabbrowser-tabs" closebutton="true" flex="1"
|
<xul:tabs class="tabbrowser-tabs" closebutton="true" flex="1"
|
||||||
tooltiptextnew="&newTabButton.tooltip;"
|
tooltiptextnew="&newTabButton.tooltip;"
|
||||||
|
setfocus="false"
|
||||||
onclick="this.parentNode.parentNode.parentNode.onTabClick(event);"
|
onclick="this.parentNode.parentNode.parentNode.onTabClick(event);"
|
||||||
onmousedown="this.parentNode.parentNode.parentNode.updateContextTab(event);"
|
onmousedown="this.parentNode.parentNode.parentNode.updateContextTab(event);"
|
||||||
ondragover="nsDragAndDrop.dragOver(event, this.parentNode.parentNode.parentNode);
|
ondragover="nsDragAndDrop.dragOver(event, this.parentNode.parentNode.parentNode);
|
||||||
|
@ -500,8 +501,11 @@
|
||||||
<body>
|
<body>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
var newBrowser = this.mPanelContainer.childNodes[this.mPanelContainer.selectedIndex];
|
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");
|
this.mCurrentBrowser.setAttribute("type", "content");
|
||||||
|
}
|
||||||
|
|
||||||
newBrowser.setAttribute("type", "content-primary");
|
newBrowser.setAttribute("type", "content-primary");
|
||||||
this.mCurrentBrowser = newBrowser;
|
this.mCurrentBrowser = newBrowser;
|
||||||
|
@ -558,8 +562,22 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Focus our new content area.
|
function setFocus(element) {
|
||||||
setTimeout("window._content.focus()", 0);
|
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>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче