Bug 1442961 - Remove the windowdragbox element and binding. r?jaws draft
authorDão Gottwald <dao@mozilla.com>
Mon, 05 Mar 2018 14:54:03 +0100
changeset 763126 efb167583c8b917c07d5e5d6f90a4ae6ee1debc1
parent 763109 51200c0fdaddb2749549a82596da5323a4cbd499
push id101352
push userdgottwald@mozilla.com
push dateMon, 05 Mar 2018 13:54:30 +0000
reviewersjaws
bugs1442961
milestone60.0a1
Bug 1442961 - Remove the windowdragbox element and binding. r?jaws MozReview-Commit-ID: JZVMty8qMCP
browser/base/content/browser.css
browser/base/content/browser.js
browser/base/content/pageinfo/pageInfo.xul
browser/themes/osx/pageInfo.css
browser/themes/windows/browser.css
browser/themes/windows/pageInfo.css
toolkit/content/widgets/general.xml
toolkit/content/xul.css
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -286,17 +286,16 @@ window:not([chromehidden~="toolbar"]) #n
 #main-window:not([chromemargin]) > #titlebar,
 #main-window[inFullscreen] > #titlebar,
 #main-window[inFullscreen] .titlebar-placeholder,
 #main-window:not([tabsintitlebar]) .titlebar-placeholder {
   display: none;
 }
 
 #titlebar {
-  -moz-binding: url("chrome://global/content/bindings/general.xml#windowdragbox");
   -moz-window-dragging: drag;
 }
 
 #titlebar-spacer {
   pointer-events: none;
 }
 
 #main-window[tabsintitlebar] #titlebar-buttonbox {
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1382,19 +1382,18 @@ var gBrowserInit = {
   },
 
   _cancelDelayedStartup() {
     window.removeEventListener("MozAfterPaint", this._boundDelayedStartup);
     this._boundDelayedStartup = null;
   },
 
   _delayedStartup() {
-    let tmp = {};
-    ChromeUtils.import("resource://gre/modules/TelemetryTimestamps.jsm", tmp);
-    let TelemetryTimestamps = tmp.TelemetryTimestamps;
+    let { TelemetryTimestamps } =
+      ChromeUtils.import("resource://gre/modules/TelemetryTimestamps.jsm", {});
     TelemetryTimestamps.add("delayedStartupStarted");
 
     this._cancelDelayedStartup();
 
     // We need to set the OfflineApps message listeners up before we
     // load homepages, which might need them.
     OfflineApps.init();
 
@@ -1539,16 +1538,22 @@ var gBrowserInit = {
     });
 
     window.addEventListener("mousemove", MousePosTracker);
     window.addEventListener("dragover", MousePosTracker);
 
     gNavToolbox.addEventListener("customizationstarting", CustomizationHandler);
     gNavToolbox.addEventListener("customizationending", CustomizationHandler);
 
+    if (AppConstants.platform == "linux") {
+      let { WindowDraggingElement } =
+        ChromeUtils.import("resource://gre/modules/WindowDraggingUtils.jsm", {});
+      new WindowDraggingElement(document.getElementById("titlebar"));
+    }
+
     SessionStore.promiseInitialized.then(() => {
       // Bail out if the window has been closed in the meantime.
       if (window.closed) {
         return;
       }
 
       // Enable the Restore Last Session command if needed
       RestoreLastSessionObserver.init();
--- a/browser/base/content/pageinfo/pageInfo.xul
+++ b/browser/base/content/pageinfo/pageInfo.xul
@@ -64,30 +64,30 @@
     <key key="&selectall.key;"   modifiers="alt"   command="cmd_selectall"/>
   </keyset>
 
   <menupopup id="picontext">
     <menuitem id="menu_selectall" label="&selectall.label;" command="cmd_selectall" accesskey="&selectall.accesskey;"/>
     <menuitem id="menu_copy"      label="&copy.label;"      command="cmd_copy"      accesskey="&copy.accesskey;"/>
   </menupopup>
 
-  <windowdragbox id="topBar" class="viewGroupWrapper">
+  <vbox id="topBar">
     <radiogroup id="viewGroup" class="chromeclass-toolbar" orient="horizontal">
       <radio id="generalTab"  label="&generalTab;"  accesskey="&generalTab.accesskey;"
            oncommand="showTab('general');"/>
       <radio id="mediaTab"    label="&mediaTab;"    accesskey="&mediaTab.accesskey;"
            oncommand="showTab('media');" hidden="true"/>
       <radio id="feedTab"     label="&feedTab;"     accesskey="&feedTab.accesskey;"
            oncommand="showTab('feed');" hidden="true"/>
       <radio id="permTab"     label="&permTab;"     accesskey="&permTab.accesskey;"
            oncommand="showTab('perm');"/>
       <radio id="securityTab" label="&securityTab;" accesskey="&securityTab.accesskey;"
            oncommand="showTab('security');"/>
     </radiogroup>
-  </windowdragbox>
+  </vbox>
 
   <deck id="mainDeck" flex="1">
     <!-- General page information -->
     <vbox id="generalPanel">
       <grid id="generalGrid">
         <columns>
           <column/>
           <column class="gridSeparator"/>
--- a/browser/themes/osx/pageInfo.css
+++ b/browser/themes/osx/pageInfo.css
@@ -3,19 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 @import "chrome://global/skin/";
 
 %include shared.inc
 
 #topBar {
   -moz-appearance: toolbar;
-}
-
-.viewGroupWrapper {
+  -moz-window-dragging: drag;
   -moz-box-align: center;
   -moz-box-pack: center;
 }
 
 #viewGroup {
   margin: 4px 0 9px;
 }
 
--- a/browser/themes/windows/browser.css
+++ b/browser/themes/windows/browser.css
@@ -180,18 +180,18 @@
 }
 
 @media (-moz-windows-compositor: 0) {
   #main-window[tabsintitlebar] #titlebar:-moz-lwtheme {
     visibility: hidden;
   }
 
   #main-window[tabsintitlebar] #titlebar-content:-moz-lwtheme {
-    -moz-binding: url("chrome://global/content/bindings/general.xml#windowdragbox");
     visibility: visible;
+    -moz-window-dragging: drag;
   }
 
   /* Top-level menu appearance has transparent background, so the text color
      needs to be inherited from our custom menubar too. */
   #main-window[tabsintitlebar] #main-menubar > menu:not(:-moz-lwtheme) {
     color: inherit;
   }
 }
--- a/browser/themes/windows/pageInfo.css
+++ b/browser/themes/windows/pageInfo.css
@@ -1,14 +1,22 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 @import "chrome://global/skin/";
 
+#topBar {
+  -moz-window-dragging: drag;
+  border-bottom: 1px solid ThreeDLightShadow;
+  padding-inline-start: 10px;
+  background-color: -moz-Field;
+  color: -moz-FieldText;
+}
+
 /* View buttons */
 #viewGroup {
   padding-inline-start: 10px;
 }
 
 #viewGroup > radio {
   list-style-image: url("chrome://browser/skin/pageInfo.png");
   -moz-appearance: none;
@@ -27,23 +35,16 @@
   color: black;
 }
 
 #viewGroup > radio > .radio-label-box {
   margin: 0;
   padding: 0 6px;
 }
 
-#topBar {
-  border-bottom: 1px solid ThreeDLightShadow;
-  padding-inline-start: 10px;
-  background-color: -moz-Field;
-  color: -moz-FieldText;
-}
-
 #generalTab {
   -moz-image-region: rect(0px, 32px, 32px, 0px)
 }
 
 #generalTab:hover,
 #generalTab[selected="true"] {
   -moz-image-region: rect(32px, 32px, 64px, 0px)
 }
--- a/toolkit/content/widgets/general.xml
+++ b/toolkit/content/widgets/general.xml
@@ -118,28 +118,9 @@
       <stylesheet src="chrome://global/skin/dropmarker.css"/>
     </resources>
 
     <content>
       <xul:image class="dropmarker-icon"/>
     </content>
   </binding>
 
-  <binding id="windowdragbox">
-    <implementation>
-      <field name="_dragBindingAlive">true</field>
-      <constructor>
-        if (!this._draggableStarted) {
-          this._draggableStarted = true;
-          try {
-            let tmp = {};
-            ChromeUtils.import("resource://gre/modules/WindowDraggingUtils.jsm", tmp);
-            let draghandle = new tmp.WindowDraggingElement(this);
-            draghandle.mouseDownCheck = function() {
-              return this._dragBindingAlive;
-            };
-          } catch (e) {}
-        }
-      </constructor>
-    </implementation>
-  </binding>
-
 </bindings>
--- a/toolkit/content/xul.css
+++ b/toolkit/content/xul.css
@@ -250,21 +250,20 @@ caption {
   -moz-box-align: inherit;
   -moz-box-orient: vertical;
 }
 
 /******** draggable elements *********/
 
 %ifndef MOZ_WIDGET_GTK
 titlebar,
-toolbar:not([nowindowdrag="true"]):not([customizing="true"]),
-%endif
-windowdragbox {
+toolbar:not([nowindowdrag="true"]):not([customizing="true"]) {
   -moz-window-dragging: drag;
 }
+%endif
 
 /* The list below is non-comprehensive and will probably need some tweaking. */
 toolbaritem,
 toolbarbutton,
 toolbarseparator,
 button,
 textbox,
 tab,