зеркало из https://github.com/mozilla/pjs.git
Bug 575248. Double-click on tab bar should behave according to theme and tab positioning. r=dao,jmathies
This commit is contained in:
Родитель
0ffdbbfdfd
Коммит
cc95309be8
|
@ -5093,6 +5093,10 @@ var TabsInTitlebar = {
|
|||
#endif
|
||||
},
|
||||
|
||||
get enabled() {
|
||||
return document.documentElement.getAttribute("tabsintitlebar") == "true";
|
||||
},
|
||||
|
||||
#ifdef CAN_DRAW_IN_TITLEBAR
|
||||
observe: function (subject, topic, data) {
|
||||
if (topic == "nsPref:changed")
|
||||
|
@ -5118,8 +5122,7 @@ var TabsInTitlebar = {
|
|||
break;
|
||||
}
|
||||
|
||||
let docElement = document.documentElement;
|
||||
if (allowed == (docElement.getAttribute("tabsintitlebar") == "true"))
|
||||
if (allowed == this.enabled)
|
||||
return;
|
||||
|
||||
function $(id) document.getElementById(id);
|
||||
|
@ -5140,20 +5143,18 @@ var TabsInTitlebar = {
|
|||
titlebar.style.marginBottom = - Math.min(tabsToolbarRect.top - titlebarTop,
|
||||
tabsToolbarRect.height) + "px";
|
||||
|
||||
docElement.setAttribute("tabsintitlebar", "true");
|
||||
document.documentElement.setAttribute("tabsintitlebar", "true");
|
||||
|
||||
if (!this._draghandle) {
|
||||
let tmp = {};
|
||||
Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm", tmp);
|
||||
this._draghandle = new tmp.WindowDraggingElement(tabsToolbar, window);
|
||||
this._draghandle.mouseDownCheck = function () {
|
||||
return !this._dragBindingAlive &&
|
||||
this.ownerDocument.documentElement
|
||||
.getAttribute("tabsintitlebar") == "true";
|
||||
return !this._dragBindingAlive && TabsInTitlebar.enabled;
|
||||
};
|
||||
}
|
||||
} else {
|
||||
docElement.removeAttribute("tabsintitlebar");
|
||||
document.documentElement.removeAttribute("tabsintitlebar");
|
||||
|
||||
titlebar.style.marginBottom = "";
|
||||
}
|
||||
|
|
|
@ -3203,19 +3203,24 @@
|
|||
]]></handler>
|
||||
|
||||
<handler event="dblclick"><![CDATA[
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
// Disable this on GTK2 when the menubar is draggable, since (a)
|
||||
// the menubar and tabbbar have unified appearance and should
|
||||
// thus not have different behavior (though this condition alone
|
||||
// applies to more cases) and (b) it interacts badly with the
|
||||
// drag handling that we use for dragging either one.
|
||||
if (this.parentNode._dragBindingAlive)
|
||||
#ifndef XP_MACOSX
|
||||
// When the tabbar has an unified appearance with the titlebar
|
||||
// and menubar, a double-click in it should have the same behavior
|
||||
// as double-clicking the titlebar
|
||||
if (TabsInTitlebar.enabled ||
|
||||
(TabsOnTop.enabled && this.parentNode._dragBindingAlive))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (event.button != 0 ||
|
||||
event.originalTarget.localName != "box")
|
||||
return;
|
||||
|
||||
// See hack note in the tabbrowser-close-tab-button binding
|
||||
if (!this._blockDblClick && event.button == 0 &&
|
||||
event.originalTarget.localName == "box")
|
||||
if (!this._blockDblClick)
|
||||
BrowserOpenTab();
|
||||
|
||||
event.preventDefault();
|
||||
]]></handler>
|
||||
|
||||
<handler event="click"><![CDATA[
|
||||
|
|
|
@ -5072,6 +5072,17 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
|||
}
|
||||
break;
|
||||
|
||||
case WM_NCLBUTTONDBLCLK:
|
||||
DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, 0, lParamToClient(lParam),
|
||||
PR_FALSE, nsMouseEvent::eLeftButton,
|
||||
MOUSE_INPUT_SOURCE());
|
||||
result =
|
||||
DispatchMouseEvent(NS_MOUSE_BUTTON_UP, 0, lParamToClient(lParam),
|
||||
PR_FALSE, nsMouseEvent::eLeftButton,
|
||||
MOUSE_INPUT_SOURCE());
|
||||
DispatchPendingEvents();
|
||||
break;
|
||||
|
||||
case WM_APPCOMMAND:
|
||||
{
|
||||
PRUint32 appCommand = GET_APPCOMMAND_LPARAM(lParam);
|
||||
|
|
Загрузка…
Ссылка в новой задаче