Bug 1930292 - Stop setting non-zero chromemargin values. r=win-reviewers,handyman

These only do something on Windows, and after windows 7 they are not
useful at all.

If this has no fallout I plan to simplify the code further in a
follow-up (we can basically make this a boolean attribute again or so).

Differential Revision: https://phabricator.services.mozilla.com/D228528
This commit is contained in:
Emilio Cobos Álvarez
2024-11-16 01:48:48 +00:00
parent 22c02e7fc6
commit 5d9d166821
4 changed files with 8 additions and 20 deletions

View File

@@ -69,11 +69,9 @@ var TabsInTitlebar = {
!Object.keys(this._disallowed).length; !Object.keys(this._disallowed).length;
if (allowed) { if (allowed) {
document.documentElement.setAttribute("tabsintitlebar", "true"); document.documentElement.setAttribute("tabsintitlebar", "true");
document.documentElement.setAttribute("chromemargin", "0,0,0,0");
if (AppConstants.platform == "macosx") { if (AppConstants.platform == "macosx") {
document.documentElement.setAttribute("chromemargin", "0,-1,-1,-1");
document.documentElement.removeAttribute("drawtitle"); document.documentElement.removeAttribute("drawtitle");
} else {
document.documentElement.setAttribute("chromemargin", "0,2,2,2");
} }
} else { } else {
document.documentElement.removeAttribute("tabsintitlebar"); document.documentElement.removeAttribute("tabsintitlebar");

View File

@@ -17,11 +17,7 @@
#endif #endif
data-l10n-args="{"content-title":"CONTENTTITLE"}" data-l10n-args="{"content-title":"CONTENTTITLE"}"
data-l10n-attrs="data-content-title-default, data-content-title-private, data-title-default, data-title-private" data-l10n-attrs="data-content-title-default, data-content-title-private, data-title-default, data-title-private"
#ifdef XP_WIN chromemargin="0,0,0,0"
chromemargin="0,2,2,2"
#else
chromemargin="0,-1,-1,-1"
#endif
tabsintitlebar="true" tabsintitlebar="true"
windowtype="navigator:browser" windowtype="navigator:browser"
macanimationtype="document" macanimationtype="document"

View File

@@ -1995,22 +1995,16 @@ static Result<Ok, PreXULSkeletonUIError> CreateAndStorePreXULSkeletonUIImpl(
sCaptionHeight = sCaptionHeight =
sVerticalResizeMargin + sGetSystemMetricsForDpi(SM_CYCAPTION, sDpi); sVerticalResizeMargin + sGetSystemMetricsForDpi(SM_CYCAPTION, sDpi);
// These match the margins set in browser-tabsintitlebar.js with default prefs // These match the offsets that we get with default prefs. We don't use the
// on Windows. We don't use the skeleton ui if tabsInTitlebar is disabled, see // skeleton ui if tabsInTitlebar is disabled, see bug 1673092.
// bug 1673092.
const Margin nonClientMargin{0, 2, 2, 2};
if (sMaximized) { if (sMaximized) {
sNonClientOffset.top = sCaptionHeight - sVerticalResizeMargin; sNonClientOffset.top = sCaptionHeight - sVerticalResizeMargin;
} else { } else {
// See nsWindow::NormalWindowNonClientOffset() // See nsWindow::NormalWindowNonClientOffset()
sNonClientOffset.top = sCaptionHeight; sNonClientOffset.top = sCaptionHeight;
sNonClientOffset.bottom = sNonClientOffset.bottom = sVerticalResizeMargin;
std::min(sVerticalResizeMargin, nonClientMargin.bottom); sNonClientOffset.left = sHorizontalResizeMargin;
sNonClientOffset.left = sNonClientOffset.right = sHorizontalResizeMargin;
std::min(sHorizontalResizeMargin, nonClientMargin.left);
sNonClientOffset.right =
std::min(sHorizontalResizeMargin, nonClientMargin.right);
} }
if (sMaximized) { if (sMaximized) {

View File

@@ -5,7 +5,7 @@
height="300" height="300"
width="300" width="300"
sizemode="normal" sizemode="normal"
chromemargin="0,2,2,2" chromemargin="0,0,0,0"
id="window" id="window"
persist="height width sizemode"> persist="height width sizemode">
<script type="application/javascript"><![CDATA[ <script type="application/javascript"><![CDATA[