Bug 970897 - use subview inner scroll height for Australis standalone panels, r=jaws a=dolske
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Tue, 11 Feb 2014 17:37:43 +0000
changeset 182811 a41968fa2d0229bc69fef702a47c601b98396633
parent 182810 3c2563f098fe770dba9da5a07c01bb8bde1c7f4c
child 182812 b56a36475608626f2430813ca477893c060d165a
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, dolske
bugs970897
milestone29.0a2
Bug 970897 - use subview inner scroll height for Australis standalone panels, r=jaws a=dolske
browser/components/customizableui/content/panelUI.js
browser/components/customizableui/content/panelUI.xml
--- a/browser/components/customizableui/content/panelUI.js
+++ b/browser/components/customizableui/content/panelUI.js
@@ -298,16 +298,17 @@ const PanelUI = {
       tempPanel.setAttribute("context", "");
       document.getElementById(CustomizableUI.AREA_NAVBAR).appendChild(tempPanel);
       // If the view has a footer, set a convenience class on the panel.
       tempPanel.classList.toggle("cui-widget-panelWithFooter",
                                  viewNode.querySelector(".panel-subview-footer"));
 
       let multiView = document.createElement("panelmultiview");
       tempPanel.appendChild(multiView);
+      multiView.setAttribute("mainViewIsSubView", "true");
       multiView.setMainView(viewNode);
       viewNode.classList.add("cui-widget-panelview");
       CustomizableUI.addPanelCloseListeners(tempPanel);
 
       let panelRemover = function() {
         tempPanel.removeEventListener("popuphidden", panelRemover);
         viewNode.classList.remove("cui-widget-panelview");
         CustomizableUI.removePanelCloseListeners(tempPanel);
--- a/browser/components/customizableui/content/panelUI.xml
+++ b/browser/components/customizableui/content/panelUI.xml
@@ -61,16 +61,18 @@
       <field name="__transitioning">false</field>
       <field name="_ignoreMutations">false</field>
 
       <property name="showingSubView" readonly="true"
                 onget="return this._viewStack.getAttribute('viewtype') == 'subview'"/>
       <property name="_mainViewId" onget="return this.getAttribute('mainViewId');" onset="this.setAttribute('mainViewId', val); return val;"/>
       <property name="_mainView" readonly="true"
                 onget="return this._mainViewId ? document.getElementById(this._mainViewId) : null;"/>
+      <property name="showingSubViewAsMainView" readonly="true"
+                onget="return this.getAttribute('mainViewIsSubView') == 'true'"/>
 
       <property name="ignoreMutations">
         <getter>
           return this._ignoreMutations;
         </getter>
         <setter><![CDATA[
           this._ignoreMutations = val;
           if (!val && this._panel.state == "open") {
@@ -317,18 +319,23 @@
             let newHeight = this._heightOfSubview(this._currentSubView);
             this._viewContainer.style.height = newHeight + "px";
           }
         ]]></body>
       </method>
       <method name="_syncContainerWithMainView">
         <body><![CDATA[
           if (!this.ignoreMutations && !this.showingSubView && !this._transitioning) {
-            this._viewContainer.style.height =
-              this._mainView.scrollHeight + "px";
+            let height;
+            if (this.showingSubViewAsMainView) {
+              height = this._heightOfSubview(this._mainView);
+            } else {
+              height = this._mainView.scrollHeight;
+            }
+            this._viewContainer.style.height = height + "px";
           }
         ]]></body>
       </method>
 
       <method name="_heightOfSubview">
         <parameter name="aSubview"/>
         <body><![CDATA[
           let body = aSubview.querySelector(".panel-subview-body");