Bug 1481401 - PanelMultiView.jsm: replace _dwu getter with _getBoundsWithoutFlushing method. r=dao
authorSahil Bhosale <sahilbhosale63@live.com>
Fri, 10 Aug 2018 02:27:00 +0300
changeset 486067 4d0483ecd5932907575039e2097cbece0691a637
parent 486066 e574b6c899c1e4e8f7a087483d8bbb16edd554cf
child 486068 059d023837068e124e35966c20eb87216b481ec5
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs1481401
milestone63.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 1481401 - PanelMultiView.jsm: replace _dwu getter with _getBoundsWithoutFlushing method. r=dao
browser/components/customizableui/PanelMultiView.jsm
--- a/browser/components/customizableui/PanelMultiView.jsm
+++ b/browser/components/customizableui/PanelMultiView.jsm
@@ -167,23 +167,18 @@ var AssociatedToNode = class {
   get document() {
     return this.node.ownerDocument;
   }
 
   get window() {
     return this.node.ownerGlobal;
   }
 
-  /**
-   * nsIDOMWindowUtils for the window of this node.
-   */
-  get _dwu() {
-    if (this.__dwu)
-      return this.__dwu;
-    return this.__dwu = this.window.windowUtils;
+  _getBoundsWithoutFlushing(element) {
+    return this.window.windowUtils.getBoundsWithoutFlushing(element);
   }
 
   /**
    * Dispatches a custom event on this element.
    *
    * @param  {String}    eventName Name of the event to dispatch.
    * @param  {Object}    [detail]  Event detail object. Optional.
    * @param  {Boolean}   cancelable If the event can be canceled.
@@ -418,18 +413,17 @@ var PanelMultiView = class extends Assoc
 
     this._panel.removeEventListener("mousemove", this);
     this._panel.removeEventListener("popupshowing", this);
     this._panel.removeEventListener("popuppositioned", this);
     this._panel.removeEventListener("popupshown", this);
     this._panel.removeEventListener("popuphidden", this);
     this.window.removeEventListener("keydown", this);
     this.node = this._openPopupPromise = this._openPopupCancelCallback =
-      this._viewContainer = this._viewStack = this.__dwu =
-      this._transitionDetails = null;
+      this._viewContainer = this._viewStack = this._transitionDetails = null;
   }
 
   /**
    * Tries to open the panel associated with this PanelMultiView, and displays
    * the main view specified with the "mainViewId" attribute.
    *
    * The hidePopup method can be called while the operation is in progress to
    * prevent the panel from being displayed. View events may also cancel the
@@ -873,31 +867,31 @@ var PanelMultiView = class extends Assoc
       let height = prevPanelView.knownHeight;
       viewRect = Object.assign({height, width}, viewNode.customRectGetter());
       nextPanelView.visible = true;
       // Until the header is visible, it has 0 height.
       // Wait for layout before measuring it
       let header = viewNode.firstElementChild;
       if (header && header.classList.contains("panel-header")) {
         viewRect.height += await window.promiseDocumentFlushed(() => {
-          return this._dwu.getBoundsWithoutFlushing(header).height;
+          return this._getBoundsWithoutFlushing(header).height;
         });
       }
       await nextPanelView.descriptionHeightWorkaround();
     } else {
       this._offscreenViewStack.style.minHeight = olderView.knownHeight + "px";
       this._offscreenViewStack.appendChild(viewNode);
       nextPanelView.visible = true;
 
       // Now that the subview is visible, we can check the height of the
       // description elements it contains.
       await nextPanelView.descriptionHeightWorkaround();
 
       viewRect = await window.promiseDocumentFlushed(() => {
-        return this._dwu.getBoundsWithoutFlushing(viewNode);
+        return this._getBoundsWithoutFlushing(viewNode);
       });
       // Bail out if the panel was closed in the meantime.
       if (!nextPanelView.isOpenIn(this)) {
         return;
       }
 
       // Place back the view after all the other views that are already open in
       // order for the transition to work as expected.
@@ -1252,17 +1246,17 @@ var PanelView = class extends Associated
   /**
    * Populates the "knownWidth" and "knownHeight" properties with the current
    * dimensions of the view. These may be zero if the view is invisible.
    *
    * These values are relevant during transitions and are retained for backwards
    * navigation if the view is still open but is invisible.
    */
   captureKnownSize() {
-    let rect = this._dwu.getBoundsWithoutFlushing(this.node);
+    let rect = this._getBoundsWithoutFlushing(this.node);
     this.knownWidth = rect.width;
     this.knownHeight = rect.height;
   }
 
   /**
    * If the main view or a subview contains wrapping elements, the attribute
    * "descriptionheightworkaround" should be set on the view to force all the
    * wrapping "description", "label" or "toolbarbutton" elements to a fixed
@@ -1365,26 +1359,25 @@ var PanelView = class extends Associated
    */
   get _navigableElements() {
     if (this.__navigableElements) {
       return this.__navigableElements;
     }
 
     let navigableElements = Array.from(this.node.querySelectorAll(
       ":-moz-any(button,toolbarbutton,menulist,.text-link):not([disabled])"));
-    let dwu = this._dwu;
     return this.__navigableElements = navigableElements.filter(element => {
       // Set the "tabindex" attribute to make sure the element is focusable.
       if (!element.hasAttribute("tabindex")) {
         element.setAttribute("tabindex", "0");
       }
       if (element.hasAttribute("disabled")) {
         return false;
       }
-      let bounds = dwu.getBoundsWithoutFlushing(element);
+      let bounds = this._getBoundsWithoutFlushing(element);
       return bounds.width > 0 && bounds.height > 0;
     });
   }
 
   /**
    * Element that is currently selected with the keyboard, or null if no element
    * is selected. Since the reference is held weakly, it can become null or
    * undefined at any time.