Bug 1219215 - part 1: remove window-drag bindings and other callers of WindowDraggingUtils, replace with using window-dragging region everywhere, r=dao,felipe

This commit is contained in:
Gijs Kruitbosch 2016-01-18 15:32:14 +00:00
parent 38ead8f191
commit 897e0c501a
6 changed files with 22 additions and 51 deletions

View File

@ -212,21 +212,6 @@ var TabsInTitlebar = {
}
this._sizePlaceholder("caption-buttons", captionButtonsBoxWidth);
if (!this._draghandles) {
this._draghandles = {};
let tmp = {};
Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm", tmp);
let mouseDownCheck = function () {
return !this._dragBindingAlive && TabsInTitlebar.enabled;
};
this._draghandles.tabsToolbar = new tmp.WindowDraggingElement(tabsToolbar);
this._draghandles.tabsToolbar.mouseDownCheck = mouseDownCheck;
this._draghandles.navToolbox = new tmp.WindowDraggingElement(gNavToolbox);
this._draghandles.navToolbox.mouseDownCheck = mouseDownCheck;
}
} else {
document.documentElement.removeAttribute("tabsintitlebar");
updateTitlebarDisplay();

View File

@ -72,10 +72,6 @@ toolbar[customizable="true"] {
#toolbar-menubar {
-moz-binding: url("chrome://browser/content/customizableui/toolbar.xml#toolbar-menubar-stub");
}
toolbar[customizable="true"]:not([nowindowdrag="true"]) {
-moz-binding: url("chrome://browser/content/customizableui/toolbar.xml#toolbar-drag");
}
%endif
#toolbar-menubar[autohide="true"] {
@ -227,10 +223,7 @@ toolbar[customizing] > .overflow-button {
#titlebar {
-moz-binding: url("chrome://global/content/bindings/general.xml#windowdragbox");
%ifdef XP_MACOSX
-moz-window-dragging: drag;
%endif
}
#titlebar-spacer {
@ -297,6 +290,11 @@ toolbar[customizing] > .overflow-button {
display: none !important;
}
#main-window[tabsintitlebar] #TabsToolbar,
#main-window[tabsintitlebar] #toolbar-menubar:not([autohide=true]),
#main-window[tabsintitlebar] #navigator-toolbox > toolbar:not(#toolbar-menubar):-moz-lwtheme {
-moz-window-dragging: drag;
}
%endif
%endif
@ -359,6 +357,16 @@ toolbar:not(#TabsToolbar) > #personal-bookmarks {
-moz-box-flex: 1;
}
/* Ensure that empty parts of the bookmarks container can be dragged on OSX, and on other OSes
* only when a lwtheme is in use. */
%ifdef XP_MACOSX
#PlacesToolbarItems {
%else
#main-window[tabsintitlebar] #PlacesToolbarItems:-moz-lwtheme {
%endif
-moz-window-dragging: drag;
}
#zoom-controls[cui-areatype="toolbar"]:not([overflowedItem=true]) > #zoom-reset-button > .toolbarbutton-text {
display: -moz-box;
}

View File

@ -368,13 +368,6 @@
padding-right: 1px;
}
/* Make the window draggable by glassed toolbars (bug 555081) */
#toolbar-menubar:not([autohide="true"]),
#TabsToolbar,
#navigator-toolbox > toolbar:not(#toolbar-menubar):not(#addon-bar):-moz-lwtheme {
-moz-binding: url("chrome://browser/content/customizableui/toolbar.xml#toolbar-drag");
}
#appcontent:not(:-moz-lwtheme) {
background-color: -moz-dialog;
}
@ -471,11 +464,6 @@
background-color: rgb(215,228,242);
}
#toolbar-menubar:not([autohide=true]):not(:-moz-lwtheme),
#TabsToolbar:not(:-moz-lwtheme) {
-moz-binding: url("chrome://browser/content/customizableui/toolbar.xml#toolbar-drag");
}
/* Render a window top border for lwthemes: */
#main-window[tabsintitlebar][sizemode="normal"] > #tab-view-deck > #browser-panel:-moz-lwtheme {
background-image: linear-gradient(to bottom,

View File

@ -101,10 +101,6 @@
margin-top: var(--space-above-tabbar);
}
#toolbar-menubar:not([autohide="true"]) {
-moz-binding: url("chrome://browser/content/customizableui/toolbar.xml#toolbar-drag");
}
#main-window[customize-entered][tabsintitlebar]:not([inFullscreen]) #toolbar-menubar[customizing-dragovertarget].customization-target::before,
#main-window[customize-entered][tabsintitlebar]:not([inFullscreen]) #TabsToolbar[customizing-dragovertarget].customization-target::before,
#main-window[customize-entered][tabsintitlebar]:not([inFullscreen]) #toolbar-menubar.customization-target:hover::before,

View File

@ -255,15 +255,16 @@ caption {
titlebar,
toolbar:not([nowindowdrag="true"]):not([customizing="true"]),
statusbar:not([nowindowdrag="true"]),
%endif
windowdragbox {
-moz-window-dragging: drag;
}
/* The list below is non-comprehensive and will probably need some tweaking. */
toolbaritem,
toolbarbutton,
button,
textbox,
searchbar,
tab,
radio,
splitter,
@ -271,7 +272,6 @@ scale,
menulist {
-moz-window-dragging: no-drag;
}
%endif
/******* toolbar *******/

View File

@ -4,17 +4,17 @@
Components.utils.import("resource://gre/modules/AppConstants.jsm");
const USE_HITTEST = /^(win|macosx)/i.test(AppConstants.platform);
const HAVE_CSS_WINDOW_DRAG_SUPPORT = ["win", "macosx"].includes(AppConstants.platform);
this.EXPORTED_SYMBOLS = [ "WindowDraggingElement" ];
this.WindowDraggingElement = function WindowDraggingElement(elem) {
this._elem = elem;
this._window = elem.ownerDocument.defaultView;
if (HAVE_CSS_WINDOW_DRAG_SUPPORT && !this.isPanel()) {
return;
}
if (USE_HITTEST && !this.isPanel())
this._elem.addEventListener("MozMouseHittest", this, false);
else
this._elem.addEventListener("mousedown", this, false);
};
@ -57,12 +57,6 @@ WindowDraggingElement.prototype = {
},
handleEvent: function(aEvent) {
let isPanel = this.isPanel();
if (USE_HITTEST && !isPanel) {
if (this.shouldDrag(aEvent))
aEvent.preventDefault();
return;
}
switch (aEvent.type) {
case "mousedown":
if (!this.shouldDrag(aEvent))