Backed out changeset ecd61b92f9b3 (bug 1392081)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Tue, 05 Sep 2017 23:11:25 +0200
changeset 428542 294c5bf9ffea5c0110c88656bad9f55db89da1f1
parent 428541 db23967116ba47a873ea676192d40039a964b1aa
child 428543 aae17c1a570cdc89c1d97e748311d88181d9d69e
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1392081
milestone57.0a1
backs outecd61b92f9b3b033a253fd0a931161526dd8d085
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
Backed out changeset ecd61b92f9b3 (bug 1392081)
browser/components/places/content/browserPlacesViews.js
--- a/browser/components/places/content/browserPlacesViews.js
+++ b/browser/components/places/content/browserPlacesViews.js
@@ -1058,16 +1058,19 @@ PlacesToolbar.prototype = {
     let type = aChild.type;
     let button;
     if (type == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR) {
       button = document.createElement("toolbarseparator");
     } else {
       button = document.createElement("toolbarbutton");
       button.className = "bookmark-item";
       button.setAttribute("label", aChild.title || "");
+      let icon = aChild.icon;
+      if (icon)
+        button.setAttribute("image", icon);
 
       if (PlacesUtils.containerTypes.includes(type)) {
         button.setAttribute("type", "menu");
         button.setAttribute("container", "true");
 
         if (PlacesUtils.nodeIsQuery(aChild)) {
           button.setAttribute("query", "true");
           if (PlacesUtils.nodeIsTagQuery(aChild))
@@ -1233,83 +1236,66 @@ PlacesToolbar.prototype = {
       let child = this._rootElt.childNodes[i];
       // Once a child overflows, all the next ones will.
       if (!childOverflowed) {
         let childRect = child.getBoundingClientRect();
         childOverflowed = this.isRTL ? (childRect.left < scrollRect.left)
                                      : (childRect.right > scrollRect.right);
 
       }
-      if (childOverflowed) {
-        child.removeAttribute("image");
-        child.style.visibility = "hidden";
-      } else {
-        let icon = child._placesNode.icon;
-        if (icon)
-          child.setAttribute("image", icon);
-        child.style.visibility = "visible";
-      }
-
+      child.style.visibility = childOverflowed ? "hidden" : "visible";
     }
 
     // We rebuild the chevron on popupShowing, so if it is open
     // we must update it.
     if (this._chevron.open)
       this._updateChevronPopupNodesVisibility();
   },
 
   nodeInserted:
   function PT_nodeInserted(aParentPlacesNode, aPlacesNode, aIndex) {
     let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
-    if (parentElt == this._rootElt) { // Node is on the toolbar.
+    if (parentElt == this._rootElt) {
       let children = this._rootElt.childNodes;
-      let button = this._insertNewItem(aPlacesNode, this._rootElt,
-                                       children[aIndex] || null);
-      let prevSiblingOverflowed = aIndex > 0 && aIndex <= children.length &&
-                                  children[aIndex - 1].style.visibility == "hidden";
-      if (prevSiblingOverflowed) {
-        button.style.visibility = "hidden";
-      } else {
-        let icon = aPlacesNode.icon;
-        if (icon)
-          button.setAttribute("image", icon);
-        this.updateChevron();
-      }
+      this._insertNewItem(aPlacesNode, this._rootElt,
+        aIndex < children.length ? children[aIndex] : null);
+      this.updateChevron();
       return;
     }
 
     PlacesViewBase.prototype.nodeInserted.apply(this, arguments);
   },
 
   nodeRemoved:
   function PT_nodeRemoved(aParentPlacesNode, aPlacesNode, aIndex) {
     let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
     let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
 
     // Here we need the <menu>.
     if (elt.localName == "menupopup")
       elt = elt.parentNode;
 
-    if (parentElt == this._rootElt) { // Node is on the toolbar.
-      let overflowed = elt.style.visibility == "hidden";
+    if (parentElt == this._rootElt) {
       this._removeChild(elt);
-      if (!overflowed)
-        this.updateChevron();
+      this.updateChevron();
       return;
     }
 
     PlacesViewBase.prototype.nodeRemoved.apply(this, arguments);
   },
 
   nodeMoved:
   function PT_nodeMoved(aPlacesNode,
                         aOldParentPlacesNode, aOldIndex,
                         aNewParentPlacesNode, aNewIndex) {
     let parentElt = this._getDOMNodeForPlacesNode(aNewParentPlacesNode);
-    if (parentElt == this._rootElt) { // Node is on the toolbar.
+    if (parentElt == this._rootElt) {
+      // Container is on the toolbar.
+
+      // Move the element.
       let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
 
       // Here we need the <menu>.
       if (elt.localName == "menupopup")
         elt = elt.parentNode;
 
       this._removeChild(elt);
       this._rootElt.insertBefore(elt, this._rootElt.childNodes[aNewIndex]);
@@ -1333,17 +1319,19 @@ PlacesToolbar.prototype = {
     let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
     if (elt == this._rootElt)
       return;
 
     // We're notified for the menupopup, not the containing toolbarbutton.
     if (elt.localName == "menupopup")
       elt = elt.parentNode;
 
-    if (elt.parentNode == this._rootElt) { // Node is on the toolbar.
+    if (elt.parentNode == this._rootElt) {
+      // Node is on the toolbar.
+
       // All livemarks have a feedURI, so use it as our indicator.
       if (aAnno == PlacesUtils.LMANNO_FEEDURI) {
         elt.setAttribute("livemark", true);
 
         PlacesUtils.livemarks.getLivemark({ id: aPlacesNode.itemId })
           .then(aLivemark => {
             this.controller.cacheLivemarkInfo(aPlacesNode, aLivemark);
             this.invalidateContainer(aPlacesNode);
@@ -1364,19 +1352,19 @@ PlacesToolbar.prototype = {
       return;
 
     PlacesViewBase.prototype.nodeTitleChanged.apply(this, arguments);
 
     // Here we need the <menu>.
     if (elt.localName == "menupopup")
       elt = elt.parentNode;
 
-    if (elt.parentNode == this._rootElt) { // Node is on the toolbar.
-      if (elt.style.visibility != "hidden")
-        this.updateChevron();
+    if (elt.parentNode == this._rootElt) {
+      // Node is on the toolbar
+      this.updateChevron();
     }
   },
 
   invalidateContainer: function PT_invalidateContainer(aPlacesNode) {
     let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
     if (elt == this._rootElt) {
       // Container is the toolbar itself.
       this._rebuild();
@@ -1523,19 +1511,17 @@ PlacesToolbar.prototype = {
     let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
     timer.initWithCallback(this, aTime, timer.TYPE_ONE_SHOT);
     return timer;
   },
 
   notify: function PT_notify(aTimer) {
     if (aTimer == this._updateChevronTimer) {
       this._updateChevronTimer = null;
-      BrowserUtils.promiseLayoutFlushed(document, "layout", () => {
-        window.requestAnimationFrame(this._updateChevronTimerCallback);
-      });
+      this._updateChevronTimerCallback();
     } else if (aTimer == this._ibTimer) {
       // * Timer to turn off indicator bar.
       this._dropIndicator.collapsed = true;
       this._ibTimer = null;
     } else if (aTimer == this._overFolder.openTimer) {
       // * Timer to open a menubutton that's being dragged over.
       // Set the autoopen attribute on the folder's menupopup so that
       // the menu will automatically close when the mouse drags off of it.
@@ -1931,17 +1917,16 @@ PlacesPanelMenuView.prototype = {
       }
     }
 
     button._placesNode = aChild;
     if (!this._domNodes.has(aChild))
       this._domNodes.set(aChild, button);
 
     aInsertionNode.insertBefore(button, aBefore);
-    return button;
   },
 
   nodeInserted:
   function PAMV_nodeInserted(aParentPlacesNode, aPlacesNode, aIndex) {
     let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
     if (parentElt != this._rootElt)
       return;