From b9cf731dc495d3a721b4e503113751a24f17d2c3 Mon Sep 17 00:00:00 2001 From: Iulian Moraru Date: Tue, 11 May 2021 18:44:50 +0300 Subject: [PATCH] Backed out changeset 160daad53292 (bug 1710462) for causing browser chrome failures on browser_subdialogs.js. CLOSED TREE --- toolkit/modules/SubDialog.jsm | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/toolkit/modules/SubDialog.jsm b/toolkit/modules/SubDialog.jsm index f2bbac754307..07e0ff36c2cd 100644 --- a/toolkit/modules/SubDialog.jsm +++ b/toolkit/modules/SubDialog.jsm @@ -362,19 +362,13 @@ SubDialog.prototype = { let oldResizeBy = this._frame.contentWindow.resizeBy; this._frame.contentWindow.resizeBy = (resizeByWidth, resizeByHeight) => { // Only handle resizeByHeight currently. - let frameHeight = this._overlay.parentNode.style.getPropertyValue( - "--inner-height" - ); - if (frameHeight) { - frameHeight = parseFloat(frameHeight, 10); - } else { - frameHeight = this._frame.clientHeight; - } + let frameHeight = this._frame.clientHeight; let boxMinHeight = parseFloat( this._window.getComputedStyle(this._box).minHeight, 10 ); + this._frame.style.height = frameHeight + resizeByHeight + "px"; this._box.style.minHeight = boxMinHeight + resizeByHeight + "px"; this._overlay.parentNode.style.setProperty( @@ -565,8 +559,10 @@ SubDialog.prototype = { // Now check if the frame height we calculated is possible at this window size, // accounting for titlebar, padding/border and some spacing. - let frameOverhead = frameSizeDifference + (this._titleBar ? 30 : 0); - let maxHeight = this._window.innerHeight - frameOverhead; + let maxHeight = + this._window.innerHeight - + frameSizeDifference - + (this._titleBar ? 30 : 0); // Do this with a frame height in pixels... let comparisonFrameHeight; if (frameHeight.endsWith("em")) { @@ -595,6 +591,7 @@ SubDialog.prototype = { // contents scroll. The class is set on the "dialog" element, unless a // content pane exists, which is usually the case when the "window" // element is used to implement the subdialog instead. + frameHeight = maxHeight + "px"; frameMinHeight = maxHeight + "px"; if (contentPane) { @@ -606,15 +603,14 @@ SubDialog.prototype = { } } + this._frame.style.height = frameHeight; this._overlay.parentNode.style.setProperty("--inner-height", frameHeight); - this._frame.style.height = `min( - calc(100vh - ${frameOverhead}px), - var(--inner-height, ${frameHeight}) - )`; - this._box.style.minHeight = `calc( - ${boxVerticalBorder + titleBarHeight + frameVerticalMargin}px + - ${frameMinHeight} - )`; + this._box.style.minHeight = + "calc(" + + (boxVerticalBorder + titleBarHeight + frameVerticalMargin) + + "px + " + + frameMinHeight + + ")"; }, _onResize(mutations) {