mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1044597 - Limit the minimum size of subdialogs in the in-content preferences. r=Gijs
--HG-- extra : rebase_source : 2c9b643cb479a6acc3320013c606de514d261113
This commit is contained in:
parent
1a5df4259f
commit
3cd924f0c9
@ -92,6 +92,8 @@ let gSubDialog = {
|
||||
// Clear the sizing attributes
|
||||
this._box.removeAttribute("width");
|
||||
this._box.removeAttribute("height");
|
||||
this._box.style.removeProperty("min-height");
|
||||
this._box.style.removeProperty("min-width");
|
||||
|
||||
setTimeout(() => {
|
||||
// Unload the dialog after the event listeners run so that the load of about:blank isn't
|
||||
@ -144,12 +146,26 @@ let gSubDialog = {
|
||||
// Do this on load to wait for the CSS to load and apply before calculating the size.
|
||||
let docEl = this._frame.contentDocument.documentElement;
|
||||
|
||||
// padding-bottom doesn't seem to be included in the scrollHeight of the document element in XUL
|
||||
// so add it ourselves.
|
||||
let paddingBottom = parseFloat(this._frame.contentWindow.getComputedStyle(docEl).paddingBottom);
|
||||
let groupBoxTitle = document.getAnonymousElementByAttribute(this._box, "class", "groupbox-title");
|
||||
let groupBoxTitleHeight = groupBoxTitle.clientHeight +
|
||||
parseFloat(getComputedStyle(groupBoxTitle).borderBottomWidth);
|
||||
|
||||
this._frame.style.width = docEl.style.width || docEl.scrollWidth + "px";
|
||||
this._frame.style.height = docEl.style.height || (docEl.scrollHeight + paddingBottom) + "px";
|
||||
let groupBoxBody = document.getAnonymousElementByAttribute(this._box, "class", "groupbox-body");
|
||||
let boxVerticalPadding = 2 * parseFloat(getComputedStyle(groupBoxBody).paddingTop);
|
||||
let boxHorizontalPadding = 2 * parseFloat(getComputedStyle(groupBoxBody).paddingLeft);
|
||||
let frameWidth = docEl.style.width || docEl.scrollWidth + "px";
|
||||
let frameHeight = docEl.style.height || docEl.scrollHeight + "px";
|
||||
let boxVerticalBorder = 2 * parseFloat(getComputedStyle(this._box).borderTopWidth);
|
||||
let boxHorizontalBorder = 2 * parseFloat(getComputedStyle(this._box).borderLeftWidth);
|
||||
|
||||
this._frame.style.width = frameWidth;
|
||||
this._frame.style.height = frameHeight;
|
||||
this._box.style.minHeight = "calc(" +
|
||||
(boxVerticalBorder + groupBoxTitleHeight + boxVerticalPadding) +
|
||||
"px + " + frameHeight + ")";
|
||||
this._box.style.minWidth = "calc(" +
|
||||
(boxHorizontalBorder + boxHorizontalPadding) +
|
||||
"px + " + frameWidth + ")";
|
||||
|
||||
this._overlay.style.visibility = "visible";
|
||||
this._frame.focus();
|
||||
|
Loading…
Reference in New Issue
Block a user