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;
if (allowed) {
document.documentElement.setAttribute("tabsintitlebar", "true");
document.documentElement.setAttribute("chromemargin", "0,0,0,0");
if (AppConstants.platform == "macosx") {
document.documentElement.setAttribute("chromemargin", "0,-1,-1,-1");
document.documentElement.removeAttribute("drawtitle");
} else {
document.documentElement.setAttribute("chromemargin", "0,2,2,2");
}
} else {
document.documentElement.removeAttribute("tabsintitlebar");

View File

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

View File

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

View File

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