Backed out changeset 09714c24277b (bug 940292)
authorMike Conley <mconley@mozilla.com>
Sat, 07 Dec 2013 13:11:02 -0500
changeset 174929 e80b374896cc154fe1aba659cd118a665ac30f0f
parent 174928 a69b97c58e0fa61713447378548e79c1d53df07c
child 174930 3a79902737827be0389239a2ba269bb41b50b9f6
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs940292
milestone28.0a1
backs out09714c24277b8b5d0c9d63f262b7d2744d4769ff
Backed out changeset 09714c24277b (bug 940292)
browser/base/content/browser-places.js
browser/components/places/content/browserPlacesViews.js
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -864,51 +864,48 @@ var PlacesMenuDNDHandler = {
  */
 let PlacesToolbarHelper = {
   _place: "place:folder=TOOLBAR",
 
   get _viewElt() {
     return document.getElementById("PlacesToolbar");
   },
 
-  init: function PTH_init(forceToolbarOverflowCheck) {
+  init: function PTH_init() {
     let viewElt = this._viewElt;
     if (!viewElt || viewElt._placesView)
       return;
 
     // If the bookmarks toolbar item is:
     // - not in a toolbar, or;
     // - the toolbar is collapsed, or;
     // - the toolbar is hidden some other way:
     // don't initialize.  Also, there is no need to initialize the toolbar if
     // customizing, because that will happen when the customization is done.
     let toolbar = this._getParentToolbar(viewElt);
     if (!toolbar || toolbar.collapsed || this._isCustomizing ||
         getComputedStyle(toolbar, "").display == "none")
       return;
 
     new PlacesToolbar(this._place);
-    if (forceToolbarOverflowCheck) {
-      viewElt._placesView.updateOverflowStatus();
-    }
   },
 
   customizeStart: function PTH_customizeStart() {
     try {
       let viewElt = this._viewElt;
       if (viewElt && viewElt._placesView)
         viewElt._placesView.uninit();
     } finally {
       this._isCustomizing = true;
     }
   },
 
   customizeDone: function PTH_customizeDone() {
     this._isCustomizing = false;
-    this.init(true);
+    this.init();
   },
 
   onPlaceholderCommand: function () {
     let widgetGroup = CustomizableUI.getWidget("personal-bookmarks");
     let widget = widgetGroup.forWindow(window);
     if (widget.overflowed ||
         widgetGroup.areaType == CustomizableUI.TYPE_MENU_PANEL) {
       PlacesCommandHook.showPlacesOrganizer("BookmarksToolbar");
--- a/browser/components/places/content/browserPlacesViews.js
+++ b/browser/components/places/content/browserPlacesViews.js
@@ -1032,24 +1032,42 @@ PlacesToolbar.prototype = {
         break;
       case "resize":
         // This handler updates nodes visibility in both the toolbar
         // and the chevron popup when a window resize does not change
         // the overflow status of the toolbar.
         this.updateChevron();
         break;
       case "overflow":
-        if (!this._isOverflowStateEventRelevant(aEvent))
+        if (aEvent.target != aEvent.currentTarget)
+          return;
+
+        // Ignore purely vertical overflows.
+        if (aEvent.detail == 0)
           return;
-        this._onOverflow();
+
+        // Attach the popup binding to the chevron popup if it has not yet
+        // been initialized.
+        if (!this._chevronPopup.hasAttribute("type")) {
+          this._chevronPopup.setAttribute("place", this.place);
+          this._chevronPopup.setAttribute("type", "places");
+        }
+        this._chevron.collapsed = false;
+        this.updateChevron();
         break;
       case "underflow":
-        if (!this._isOverflowStateEventRelevant(aEvent))
+        if (aEvent.target != aEvent.currentTarget)
           return;
-        this._onUnderflow();
+
+        // Ignore purely vertical underflows.
+        if (aEvent.detail == 0)
+          return;
+
+        this.updateChevron();
+        this._chevron.collapsed = true;
         break;
       case "TabOpen":
       case "TabClose":
         this.updateChevron();
         break;
       case "dragstart":
         this._onDragStart(aEvent);
         break;
@@ -1080,45 +1098,16 @@ PlacesToolbar.prototype = {
       case "popuphidden":
         this._onPopupHidden(aEvent);
         break;
       default:
         throw "Trying to handle unexpected event.";
     }
   },
 
-  updateOverflowStatus: function() {
-    if (this._rootElt.scrollLeftMax > 0) {
-      this._onOverflow();
-    } else {
-      this._onUnderflow();
-    }
-  },
-
-  _isOverflowStateEventRelevant: function PT_isOverflowStateEventRelevant(aEvent) {
-    // Ignore events not aimed at ourselves, as well as purely vertical ones:
-    return aEvent.target == aEvent.currentTarget && aEvent.detail > 0;
-  },
-
-  _onOverflow: function PT_onOverflow() {
-    // Attach the popup binding to the chevron popup if it has not yet
-    // been initialized.
-    if (!this._chevronPopup.hasAttribute("type")) {
-      this._chevronPopup.setAttribute("place", this.place);
-      this._chevronPopup.setAttribute("type", "places");
-    }
-    this._chevron.collapsed = false;
-    this.updateChevron();
-  },
-
-  _onUnderflow: function PT_onUnderflow() {
-    this.updateChevron();
-    this._chevron.collapsed = true;
-  },
-
   updateChevron: function PT_updateChevron() {
     // If the chevron is collapsed there's nothing to update.
     if (this._chevron.collapsed)
       return;
 
     // Update the chevron on a timer.  This will avoid repeated work when
     // lot of changes happen in a small timeframe.
     if (this._updateChevronTimer)