Bug 574702: avoid initializing WindowDraggingUtils multiple times due to binding re-attachment (causes dragging jumpiness issues), r=enndeakin
authorFelipe Gomes <felipc@gmail.com>
Fri, 25 Jun 2010 16:06:36 -0400
changeset 46244 8790aa3006fce695816157907406ce5588e15288
parent 46243 619563f026f52daf53443e376f1155c9be23d94f
child 46245 549c24723dde1f07a76179ad95e05389ccd69c9c
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenndeakin
bugs574702
milestone1.9.3a6pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 574702: avoid initializing WindowDraggingUtils multiple times due to binding re-attachment (causes dragging jumpiness issues), r=enndeakin
toolkit/content/widgets/general.xml
toolkit/content/widgets/toolbar.xml
--- a/toolkit/content/widgets/general.xml
+++ b/toolkit/content/widgets/general.xml
@@ -156,20 +156,23 @@
       </property>
     </implementation>
   </binding>
   
   <binding id="statusbar-drag"
            extends="chrome://global/content/bindings/general.xml#statusbar">
     <implementation>
       <constructor>
-        try {
-          Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm");
-          new WindowDraggingElement(this, window);
-        } catch (e) {}
+        if (!this._draggableStarted) {
+          this._draggableStarted = true;
+          try {
+            Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm");
+            new WindowDraggingElement(this, window);
+          } catch (e) {}
+        }
       </constructor>
     </implementation>
   </binding>
 
   <binding id="statusbarpanel-iconic" display="xul:button"
            extends="chrome://global/content/bindings/general.xml#statusbarpanel">
     <content>
       <xul:image class="statusbarpanel-icon" xbl:inherits="src,src=image"/>
@@ -257,17 +260,20 @@
         </getter>
       </property>
     </implementation>
   </binding>
 
   <binding id="windowdragbox">
     <implementation>
       <constructor>
-        try {
-          Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm");
-          new WindowDraggingElement(this, window);
-        } catch (e) {}
+        if (!this._draggableStarted) {
+          this._draggableStarted = true;
+          try {
+            Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm");
+            new WindowDraggingElement(this, window);
+          } catch (e) {}
+        }
       </constructor>
     </implementation>
   </binding>
 
 </bindings>
--- a/toolkit/content/widgets/toolbar.xml
+++ b/toolkit/content/widgets/toolbar.xml
@@ -436,24 +436,27 @@
       ]]></handler>
     </handlers>
   </binding>
 
   <binding id="toolbar-drag"
            extends="chrome://global/content/bindings/toolbar.xml#toolbar">
     <implementation>
       <constructor><![CDATA[
-        try {
-          Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm");
-          let draggableThis = new WindowDraggingElement(this, window);
-          draggableThis.mouseDownCheck = function(e) {
-            // Don't move while customizing or while in full screen mode.
-            return !this.parentNode.customizing && !window.fullScreen;
-          }
-        } catch (e) {}
+        if (!this._draggableStarted) {
+          this._draggableStarted = true;
+          try {
+            Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm");
+            let draggableThis = new WindowDraggingElement(this, window);
+            draggableThis.mouseDownCheck = function(e) {
+              // Don't move while customizing or while in full screen mode.
+              return !this.parentNode.customizing && !window.fullScreen;
+            }
+          } catch (e) {}
+        }
       ]]></constructor>
     </implementation>
   </binding>
 
   <binding id="menubar" extends="chrome://global/content/bindings/toolbar.xml#toolbar-base" display="xul:menubar">
     <implementation implements="nsIAccessibleProvider">
       <property name="accessibleType" readonly="true">
         <getter>