Skip to content

Commit

Permalink
Bug 1710633 - Use the actual titlebar height to determine subdialog s…
Browse files Browse the repository at this point in the history
…ize. r=Mardak

It isn't immediately obvious that the hardcoded 30 pixel value this patch
replaces was meant to represent strictly the height of the dialog's title bar
(including border), but I do believe that is how it was intended, based on
these two things:

1) Using 0 instead of 30 when no titlebar is present at least appears to be the
   correct behavior, or if nothing else it's a reasonable enough behavior that
   it prevents anything looking broken.
2) 30 pixels is the exact height of the titlebar including border as it
   actually appeared on in-content preferences dialog boxes at the time the
   hardcoded value was originally introduced here in bug 1128237.

So, based on that, it looks like what's needed here is a value that is zero
when no titlebar exists, or if there is one, then its computed height including
border. As it turns out, we were already computing exactly that value for
another purpose, so this patch simply plugs that in here in place of the
hardcoded constant.

Differential Revision: https://phabricator.services.mozilla.com/D117374
  • Loading branch information
Molly Howell committed Jun 11, 2021
1 parent ce6e976 commit 119eaa0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion toolkit/modules/SubDialog.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ 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 frameOverhead = frameSizeDifference + titleBarHeight;
let maxHeight = this._window.innerHeight - frameOverhead;
// Do this with a frame height in pixels...
let comparisonFrameHeight;
Expand Down

0 comments on commit 119eaa0

Please sign in to comment.