Bug 1403466 - Don't set a max-height on panelviews used by WebExtensions, because it causes browser contents to be cut-off. r?Gijs draft
authorMike de Boer <mdeboer@mozilla.com>
Tue, 10 Oct 2017 12:44:04 +0200
changeset 677225 d45c4e85410a3510829102aac86eff6934d45ab9
parent 677214 77a4c52e9987d2359969d7c478183b438b464744
child 735149 43c6aae4d6d1efad487d1603b380b9c42296d9c7
push id83727
push usermdeboer@mozilla.com
push dateTue, 10 Oct 2017 10:50:01 +0000
reviewersGijs
bugs1403466
milestone58.0a1
Bug 1403466 - Don't set a max-height on panelviews used by WebExtensions, because it causes browser contents to be cut-off. r?Gijs Setting a max-height caused the '_handleDOMChange' method in ext-browser-content.js to consistently lie about the scrollHeight, since it was never allowed to grow beyond the maxHeight - even when the document needs to be larger to fit its contents. We don't need this aggressiveness in Photon panels anyway, so that makes it doubly safe to remove this code. MozReview-Commit-ID: HJVMXXHS4By
browser/components/extensions/ExtensionPopups.jsm
--- a/browser/components/extensions/ExtensionPopups.jsm
+++ b/browser/components/extensions/ExtensionPopups.jsm
@@ -118,17 +118,16 @@ class BasePopup {
         this.browser.remove();
       }
       if (this.stack) {
         this.stack.remove();
       }
 
       if (this.viewNode) {
         this.viewNode.removeEventListener(this.DESTROY_EVENT, this);
-        this.viewNode.style.maxHeight = "";
         delete this.viewNode.customRectGetter;
       }
 
       let {panel} = this;
       if (panel) {
         panel.style.removeProperty("--arrowpanel-background");
         panel.style.removeProperty("--panel-arrow-image-vertical");
         panel.removeAttribute("remote");
@@ -326,26 +325,19 @@ class BasePopup {
       // Figure out how much extra space we have on the side of the panel
       // opposite the arrow.
       let side = this.panel.getAttribute("side") == "top" ? "bottom" : "top";
       let maxHeight = this.viewHeight + this.extraHeight[side];
 
       height = Math.min(height, maxHeight);
       this.browser.style.height = `${height}px`;
 
-      // Set a maximum height on the <panelview> element to our preferred
-      // maximum height, so that the PanelUI resizing code can make an accurate
-      // calculation. If we don't do this, the flex sizing logic will prevent us
-      // from ever reporting a preferred size smaller than the height currently
-      // available to us in the panel.
-      height = Math.max(height, this.viewHeight);
-      this.viewNode.style.maxHeight = `${height}px`;
       // Used by the panelmultiview code to figure out sizing without reparenting
       // (which would destroy the browser and break us).
-      this.lastCalculatedInViewHeight = height;
+      this.lastCalculatedInViewHeight = Math.max(height, this.viewHeight);
     } else {
       this.browser.style.width = `${width}px`;
       this.browser.style.minWidth = `${width}px`;
       this.browser.style.height = `${height}px`;
       this.browser.style.minHeight = `${height}px`;
     }
 
     let event = new this.window.CustomEvent("WebExtPopupResized", {detail});