Bug 1428839 - Part 1 - Remove previous workaround for flickering at the end of the transition. r=Gijs
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Tue, 27 Feb 2018 15:17:29 +0000
changeset 405752 f579f320031ce52c558112299431b758df5706fa
parent 405751 d0ecce89ac1aaf60e826afa9be9a92fbdb29a194
child 405753 0605579057e6b57aac46deecae3ead4084575427
push id100289
push userpaolo.mozmail@amadzone.org
push dateWed, 28 Feb 2018 19:56:47 +0000
treeherdermozilla-inbound@724aad27fd44 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1428839, 1374749
milestone60.0a1
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 1428839 - Part 1 - Remove previous workaround for flickering at the end of the transition. r=Gijs This was originally introduced in bug 1374749 but isn't needed anymore, and removing this allows making the _cleanupTransitionPhase method synchronous. MozReview-Commit-ID: 6v78QoPXZoU
browser/components/customizableui/PanelMultiView.jsm
--- a/browser/components/customizableui/PanelMultiView.jsm
+++ b/browser/components/customizableui/PanelMultiView.jsm
@@ -119,17 +119,16 @@ XPCOMUtils.defineLazyGetter(this, "gBund
  * registered blockers does not return.
  */
 const BLOCKERS_TIMEOUT_MS = 10000;
 
 const TRANSITION_PHASES = Object.freeze({
   START: 1,
   PREPARE: 2,
   TRANSITION: 3,
-  END: 4
 });
 
 let gNodeToObjectMap = new WeakMap();
 let gWindowsWithUnloadHandler = new WeakSet();
 let gMultiLineElementsMap = new WeakMap();
 
 /**
  * Allows associating an object to a node lazily using a weak map.
@@ -686,17 +685,17 @@ var PanelMultiView = class extends this.
     }
 
     // The main view of a panel can be a subview in another one. Make sure to
     // reset all the properties that may be set on a subview.
     nextPanelView.mainview = true;
     nextPanelView.headerText = "";
     nextPanelView.minMaxWidth = 0;
 
-    await this._cleanupTransitionPhase();
+    this._cleanupTransitionPhase();
     nextPanelView.visible = true;
     nextPanelView.descriptionHeightWorkaround();
 
     return true;
   }
 
   /**
    * Opens the specified PanelView and dispatches the ViewShowing event, which
@@ -783,17 +782,17 @@ var PanelMultiView = class extends this.
    *                                     after the transition has finished.
    * @param {Boolean}   reverse          Whether we're navigation back to a
    *                                     previous view or forward to a next view.
    * @param {Element}   anchor           the anchor for which we're opening
    *                                     a new panelview, if any
    */
   async _transitionViews(previousViewNode, viewNode, reverse, anchor) {
     // Clean up any previous transition that may be active at this point.
-    await this._cleanupTransitionPhase();
+    this._cleanupTransitionPhase();
 
     // There's absolutely no need to show off our epic animation skillz when
     // the panel's not even open.
     if (this._panel.state != "open") {
       return;
     }
 
     const { window } = this;
@@ -931,42 +930,40 @@ var PanelMultiView = class extends this.
         if (ev.target != this._viewStack)
           return;
         this._viewContainer.removeEventListener("transitioncancel", details.cancelListener);
         delete details.cancelListener;
         resolve();
       });
     });
 
-    details.phase = TRANSITION_PHASES.END;
-
     // Apply the final visibility, unless the view was closed in the meantime.
     if (nextPanelView.node.panelMultiView == this.node) {
       prevPanelView.visible = false;
     }
 
     // This will complete the operation by removing any transition properties.
-    await this._cleanupTransitionPhase(details);
+    this._cleanupTransitionPhase(details);
 
     // Focus the correct element, unless the view was closed in the meantime.
     if (nextPanelView.node.panelMultiView == this.node) {
       nextPanelView.focusSelectedElement();
     }
   }
 
   /**
    * Attempt to clean up the attributes and properties set by `_transitionViews`
    * above. Which attributes and properties depends on the phase the transition
-   * was left from - normally that'd be `TRANSITION_PHASES.END`.
+   * was left from.
    *
    * @param {Object} details Dictionary object containing details of the transition
    *                         that should be cleaned up after. Defaults to the most
    *                         recent details.
    */
-  async _cleanupTransitionPhase(details = this._transitionDetails) {
+  _cleanupTransitionPhase(details = this._transitionDetails) {
     if (!details || !this.node)
       return;
 
     let {phase, previousViewNode, viewNode, reverse, resolve, listener, cancelListener, anchor} = details;
     if (details == this._transitionDetails)
       this._transitionDetails = null;
 
     // Do the things we _always_ need to do whenever the transition ends or is
@@ -1001,23 +998,16 @@ var PanelMultiView = class extends this.
       viewNode.style.removeProperty("width");
       if (listener)
         this._viewContainer.removeEventListener("transitionend", listener);
       if (cancelListener)
         this._viewContainer.removeEventListener("transitioncancel", cancelListener);
       if (resolve)
         resolve();
     }
-    if (phase >= TRANSITION_PHASES.END) {
-      // We force 'display: none' on the previous view node to make sure that it
-      // doesn't cause an annoying flicker whilst resetting the styles above.
-      previousViewNode.style.display = "none";
-      await this.window.promiseDocumentFlushed(() => {});
-      previousViewNode.style.removeProperty("display");
-    }
   }
 
   _calculateMaxHeight() {
     // While opening the panel, we have to limit the maximum height of any
     // view based on the space that will be available. We cannot just use
     // window.screen.availTop and availHeight because these may return an
     // incorrect value when the window spans multiple screens.
     let anchorBox = this._panel.anchorNode.boxObject;