Bug 1387808 - Don't ever fixate the width and height of the main view, but leave it flexible. r=Gijs, a=ritu
authorMike de Boer <mdeboer@mozilla.com>
Thu, 05 Oct 2017 13:14:02 +0200
changeset 432377 da0c1e20a0cc
parent 432376 3f5cdc290da4
child 432378 63c9ad5b7e93
push id7947
push userryanvm@gmail.com
push dateWed, 11 Oct 2017 18:32:48 +0000
treeherdermozilla-beta@2220c5f79afb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, ritu
bugs1387808
milestone57.0
Bug 1387808 - Don't ever fixate the width and height of the main view, but leave it flexible. r=Gijs, a=ritu MozReview-Commit-ID: AJw6yI6Onje
browser/components/customizableui/PanelMultiView.jsm
browser/themes/shared/customizableui/panelUI.inc.css
--- a/browser/components/customizableui/PanelMultiView.jsm
+++ b/browser/components/customizableui/PanelMultiView.jsm
@@ -507,56 +507,56 @@ this.PanelMultiView = class {
       }
 
       let reverse = !!aPreviousView;
       let previousViewNode = aPreviousView || this._currentSubView;
       // If the panelview to show is the same as the previous one, the 'ViewShowing'
       // event has already been dispatched. Don't do it twice.
       let showingSameView = viewNode == previousViewNode;
       let playTransition = (!!previousViewNode && !showingSameView && this._panel.state == "open");
+      let isMainView = viewNode.id == this._mainViewId;
 
       let dwu, previousRect;
       if (playTransition || this.panelViews) {
         dwu = this._dwu;
         previousRect = previousViewNode.__lastKnownBoundingRect =
           dwu.getBoundsWithoutFlushing(previousViewNode);
         if (this.panelViews) {
-          // Here go the measures that have the same caching lifetime as the width
-          // of the main view, i.e. 'forever', during the instance lifetime.
+          // Cache the measures that have the same caching lifetime as the width
+          // or height of the main view, i.e. whilst the panel is shown and/ or
+          // visible.
           if (!this._mainViewWidth) {
             this._mainViewWidth = previousRect.width;
             let top = dwu.getBoundsWithoutFlushing(previousViewNode.firstChild || previousViewNode).top;
             let bottom = dwu.getBoundsWithoutFlushing(previousViewNode.lastChild || previousViewNode).bottom;
             this._viewVerticalPadding = previousRect.height - (bottom - top);
           }
-          // Here go the measures that have the same caching lifetime as the height
-          // of the main view, i.e. whilst the panel is shown and/ or visible.
           if (!this._mainViewHeight) {
             this._mainViewHeight = previousRect.height;
             this._viewContainer.style.minHeight = this._mainViewHeight + "px";
           }
         }
       }
 
       this._viewShowing = viewNode;
       // Because the 'mainview' attribute may be out-of-sync, due to view node
       // reparenting in combination with ephemeral PanelMultiView instances,
       // this is the best place to correct it (just before showing).
-      if (viewNode.id == this._mainViewId)
+      if (isMainView)
         viewNode.setAttribute("mainview", true);
       else
         viewNode.removeAttribute("mainview");
 
       // Make sure that new panels always have a title set.
       if (this.panelViews && aAnchor) {
         if (!viewNode.hasAttribute("title"))
           viewNode.setAttribute("title", aAnchor.getAttribute("label"));
         viewNode.classList.add("PanelUI-subView");
       }
-      if (this.panelViews && this._mainViewWidth)
+      if (this.panelViews && !isMainView && this._mainViewWidth)
         viewNode.style.maxWidth = viewNode.style.minWidth = this._mainViewWidth + "px";
 
       if (!showingSameView || !viewNode.hasAttribute("current")) {
         // Emit the ViewShowing event so that the widget definition has a chance
         // to lazily populate the subview with things or perhaps even cancel this
         // whole operation.
         let detail = {
           blockers: new Set(),
--- a/browser/themes/shared/customizableui/panelUI.inc.css
+++ b/browser/themes/shared/customizableui/panelUI.inc.css
@@ -411,19 +411,19 @@ photonpanelmultiview panelview {
 
 #customizationui-widget-multiview #appMenu-libraryView,
 #pageActionPanel panelview,
 #widget-overflow panelview {
   min-width: @wideMenuPanelWidth@;
   max-width: @wideMenuPanelWidth@;
 }
 
-/* Add 2 * 12px extra width for touch mode button padding. */
+/* Add 2 * 16px extra width for touch mode button padding. */
 #appMenu-popup[touchmode] panelview {
-  min-width: calc(@menuPanelWidth@ + 24px);
+  min-width: calc(@menuPanelWidth@ + 32px);
 }
 
 photonpanelmultiview .panel-subview-body {
   padding: 6px 0;
 }
 
 /* END photonpanelview adjustments */