Bug 1354532 - Part 3 - Ensure that the offscreen bounds check for panelviews does not cause temporary empty panels. r=Paolo
☠☠ backed out by 238f1dbcb600 ☠ ☠
authorMike de Boer <mdeboer@mozilla.com>
Wed, 06 Sep 2017 16:23:08 +0200
changeset 428668 545712909b9be7cf10713169c1eac44636589769
parent 428667 63909748b3ce21c442c37c3889ffeae0abd43ba5
child 428669 2248de5aed904101b9bce391e2999640cef88fd1
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)
reviewersPaolo
bugs1354532
milestone57.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 1354532 - Part 3 - Ensure that the offscreen bounds check for panelviews does not cause temporary empty panels. r=Paolo MozReview-Commit-ID: 8EACBXDekIW
browser/components/customizableui/PanelMultiView.jsm
--- a/browser/components/customizableui/PanelMultiView.jsm
+++ b/browser/components/customizableui/PanelMultiView.jsm
@@ -6,16 +6,18 @@
 
 this.EXPORTED_SYMBOLS = ["PanelMultiView"];
 
 const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
   "resource://gre/modules/AppConstants.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils",
+  "resource://gre/modules/BrowserUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
   "resource:///modules/CustomizableUI.jsm");
 
 /**
  * Simple implementation of the sliding window pattern; panels are added to a
  * linked list, in-order, and the currently shown panel is remembered using a
  * marker. The marker shifts as navigation between panels is continued, where
  * the panel at index 0 is always the starting point:
@@ -728,27 +730,27 @@ this.PanelMultiView = class {
       }
       callback(rect);
       return;
     }
 
     let oldSibling = viewNode.nextSibling || null;
     this._offscreenViewStack.appendChild(viewNode);
 
-    this.window.addEventListener("MozAfterPaint", () => {
-      let viewRect = this._dwu.getBoundsWithoutFlushing(viewNode);
-
+    BrowserUtils.promiseLayoutFlushed(this.document, "layout", () => {
+      return this._dwu.getBoundsWithoutFlushing(viewNode);
+    }).then(viewRect => {
       try {
         this._viewStack.insertBefore(viewNode, oldSibling);
       } catch (ex) {
         this._viewStack.appendChild(viewNode);
       }
 
       callback(viewRect);
-    }, { once: true });
+    });
   }
 
   /**
    * Applies the height transition for which <panelmultiview> is designed.
    *
    * The height transition involves two elements, the viewContainer and its only
    * immediate child the viewStack. In order for this to work correctly, the
    * viewContainer must have "overflow: hidden;" and the two elements must have