Bug 495675 - 500 ms delay when holding mouse down on folders on bookmarks toolbar before they open, r=dietrich
authorMarco Bonardo <mbonardo@mozilla.com>
Thu, 25 Jun 2009 00:15:25 +0200
changeset 29558 f0bc66c3f14f734cce647bfa7aafad25ce5c97c9
parent 29557 5f14dd5ec14aa408b5d8a19e3f3d5f49ac84280e
child 29559 113c5916881f46681532a917f72ec18ec0bed7fc
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)
reviewersdietrich
bugs495675
milestone1.9.2a1pre
Bug 495675 - 500 ms delay when holding mouse down on folders on bookmarks toolbar before they open, r=dietrich
browser/components/places/content/toolbar.xml
--- a/browser/components/places/content/toolbar.xml
+++ b/browser/components/places/content/toolbar.xml
@@ -124,18 +124,20 @@
         }
         ]]></body>
       </method>
 
       <field name="_dropIndicatorBar">document.getAnonymousElementByAttribute(this, "class", "toolbar-drop-indicator-bar")</field>
       <field name="_chevron">document.getAnonymousElementByAttribute(this, "class", "chevron")</field>
 
       <field name="_openedMenuButton">null</field>
+      <field name="_allowPopupShowing">true</field>
 
       <field name="_result">null</field>
+      <field name="_resultNode">null</field>
 
       <!-- nsIPlacesView -->
       <method name="getResult">
         <body><![CDATA[
           return this._result;
         ]]></body>
       </method>
 
@@ -554,17 +556,17 @@
             var chevronPopup = this._self._chevron.firstChild;
             for (var i = 0; i < children.length; i++) {
               var button = children[i];
               if (button.node == aItem) {
                 this._self.removeChild(button);
                 this._self.insertBefore(button, children[aNewIndex]);
                 if (chevronPopup) {
                   // Maintain chevron in sync
-                  menuitem = chevronPopup.childNodes[i];
+                  var menuitem = chevronPopup.childNodes[i];
                   chevronPopup.removeChild(menuitem);
                   chevronPopup.insertBefore(menuitem,
                                             chevronPopup.childNodes[aNewIndex]);
                 }
                 this._self.updateChevron();
                 return;
               }
             }
@@ -945,17 +947,17 @@
       <!-- nsITimerCallback -->
       <method name="notify">
         <parameter name="aTimer"/>
         <body><![CDATA[
           // Function to process all timer notifications.
 
           // * Timer to turn off indicator bar.
           if (aTimer == this._ibTimer) {
-            ib = this._dropIndicatorBar.removeAttribute('dragging');
+            this._dropIndicatorBar.removeAttribute('dragging');
             this._ibTimer = null;
           }
 
           // * Timer to open a menubutton that's being dragged over.
           if (aTimer == this._overFolder.openTimer) {
             // Set the autoopen attribute on the folder's menupopup so that
             // the menu will automatically close when the mouse drags off of it.
             this._overFolder.node.lastChild.setAttribute("autoopened", "true");
@@ -1190,44 +1192,44 @@
           // Clear the dragover attribute if present, if we are dragging into a
           // folder in the hierachy of current opened popup we don't clear
           // this attribute on clearOverFolder.  See Notify for closeTimer.
           if (parent.hasAttribute("dragover"))
             parent.removeAttribute("dragover");
         }
       ]]></handler>
 
+#ifdef XP_UNIX
+#ifndef XP_MACOSX
       <handler event="mousedown"><![CDATA[
         var target = event.target;
         if (event.button == 0 &&
             target.localName == "toolbarbutton" &&
             target.getAttribute("type") == "menu") {
           this._allowPopupShowing = false;
-          // This is a container, we will open the menu if the user clicks
-          // or drag toward down or after a delay
+          // On Linux we can open the popup only after a delay.
+          // Indeed as soon as the menupopup opens we are unable to start a
+          // drag event.  See bug 500081 for details.
           this._mouseDownTimer = Cc["@mozilla.org/timer;1"]
                                    .createInstance(Ci.nsITimer);
           var callback = {
             _self: this,
 		        _target: target,
 		        notify: function(timer) {
               this._target.open = true;
               this._self._mouseDownTimer = null;
             }
           };
 
-          this._mouseDownTimer.initWithCallback(callback, 500,
+          this._mouseDownTimer.initWithCallback(callback, 300,
                                                 Ci.nsITimer.TYPE_ONE_SHOT);
         }
-        else {
-          // allow opening popups, like the chevron and context menus
-          this._allowPopupShowing = true;
-        }
       ]]></handler>
-
+#endif
+#endif
       <handler event="mouseup"><![CDATA[
         if (event.button != 0)
           return;
 
         if (this._mouseDownTimer) {
           // On a click (down/up) we should open the menu popup
           this._mouseDownTimer.cancel();
           this._mouseDownTimer = null;