From 7e60f84b6ec7c303e07f303a4838e907265a9a05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 18 Jul 2023 14:11:33 +0000 Subject: [PATCH] Bug 1843663 - Remove pre windows-10-specific media queries and styles. r=dao,Gijs,handyman,settings-reviewers Some basic clean-up. I want to do this before doing bigger changes in bug 1843044. There's tons more code that can get cleaned-up on the widget side, but let's start with this. Differential Revision: https://phabricator.services.mozilla.com/D183622 --- browser/base/content/browser.css | 49 +- .../test/forms/browser_selectpopup_large.js | 7 +- .../test/static/browser_parsable_css.js | 7 +- .../themes/shared/light-dark-overrides.css | 101 ---- .../themes/shared/preferences/preferences.css | 8 - browser/themes/shared/searchbar.css | 2 +- browser/themes/windows/browser-aero.css | 470 +++++++----------- browser/themes/windows/browser.css | 277 ++++------- .../themes/windows/customizableui/panelUI.css | 10 - editor/reftests/xul/input.css | 6 - layout/style/GeckoBindings.h | 2 - layout/style/nsMediaFeatures.cpp | 16 - layout/style/test/chrome/bug418986-2.js | 8 - .../test/chrome/chrome-only-media-queries.js | 9 - .../components/style/gecko/media_features.rs | 21 +- toolkit/themes/shared/checkbox.css | 7 - toolkit/themes/shared/tree.css | 21 - toolkit/themes/windows/global/button.css | 9 +- toolkit/themes/windows/global/global.css | 24 +- toolkit/themes/windows/global/menu.css | 240 ++------- toolkit/themes/windows/global/popup.css | 59 +-- toolkit/themes/windows/global/radio.css | 7 - toolkit/themes/windows/global/richlistbox.css | 31 -- .../themes/windows/global/toolbarbutton.css | 11 - widget/LookAndFeel.h | 28 -- widget/headless/HeadlessLookAndFeelGTK.cpp | 6 - widget/nsXPLookAndFeel.cpp | 19 - widget/windows/nsLookAndFeel.cpp | 35 +- widget/windows/nsNativeThemeWin.cpp | 223 ++------- widget/windows/nsUXThemeData.cpp | 238 +-------- widget/windows/nsUXThemeData.h | 34 -- widget/windows/nsWindow.cpp | 21 - xpcom/ds/StaticAtoms.py | 8 - 33 files changed, 360 insertions(+), 1654 deletions(-) diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css index 6925b2087a33b..9f7460085de82 100644 --- a/browser/base/content/browser.css +++ b/browser/base/content/browser.css @@ -77,50 +77,19 @@ body { background-image: var(--lwt-additional-images); background-repeat: var(--lwt-background-tiling); background-position: var(--lwt-background-alignment); + background-color: var(--lwt-accent-color); } -/* TODO bug 1695280: Remove these media selectors and merge the rule below - with the ruleset above. We must set background properties on :root and not - #navigator-toolbox on Windows 7/8 due to a WebRender bug that hides the - minimize/maximize/close buttons. */ -@media not (-moz-platform: windows-win7) { - @media not (-moz-platform: windows-win8) { - #navigator-toolbox:-moz-lwtheme { - background-color: var(--lwt-accent-color); - } - - /* When a theme defines both theme_frame and additional_backgrounds, show - the latter atop the former. */ - :root[lwtheme-image] #navigator-toolbox { - background-image: var(--lwt-header-image), var(--lwt-additional-images); - background-repeat: no-repeat, var(--lwt-background-tiling); - background-position: right top, var(--lwt-background-alignment); - } - - #navigator-toolbox:-moz-window-inactive:-moz-lwtheme { - background-color: var(--lwt-accent-color-inactive, var(--lwt-accent-color)); - } - } +/* When a theme defines both theme_frame and additional_backgrounds, show + the latter atop the former. */ +:root[lwtheme-image] #navigator-toolbox { + background-image: var(--lwt-header-image), var(--lwt-additional-images); + background-repeat: no-repeat, var(--lwt-background-tiling); + background-position: right top, var(--lwt-background-alignment); } -/* TODO bug 1695280: Remove this block. */ -@media (-moz-platform: windows-win7), - (-moz-platform: windows-win8) { - :root:-moz-lwtheme { - background-color: var(--lwt-accent-color); - background-image: var(--lwt-additional-images); - background-repeat: var(--lwt-background-tiling); - background-position: var(--lwt-background-alignment); - } - - :root[lwtheme-image] { - background-image: var(--lwt-header-image, linear-gradient(transparent, transparent)), var(--lwt-additional-images) !important; - background-repeat: no-repeat, var(--lwt-background-tiling); - background-position: right top, var(--lwt-background-alignment) !important; - } - :root:-moz-lwtheme:-moz-window-inactive { - background-color: var(--lwt-accent-color-inactive, var(--lwt-accent-color)); - } +#navigator-toolbox:-moz-window-inactive:-moz-lwtheme { + background-color: var(--lwt-accent-color-inactive, var(--lwt-accent-color)); } #titlebar { diff --git a/browser/base/content/test/forms/browser_selectpopup_large.js b/browser/base/content/test/forms/browser_selectpopup_large.js index 0c88755b27bb0..d655aa6179d55 100644 --- a/browser/base/content/test/forms/browser_selectpopup_large.js +++ b/browser/base/content/test/forms/browser_selectpopup_large.js @@ -241,12 +241,7 @@ async function performLargePopupTests(win) { // might return floating point values. We don't care about sub-pixel // accuracy, and only care about the final pixel value, so we add a // fuzz-factor of 1. - // - // FIXME(emilio): In win7 scroll position is off by 20px more, but that's - // not reproducible in win10 even with the win7 "native" menus enabled. - const fuzzFactor = matchMedia("(-moz-platform: windows-win7)").matches - ? 21 - : 1; + const fuzzFactor = 1; SimpleTest.isfuzzy( selectPopup.children[selectedOption].getBoundingClientRect().bottom, selectPopup.getBoundingClientRect().bottom - bpBottom + marginBottom, diff --git a/browser/base/content/test/static/browser_parsable_css.js b/browser/base/content/test/static/browser_parsable_css.js index 81a296c5ad0be..2a44900ef0032 100644 --- a/browser/base/content/test/static/browser_parsable_css.js +++ b/browser/base/content/test/static/browser_parsable_css.js @@ -286,12 +286,7 @@ let customPropsToReferencesMap = new Map(); function neverMatches(mediaList) { const perPlatformMediaQueryMap = { macosx: ["(-moz-platform: macos)"], - win: [ - "(-moz-platform: windows)", - "(-moz-platform: windows-win7)", - "(-moz-platform: windows-win8)", - "(-moz-platform: windows-win10)", - ], + win: ["(-moz-platform: windows)"], linux: ["(-moz-platform: linux)"], android: ["(-moz-platform: android)"], }; diff --git a/browser/themes/shared/light-dark-overrides.css b/browser/themes/shared/light-dark-overrides.css index 5fa24219f57cd..87d56a5055158 100644 --- a/browser/themes/shared/light-dark-overrides.css +++ b/browser/themes/shared/light-dark-overrides.css @@ -7,104 +7,3 @@ --urlbar-box-focus-bgcolor: var(--button-bgcolor); --urlbar-box-hover-bgcolor: var(--button-hover-bgcolor); } - -@media (-moz-platform: windows) { - /* The window background is white due to no accentcolor in the lightweight - theme. It can't be changed to transparent when there is no compositor - (Win 7 in classic / basic theme), or else dragging and focus become - broken. So instead just show the normal titlebar in that case, and override - the window color as transparent when the compositor is available. */ - @media (-moz-windows-compositor: 0) { - :root[tabsintitlebar]:not([inDOMFullscreen]) #titlebar:-moz-lwtheme { - visibility: visible; - } - - /* Prevent accent color overriding the window background for - * light and dark theme on Aero Basic. This is copied from browser-aero.css. */ - @media (-moz-windows-default-theme) { - :root { - background-color: rgb(185,209,234) !important; - } - :root:-moz-window-inactive { - background-color: rgb(215,228,242) !important; - } - } - } - - /* Add a fog for background tabs to be visible on Windows 7 glass window background */ - @media (-moz-platform: windows-win7) { - @media (-moz-windows-default-theme) { - #TabsToolbar { - background-image: radial-gradient(ellipse at bottom, rgba(255,255,255,0.8), rgba(255,255,255,0.5) 80%, transparent); - color: black; - --toolbarbutton-icon-fill: currentColor; - } - } - } - - @media (-moz-windows-glass) { - /* Make the menubar text readable on aero glass (copied from browser-aero.css). */ - #toolbar-menubar { - text-shadow: 0 0 .5em white, 0 0 .5em white, 0 1px 0 rgba(255,255,255,.4); - } - - #main-menubar:not(:-moz-window-inactive) { - background-color: rgba(255,255,255,.5); - color: black; - border-radius: 4px; - } - } - - @media (-moz-platform: windows-win7), - (-moz-platform: windows-win8) { - @media (-moz-windows-compositor) { - :root { - background: transparent !important; - } - - /* Remove lwtheme borders from toolbars in non-maximized windows. */ - #toolbar-menubar, - #TabsToolbar { - border-inline-style: none !important; - } - } - - /* Use proper menu text styling in Win7 classic mode. On Windows 8, we use - these colors so tabs and menus are legible against the window accent color. - These colors are copied from browser.css. */ - @media (-moz-windows-compositor: 0), - (-moz-windows-default-theme: 0), - (-moz-platform: windows-win8) { - :root[tabsintitlebar] { - color: CaptionText; - } - - :root[tabsintitlebar]:-moz-window-inactive { - color: InactiveCaptionText; - } - } - } - - /* Restored windows get an artificial border on windows, because the lwtheme background - * overlaps the regular window border. That isn't the case for us, so we avoid painting - * over the native border with our custom borders. These are !important to avoid - * specificity-wars with the selectors that add these borders. */ - @media (-moz-windows-classic), - (-moz-windows-compositor: 0) and (-moz-windows-default-theme) { - #navigator-toolbox { - background-image: none !important; - } - } - @media (-moz-windows-glass) { - #navigator-toolbox { - border-top: none !important; - box-shadow: none !important; - padding-top: 0 !important; - } - } - @media (-moz-platform: windows-win8) { - #navigator-toolbox { - border-top: none !important; - } - } -} diff --git a/browser/themes/shared/preferences/preferences.css b/browser/themes/shared/preferences/preferences.css index 237b717b0434e..c0ecc35c68f44 100644 --- a/browser/themes/shared/preferences/preferences.css +++ b/browser/themes/shared/preferences/preferences.css @@ -575,14 +575,6 @@ a[is="moz-support-link"]:not(.sidebar-footer-link) { margin-inline-start: 0; } -@media (-moz-platform: windows-win7), - (-moz-platform: windows-win8) { - #windows-sso, - #windows-sso-caption { - display: none; - } -} - /** * Dialog */ diff --git a/browser/themes/shared/searchbar.css b/browser/themes/shared/searchbar.css index f7d14aa5e6115..70fa8ea0aa209 100644 --- a/browser/themes/shared/searchbar.css +++ b/browser/themes/shared/searchbar.css @@ -167,7 +167,7 @@ fill-opacity: var(--urlbar-icon-fill-opacity); } -@media (-moz-platform: windows-win10) { +@media (-moz-platform: windows) { #PopupSearchAutoComplete { --panel-border-radius: var(--arrowpanel-border-radius); } diff --git a/browser/themes/windows/browser-aero.css b/browser/themes/windows/browser-aero.css index bb357f6c116d1..163d2166e63ba 100644 --- a/browser/themes/windows/browser-aero.css +++ b/browser/themes/windows/browser-aero.css @@ -2,340 +2,204 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -:root { - --glass-active-border-color: rgb(37, 44, 51); - --glass-inactive-border-color: rgb(102, 102, 102); - --glass-shadow-color: hsla(240,5%,5%,0.3); -} - -@media (-moz-platform: windows-win7), - (-moz-platform: windows-win8) { - @media (-moz-windows-classic: 0) { - :root[sizemode="normal"] #toolbar-menubar:not([autohide="true"]) > #menubar-items, - :root[sizemode="normal"] #toolbar-menubar[autohide="true"][inactive] + #TabsToolbar > .toolbar-items { - margin-top: 1px; - } - /** - * Except for Windows 8, Windows 7 Aero and Windows 7 Aero Basic, the - * -moz-window-button-box appearance on the .titlebar-buttonbox adds an - * unwanted margin at the top of the button box. - * - * For Windows 8 and Windows Aero (which both use the compositor): - * We want the -moz-window-button-box applied in the restored case, - * and -moz-window-button-box-maximized in the maximized case. - * - * For Windows Aero Basic: - * The margin is also unwanted in the maximized case, but we want - * it in the restored window case. - */ - :root[sizemode="normal"] .titlebar-buttonbox { - appearance: auto; - -moz-default-appearance: -moz-window-button-box; +@media (-moz-windows-default-theme) { + @media (-moz-windows-accent-color-in-titlebar) { + :root[sizemode=normal][tabsintitlebar] #navigator-toolbox { + border-top: .5px solid ActiveBorder; } + } - @media (-moz-windows-compositor) { - :root[sizemode="maximized"] .titlebar-buttonbox { - appearance: auto; - -moz-default-appearance: -moz-window-button-box-maximized; - } - } + :root[sizemode=normal][tabsintitlebar]:-moz-window-inactive #navigator-toolbox { + border-top-color: InactiveBorder; + } + + :root[tabsintitlebar] .tab-label:-moz-window-inactive { + /* Calculated to match the opacity change of Windows Explorer + titlebar text change for inactive windows. */ + opacity: .6; + } + + :root[tabsintitlebar] .tab-secondary-label:-moz-window-inactive { + opacity: .6; } } -@media (-moz-windows-compositor) { - @media not (-moz-platform: windows-win7) { - @media not (-moz-platform: windows-win8) { - @media (-moz-windows-default-theme) { - @media (-moz-windows-accent-color-in-titlebar) { - :root[sizemode=normal][tabsintitlebar] #navigator-toolbox { - border-top: .5px solid ActiveBorder; - } - } - - :root[sizemode=normal][tabsintitlebar] #navigator-toolbox:-moz-window-inactive { - border-top-color: InactiveBorder; - } - - :root[tabsintitlebar] .tab-label:-moz-window-inactive { - /* Calculated to match the opacity change of Windows Explorer - titlebar text change for inactive windows. */ - opacity: .6; - } - - :root[tabsintitlebar] .tab-secondary-label:-moz-window-inactive { - opacity: .6; - } - } - - /* See bug 1715990 about why we do this ourselves on HCM */ - @media (prefers-contrast) { - :root[tabsintitlebar]:not(:-moz-lwtheme) { - background-color: ActiveCaption; - color: CaptionText; - } - - :root[tabsintitlebar]:not(:-moz-lwtheme):-moz-window-inactive { - background-color: InactiveCaption; - color: InactiveCaptionText; - } - } - - .titlebar-buttonbox, - .titlebar-button { - appearance: none !important; - } - - .titlebar-button { - border: none; - margin: 0 !important; - padding: 8px 17px; - -moz-context-properties: stroke; - stroke: currentColor; - } - - .titlebar-button > .toolbarbutton-icon { - width: 12px; - height: 12px; - } - - .titlebar-min { - list-style-image: url(chrome://browser/skin/window-controls/minimize.svg); - } - - .titlebar-max { - list-style-image: url(chrome://browser/skin/window-controls/maximize.svg); - } - - .titlebar-restore { - list-style-image: url(chrome://browser/skin/window-controls/restore.svg); - } - - .titlebar-restore > .toolbarbutton-icon:-moz-locale-dir(rtl) { - transform: scaleX(-1); - } - - .titlebar-close { - list-style-image: url(chrome://browser/skin/window-controls/close.svg); - } - - :root[lwtheme-image] .titlebar-button { - -moz-context-properties: unset; - } - :root[lwtheme-image] .titlebar-min { - list-style-image: url(chrome://browser/skin/window-controls/minimize-themes.svg); - } - :root[lwtheme-image] .titlebar-max { - list-style-image: url(chrome://browser/skin/window-controls/maximize-themes.svg); - } - :root[lwtheme-image] .titlebar-restore { - list-style-image: url(chrome://browser/skin/window-controls/restore-themes.svg); - } - :root[lwtheme-image] .titlebar-close { - list-style-image: url(chrome://browser/skin/window-controls/close-themes.svg); - } - - /* the 12px image renders a 10px icon, and the 10px upscaled gets rounded to 12.5, which - * rounds up to 13px, which makes the icon one pixel too big on 1.25dppx. Fix: */ - @media (min-resolution: 1.20dppx) and (max-resolution: 1.45dppx) { - .titlebar-button > .toolbarbutton-icon { - width: 11.5px; - height: 11.5px; - } - } - - /* 175% dpi should result in the same device pixel sizes as 150% dpi. */ - @media (min-resolution: 1.70dppx) and (max-resolution: 1.95dppx) { - .titlebar-button { - padding-inline: 14.1px; - } - - .titlebar-button > .toolbarbutton-icon { - width: 10.8px; - height: 10.8px; - } - } - - /* 225% dpi should result in the same device pixel sizes as 200% dpi. */ - @media (min-resolution: 2.20dppx) and (max-resolution: 2.45dppx) { - .titlebar-button { - padding-inline: 15.3333px; - } - - .titlebar-button > .toolbarbutton-icon { - width: 10.8px; - height: 10.8px; - } - } - - /* 275% dpi should result in the same device pixel sizes as 250% dpi. */ - @media (min-resolution: 2.70dppx) and (max-resolution: 2.95dppx) { - /* NB: todo: this should also change padding on the buttons - * themselves, but without a device to test this on, it's - * impossible to know by how much. */ - .titlebar-button > .toolbarbutton-icon { - width: 10.8px; - height: 10.8px; - } - } - - @media (-moz-windows-default-theme) { - #main-menubar > menu[_moz-menuactive="true"] { - color: inherit; - } - - #main-menubar > menu[_moz-menuactive="true"], - .titlebar-button:hover { - background-color: hsla(0,0%,0%,.12); - } - .titlebar-button:hover:active { - background-color: hsla(0,0%,0%,.22); - } - - #toolbar-menubar[brighttext] > #menubar-items > #main-menubar > menu[_moz-menuactive="true"], - toolbar[brighttext] .titlebar-button:not(.titlebar-close):hover { - background-color: hsla(0,0%,100%,.22); - } - toolbar[brighttext] .titlebar-button:not(.titlebar-close):hover:active { - background-color: hsla(0,0%,100%,.32); - } - - .titlebar-close:hover { - stroke: white; - background-color: hsl(355,86%,49%); - } - .titlebar-close:hover:active { - background-color: hsl(355,82%,69%); - } - - .titlebar-button:not(:hover) > .toolbarbutton-icon:-moz-window-inactive { - opacity: 0.5; - } - } - - @media (-moz-windows-default-theme: 0) { - .titlebar-button { - background-color: -moz-field; - stroke: ButtonText; - } - .titlebar-button:hover { - background-color: SelectedItem; - stroke: SelectedItemText; - } - - .titlebar-min { - list-style-image: url(chrome://browser/skin/window-controls/minimize-highcontrast.svg); - } - - .titlebar-max { - list-style-image: url(chrome://browser/skin/window-controls/maximize-highcontrast.svg); - } - - .titlebar-restore { - list-style-image: url(chrome://browser/skin/window-controls/restore-highcontrast.svg); - } - - .titlebar-close { - list-style-image: url(chrome://browser/skin/window-controls/close-highcontrast.svg); - } - } - } +/* See bug 1715990 about why we do this ourselves on HCM */ +@media (prefers-contrast) { + :root[tabsintitlebar]:not(:-moz-lwtheme) { + background-color: ActiveCaption; + color: CaptionText; } - @media (-moz-platform: windows-win7), - (-moz-platform: windows-win8) { - :root { - background-color: transparent; - appearance: auto; - -moz-default-appearance: -moz-win-borderless-glass; - } + :root[tabsintitlebar]:not(:-moz-lwtheme):-moz-window-inactive { + background-color: InactiveCaption; + color: InactiveCaptionText; + } +} - :root[sizemode="maximized"] .titlebar-buttonbox { - margin-inline-end: 3px; - } +.titlebar-buttonbox, +.titlebar-button { + appearance: none !important; +} - /* These should be hidden w/ glass enabled. Windows draws its own buttons. */ - .titlebar-button { - display: none; - } +.titlebar-button { + border: none; + margin: 0 !important; + padding: 8px 17px; + -moz-context-properties: stroke; + stroke: currentColor; +} - /* The borders on the glass frame are ours, and inside #browser, and on - * win7 we want to make sure they are "glassy", so we can't use #browser - * as the exclude-glass container. We use #appcontent instead. */ - #appcontent { - appearance: auto; - -moz-default-appearance: -moz-win-exclude-glass; - } +.titlebar-button > .toolbarbutton-icon { + width: 12px; + height: 12px; +} + +.titlebar-min { + list-style-image: url(chrome://browser/skin/window-controls/minimize.svg); +} + +.titlebar-max { + list-style-image: url(chrome://browser/skin/window-controls/maximize.svg); +} + +.titlebar-restore { + list-style-image: url(chrome://browser/skin/window-controls/restore.svg); +} + +.titlebar-restore > .toolbarbutton-icon:-moz-locale-dir(rtl) { + transform: scaleX(-1); +} + +.titlebar-close { + list-style-image: url(chrome://browser/skin/window-controls/close.svg); +} + +:root[lwtheme-image] .titlebar-button { + -moz-context-properties: unset; +} +:root[lwtheme-image] .titlebar-min { + list-style-image: url(chrome://browser/skin/window-controls/minimize-themes.svg); +} +:root[lwtheme-image] .titlebar-max { + list-style-image: url(chrome://browser/skin/window-controls/maximize-themes.svg); +} +:root[lwtheme-image] .titlebar-restore { + list-style-image: url(chrome://browser/skin/window-controls/restore-themes.svg); +} +:root[lwtheme-image] .titlebar-close { + list-style-image: url(chrome://browser/skin/window-controls/close-themes.svg); +} + +/* the 12px image renders a 10px icon, and the 10px upscaled gets rounded to 12.5, which + * rounds up to 13px, which makes the icon one pixel too big on 1.25dppx. Fix: */ +@media (min-resolution: 1.20dppx) and (max-resolution: 1.45dppx) { + .titlebar-button > .toolbarbutton-icon { + width: 11.5px; + height: 11.5px; } +} - @media (-moz-platform: windows-win8) { - /* Artificially draw window borders that are covered by lwtheme, see bug 591930. - * Borders for win7 are below, win10 only needs something like this when - * drawing in the titlebar (-moz-windows-accent-color-in-titlebar). */ - #main-window[sizemode="normal"] #navigator-toolbox:-moz-lwtheme { - border-top: 1px solid var(--glass-shadow-color); - } +/* 175% dpi should result in the same device pixel sizes as 150% dpi. */ +@media (min-resolution: 1.70dppx) and (max-resolution: 1.95dppx) { + .titlebar-button { + padding-inline: 14.1px; } - :root[darkwindowframe="true"]:not(:-moz-window-inactive, :-moz-lwtheme) { - color: white; + .titlebar-button > .toolbarbutton-icon { + width: 10.8px; + height: 10.8px; } +} - #appcontent:not(:-moz-lwtheme) { - background-color: -moz-dialog; +/* 225% dpi should result in the same device pixel sizes as 200% dpi. */ +@media (min-resolution: 2.20dppx) and (max-resolution: 2.45dppx) { + .titlebar-button { + padding-inline: 15.3333px; + } + + .titlebar-button > .toolbarbutton-icon { + width: 10.8px; + height: 10.8px; } } -@media (-moz-windows-glass) { - #toolbar-menubar:not(:-moz-lwtheme) { - text-shadow: 0 0 .5em white, 0 0 .5em white, 0 1px 0 rgba(255,255,255,.4); +/* 275% dpi should result in the same device pixel sizes as 250% dpi. */ +@media (min-resolution: 2.70dppx) and (max-resolution: 2.95dppx) { + /* NB: todo: this should also change padding on the buttons + * themselves, but without a device to test this on, it's + * impossible to know by how much. */ + .titlebar-button > .toolbarbutton-icon { + width: 10.8px; + height: 10.8px; } +} - #main-menubar:not(:-moz-lwtheme, :-moz-window-inactive) { - background-color: rgba(255,255,255,.5); - color: black; - border-radius: 4px; +@media (-moz-windows-default-theme) { + #main-menubar > menu[_moz-menuactive="true"] { + color: inherit; + } + + #main-menubar > menu[_moz-menuactive="true"], + .titlebar-button:hover { + background-color: hsla(0,0%,0%,.12); + } + .titlebar-button:hover:active { + background-color: hsla(0,0%,0%,.22); } - /* Artificially draw window borders that are covered by lwtheme, see bug 591930. - * We use a different border for win8, and this win10+ only needs this if - * drawing in the titlebar (-moz-windows-accent-color-in-titlebar). */ - #main-window[sizemode="normal"] #navigator-toolbox:-moz-lwtheme { - border-top: 1px solid var(--glass-active-border-color); - padding-top: 1px; - box-shadow: 0 1px 0 rgba(255,255,255,.6) inset; + #toolbar-menubar[brighttext] > #menubar-items > #main-menubar > menu[_moz-menuactive="true"], + toolbar[brighttext] .titlebar-button:not(.titlebar-close):hover { + background-color: hsla(0,0%,100%,.22); + } + toolbar[brighttext] .titlebar-button:not(.titlebar-close):hover:active { + background-color: hsla(0,0%,100%,.32); + } + + .titlebar-close:hover { + stroke: white; + background-color: hsl(355,86%,49%); + } + .titlebar-close:hover:active { + background-color: hsl(355,82%,69%); } - #main-window[sizemode="normal"] #navigator-toolbox:-moz-lwtheme:-moz-window-inactive { - border-top-color: var(--glass-inactive-border-color); + .titlebar-button:not(:hover) > .toolbarbutton-icon:-moz-window-inactive { + opacity: 0.5; } } -/* Aero Basic */ -@media (-moz-windows-compositor: 0) { - @media (-moz-windows-default-theme) { - :root { - background-color: rgb(185,209,234); - } - :root:-moz-window-inactive { - background-color: rgb(215,228,242); - } +@media (-moz-windows-default-theme: 0) { + .titlebar-button { + background-color: -moz-field; + stroke: ButtonText; + } + .titlebar-button:hover { + background-color: SelectedItem; + stroke: SelectedItemText; + } - /* Render a window top border for lwthemes: */ - #main-window[tabsintitlebar][sizemode="normal"] #navigator-toolbox:-moz-lwtheme { - background-image: linear-gradient(to bottom, - var(--glass-active-border-color) 0, var(--glass-active-border-color) 1px, - rgba(255,255,255,.6) 1px, rgba(255,255,255,.6) 2px, transparent 2px); - } + .titlebar-min { + list-style-image: url(chrome://browser/skin/window-controls/minimize-highcontrast.svg); + } - #main-window[tabsintitlebar][sizemode="normal"] #navigator-toolbox:-moz-lwtheme:-moz-window-inactive { - background-image: linear-gradient(to bottom, - var(--glass-inactive-border-color) 0, var(--glass-inactive-border-color) 1px, - rgba(255,255,255,.6) 1px, rgba(255,255,255,.6) 2px, transparent 2px); - } + .titlebar-max { + list-style-image: url(chrome://browser/skin/window-controls/maximize-highcontrast.svg); + } + + .titlebar-restore { + list-style-image: url(chrome://browser/skin/window-controls/restore-highcontrast.svg); } - #print-preview-toolbar:not(:-moz-lwtheme) { - appearance: auto; - -moz-default-appearance: -moz-win-browsertabbar-toolbox; + .titlebar-close { + list-style-image: url(chrome://browser/skin/window-controls/close-highcontrast.svg); + } + + :root[darkwindowframe="true"]:not(:-moz-window-inactive, :-moz-lwtheme) { + color: white; + } + + #appcontent:not(:-moz-lwtheme) { + background-color: -moz-dialog; } } diff --git a/browser/themes/windows/browser.css b/browser/themes/windows/browser.css index f1f0c22b5d6ef..95d6cfefd9785 100644 --- a/browser/themes/windows/browser.css +++ b/browser/themes/windows/browser.css @@ -6,8 +6,6 @@ @import url("chrome://browser/skin/contextmenu.css"); @import url("chrome://browser/skin/browser-custom-colors.css"); -@namespace html url("http://www.w3.org/1999/xhtml"); - :root { --toolbar-non-lwt-bgcolor: color-mix(in srgb, -moz-dialog 85%, white); --toolbar-non-lwt-textcolor: -moz-dialogtext; @@ -40,37 +38,20 @@ color: -moz-menuhovertext; } -/* Use a different color only on Windows 8 and higher in inactive windows. - * On Win 7, the menubar fog disappears for inactive windows, and renders gray - * illegible. - */ +/* Use a different color in inactive windows. */ @media (-moz-windows-default-theme) { - @media not (-moz-platform: windows-win7) { - #toolbar-menubar:not(:-moz-lwtheme):-moz-window-inactive { - color: ThreeDShadow; - } + #toolbar-menubar:not(:-moz-lwtheme):-moz-window-inactive { + color: ThreeDShadow; } } -@media not (-moz-platform: windows-win7) { - @media not (-moz-platform: windows-win8) { - /* On Windows 10, when temporarily showing the menu bar, make it at least as - * tall as the tab bar such that the window controls don't appear to move up. */ - :root[tabsintitlebar] #toolbar-menubar[autohide="true"] { - height: calc(var(--tab-min-height) - var(--tabs-navbar-shadow-size)); - } - :root[tabsintitlebar][sizemode="normal"] #toolbar-menubar[autohide="true"] { - height: calc(var(--tab-min-height) - var(--tabs-navbar-shadow-size)); - } - } +/* When temporarily showing the menu bar, make it at least as tall as the + * tab bar such that the window controls don't appear to move up. */ +:root[tabsintitlebar] #toolbar-menubar[autohide="true"] { + height: calc(var(--tab-min-height) - var(--tabs-navbar-shadow-size)); } - -/* Add 4px extra margin on top of the tabs toolbar on Windows 7. */ -@media (-moz-platform: windows-win7) { - :root[sizemode="normal"][chromehidden~="menubar"] #TabsToolbar > .toolbar-items, - :root[sizemode="normal"] #toolbar-menubar[autohide="true"][inactive] + #TabsToolbar > .toolbar-items { - padding-top: 4px; - } +:root[tabsintitlebar][sizemode="normal"] #toolbar-menubar[autohide="true"] { + height: calc(var(--tab-min-height) - var(--tabs-navbar-shadow-size)); } #navigator-toolbox, @@ -84,18 +65,7 @@ color: var(--toolbar-color); } -/* Add a fog for background tabs to be visible on Windows 7 glass window background */ -@media (-moz-platform: windows-win7) { - @media (-moz-windows-default-theme) { - #TabsToolbar:not(:-moz-lwtheme) { - background-image: radial-gradient(ellipse at bottom, rgba(255,255,255,0.8), rgba(255,255,255,0.5) 80%, transparent); - } - } -} - -@media (-moz-windows-compositor: 0), - (-moz-windows-default-theme: 0), - (-moz-platform: windows-win8) { +@media not (-moz-windows-default-theme) { /* Please keep the menu text colors in this media block in sync with * light-dark-overrides.css, minus the :not(:-moz-lwtheme) condition - see Bug 1165718. */ @@ -108,53 +78,20 @@ } } -@media (-moz-windows-classic) { - /** - * In the classic themes, the titlebar has a horizontal gradient, which is - * problematic for reading the text of background tabs when they're in the - * titlebar. We side-step this issue by layering our own background underneath - * the tabs. - */ - :root[tabsintitlebar]:not([sizemode=fullscreen]) #TabsToolbar:not(:-moz-lwtheme) { - background-image: linear-gradient(transparent, ActiveCaption); - background-size: auto 200%; - } - - :root[tabsintitlebar]:not([sizemode=fullscreen]) #TabsToolbar:not(:-moz-lwtheme):-moz-window-inactive { - background-image: linear-gradient(transparent, InactiveCaption); - } - - /* Add a window top border for webextension themes */ - :root[tabsintitlebar][sizemode="normal"] #navigator-toolbox:-moz-lwtheme { - background-image: linear-gradient(to bottom, - ThreeDLightShadow 0, ThreeDLightShadow 1px, - ThreeDHighlight 1px, ThreeDHighlight 2px, - ActiveBorder 2px, ActiveBorder 4px, transparent 4px); - } - - :root[tabsintitlebar] :is(#TabsToolbar, #toolbar-menubar) toolbarbutton:not(:-moz-lwtheme) { - color: inherit; - } -} - #nav-bar:not([tabs-hidden="true"]) { /* This is needed for some toolbar button animations. Gross :( */ position: relative; } -@media (-moz-windows-default-theme: 0) { +@media not (-moz-windows-default-theme) { #nav-bar:not(:-moz-lwtheme) { box-shadow: 0 calc(-1 * var(--tabs-navbar-shadow-size)) 0 ThreeDShadow; } } + #nav-bar:-moz-lwtheme { box-shadow: 0 calc(-1 * var(--tabs-navbar-shadow-size)) 0 var(--lwt-tabs-border-color, rgba(0,0,0,.3)); } -@media (-moz-windows-compositor: 0) { - #nav-bar[tabs-hidden="true"] { - box-shadow: none; - } -} #print-preview-toolbar:not(:-moz-lwtheme) { appearance: auto; @@ -173,29 +110,6 @@ -moz-default-appearance: -moz-window-titlebar-maximized; } -@media (-moz-windows-compositor: 0) { - /** - * Anytime we're not using the compositor on Windows, the -moz-window-titlebar - * and -moz-window-titlebar-maximized values for -moz-appearance override - * backgrounds supplied by lwthemes. We make the #titlebar itself hidden, but - * it's children visible in order to hide the background but keep the margin and - * padding that comes from those -moz-window-titlebar rules. - */ - :root:not([inFullscreen]) #titlebar:-moz-lwtheme { - visibility: hidden; - } - :root:not([inFullscreen], [chromehidden~="menubar"]) #toolbar-menubar:-moz-lwtheme, - :root:not([inFullscreen], [chromehidden~="toolbar"]) #TabsToolbar:-moz-lwtheme { - visibility: visible; - } -} - -@media (-moz-windows-classic) { - :root[tabsintitlebar][sizemode="normal"] #toolbar-menubar { - margin-top: 4px; - } -} - .titlebar-buttonbox { /* For all Windows configurations except for Windows Aero and Windows Aero Basic, * the default -moz-default-appearance of -moz-window-button-box and @@ -216,19 +130,12 @@ align-items: stretch; } -@media (-moz-platform: windows-win7), - (-moz-platform: windows-win8) { - /* Preserve window control buttons position at the top of the button box. */ - .titlebar-buttonbox-container { - align-items: flex-start; - } -} - /* Window control buttons */ .titlebar-min { appearance: auto; -moz-default-appearance: -moz-window-button-minimize; + margin-inline-end: 2px; } .titlebar-max { @@ -246,12 +153,6 @@ -moz-default-appearance: -moz-window-button-close; } -@media (-moz-windows-classic: 0) { - .titlebar-min { - margin-inline-end: 2px; - } -} - :root[tabletmode] .titlebar-min, :root[tabletmode] .titlebar-restore, :root[tabletmode] .titlebar-max { @@ -303,7 +204,7 @@ menuitem.bookmark-item { } } -@media (-moz-windows-default-theme: 0) { +@media not (-moz-windows-default-theme) { /* Windows HCM conventions use these colors for chiclets. We can't use them on other platforms because AccentColor can be shown atop SelectedItem, which has zero contrast. */ @@ -322,7 +223,7 @@ menuitem.bookmark-item { /* Address bar results view */ -@media (-moz-windows-default-theme: 0) { +@media not (-moz-windows-default-theme) { :root:not(:-moz-lwtheme) { --urlbar-popup-action-color: -moz-nativehyperlinktext; } @@ -347,7 +248,7 @@ menuitem.bookmark-item { padding: 0; } -@media (-moz-windows-default-theme: 0) { +@media not (-moz-windows-default-theme) { /* For high contrast themes. */ #tabbrowser-tabpanels, :root[privatebrowsingmode=temporary] #tabbrowser-tabpanels { @@ -471,91 +372,83 @@ menupopup[touchmode] :is(menu, menuitem, menucaption) { padding-block: calc((3.5em - 32px) / 2); } -@media not (-moz-windows-non-native-menus) { - #context-navigation { - background-color: menu; - } +/* :not([hidden]) to avoid the display: flex unhiding the item. */ +#context-navigation:not([hidden]) { + /* Use modern flex box so we can use percentage widths to redistribute + * spacing manually. */ + display: flex; + flex-direction: row; + /* We want the first and last icons to align with the text items which + * have 1em inline padding, and for icons to be centered within their + * hover state, so each icon of 16px needs 1em padding on both sides: + */ + --menuitem-min-width: calc(2em + 16px); + /* The total width of the container should then be at least 4 times that: */ + min-width: calc(4 * var(--menuitem-min-width)); } -@media (-moz-windows-non-native-menus) { - /* :not([hidden]) to avoid the display: flex unhiding the item. */ - #context-navigation:not([hidden]) { - /* Use modern flex box so we can use percentage widths to redistribute - * spacing manually. */ - display: flex; - flex-direction: row; - /* We want the first and last icons to align with the text items which - * have 1em inline padding, and for icons to be centered within their - * hover state, so each icon of 16px needs 1em padding on both sides: - */ - --menuitem-min-width: calc(2em + 16px); - /* The total width of the container should then be at least 4 times that: */ - min-width: calc(4 * var(--menuitem-min-width)); - } - - #context-navigation > .menuitem-iconic { - flex: 1 0 auto; - } +#context-navigation > .menuitem-iconic { + flex: 1 0 auto; +} - #context-navigation > .menuitem-iconic[_moz-menuactive="true"] { - /* We only show hover state on the icons. This ensures there is no - * dead space between icons, but the visible hover state is only - * around the icons, and all the icons' hover states match each other. - */ - background-color: transparent; - } +#context-navigation > .menuitem-iconic[_moz-menuactive="true"] { + /* We only show hover state on the icons. This ensures there is no + * dead space between icons, but the visible hover state is only + * around the icons, and all the icons' hover states match each other. + */ + background-color: transparent; +} - #context-navigation > .menuitem-iconic > .menu-iconic-left { - margin: 0; - padding: 0; - } +#context-navigation > .menuitem-iconic > .menu-iconic-left { + margin: 0; + padding: 0; +} - /* override styles from shared/contextmenu.inc.css */ - #context-navigation > .menuitem-iconic > .menu-iconic-left > .menu-iconic-icon { - width: var(--menuitem-min-width); - height: 32px; - padding: 8px 1em; - margin: 0; - } - #context-navigation > .menuitem-iconic[_moz-menuactive="true"] > .menu-iconic-left > .menu-iconic-icon { - background-color: -moz-menuhover; - } +/* override styles from shared/contextmenu.inc.css */ +#context-navigation > .menuitem-iconic > .menu-iconic-left > .menu-iconic-icon { + width: var(--menuitem-min-width); + height: 32px; + padding: 8px 1em; + margin: 0; +} +#context-navigation > .menuitem-iconic[_moz-menuactive="true"] > .menu-iconic-left > .menu-iconic-icon { + background-color: -moz-menuhover; +} - #context-navigation > .menuitem-iconic[_moz-menuactive="true"][disabled="true"] > .menu-iconic-left > .menu-iconic-icon { - background-color: -moz-menuhoverdisabled; - } +#context-navigation > .menuitem-iconic[_moz-menuactive="true"][disabled="true"] > .menu-iconic-left > .menu-iconic-icon { + background-color: -moz-menuhoverdisabled; +} - /* If the menu is wider than the icons strictly need, the elements - * will stretch to pick up the extra space. In that case, the outer icons - * should align to the start/end of their containing : */ - #context-navigation > .menuitem-iconic:first-child { - justify-content: flex-start; - } +/* If the menu is wider than the icons strictly need, the elements + * will stretch to pick up the extra space. In that case, the outer icons + * should align to the start/end of their containing : */ +#context-navigation > .menuitem-iconic:first-child { + justify-content: flex-start; +} - #context-navigation > .menuitem-iconic:last-child { - justify-content: flex-end; - } +#context-navigation > .menuitem-iconic:last-child { + justify-content: flex-end; +} - #context-navigation > .menuitem-iconic:last-child, - #context-navigation > .menuitem-iconic:first-child { - flex-grow: 0; - /* The first and last items start off as 16px + 2em, like the other ones. - * 100% is the width of the parent, which will be at least 4 * the width of - * an individual item (16px + 2em) - * So 100% - 4 item widths gets us the remaining available space if - * #context-navigation is wider than that. - * Then divide by 6 to get the 1/6 of that extra space, and add this space - * to the width of the first/last items. - * This ensures that the 3 visual gaps between the 4 icons are all the same - * size, with each 1/3 of the available space evenly distributed between - * the 2 items on either side of the gap. - */ - width: calc(var(--menuitem-min-width) + calc(100% - 4 * var(--menuitem-min-width)) / 6); - } +#context-navigation > .menuitem-iconic:last-child, +#context-navigation > .menuitem-iconic:first-child { + flex-grow: 0; + /* The first and last items start off as 16px + 2em, like the other ones. + * 100% is the width of the parent, which will be at least 4 * the width of + * an individual item (16px + 2em) + * So 100% - 4 item widths gets us the remaining available space if + * #context-navigation is wider than that. + * Then divide by 6 to get the 1/6 of that extra space, and add this space + * to the width of the first/last items. + * This ensures that the 3 visual gaps between the 4 icons are all the same + * size, with each 1/3 of the available space evenly distributed between + * the 2 items on either side of the gap. + */ + width: calc(var(--menuitem-min-width) + calc(100% - 4 * var(--menuitem-min-width)) / 6); +} - /* Other menu separators don't extend all the way to the menu edges, but the - one below the navigation buttons in the content context menu should. */ - #context-sep-navigation { - padding-inline: 0; - } +/* Other menu separators don't extend all the way to the menu edges, but the + one below the navigation buttons in the content context menu should. */ +#context-sep-navigation { + padding-inline: 0; } diff --git a/browser/themes/windows/customizableui/panelUI.css b/browser/themes/windows/customizableui/panelUI.css index af8a210b552ef..2eb4775aa10e3 100644 --- a/browser/themes/windows/customizableui/panelUI.css +++ b/browser/themes/windows/customizableui/panelUI.css @@ -14,13 +14,3 @@ menupopup::part(drop-indicator) { .toolbar-menupopup { --nested-margin: calc(-1 * (var(--arrowpanel-menuitem-padding-inline) + var(--panel-shadow-margin))); } - -@media not (-moz-windows-non-native-menus) { - .toolbar-menupopup { - --panel-shadow-margin: 4px; - } - - .toolbar-menupopup menupopup { - margin-inline-start: var(--nested-margin); - } -} diff --git a/editor/reftests/xul/input.css b/editor/reftests/xul/input.css index 17432527b2ec9..cec3f94d3be6c 100644 --- a/editor/reftests/xul/input.css +++ b/editor/reftests/xul/input.css @@ -20,12 +20,6 @@ html|input.empty { color: graytext; } -@media (-moz-windows-default-theme) and (-moz-platform: windows-win7) { - :root:not(.winxp) html|input.empty { - font-style: italic; - } -} - html|input.num { text-align: end; } diff --git a/layout/style/GeckoBindings.h b/layout/style/GeckoBindings.h index 9e5ffc264bbbf..c6f58518e079d 100644 --- a/layout/style/GeckoBindings.h +++ b/layout/style/GeckoBindings.h @@ -612,8 +612,6 @@ bool Gecko_IsDOMWorkerThread(); mozilla::StyleDisplayMode Gecko_MediaFeatures_GetDisplayMode( const mozilla::dom::Document*); -bool Gecko_MediaFeatures_WindowsNonNativeMenus(const mozilla::dom::Document*); - bool Gecko_MediaFeatures_ShouldAvoidNativeTheme(const mozilla::dom::Document*); bool Gecko_MediaFeatures_UseOverlayScrollbars(const mozilla::dom::Document*); int32_t Gecko_MediaFeatures_GetColorDepth(const mozilla::dom::Document*); diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp index 581b6da29ba6b..5e4fe65abcc37 100644 --- a/layout/style/nsMediaFeatures.cpp +++ b/layout/style/nsMediaFeatures.cpp @@ -94,11 +94,6 @@ static nsSize GetDeviceSize(const Document& aDocument) { return size; } -bool Gecko_MediaFeatures_WindowsNonNativeMenus(const Document* aDocument) { - return LookAndFeel::WindowsNonNativeMenusEnabled() || - aDocument->ShouldAvoidNativeTheme(); -} - bool Gecko_MediaFeatures_IsResourceDocument(const Document* aDocument) { return aDocument->IsResourceDoc(); } @@ -248,17 +243,6 @@ bool Gecko_MediaFeatures_MatchesPlatform(StylePlatform aPlatform) { #if defined(XP_WIN) case StylePlatform::Windows: return true; - case StylePlatform::WindowsWin10: - case StylePlatform::WindowsWin7: - case StylePlatform::WindowsWin8: { - if (IsWin10OrLater()) { - return aPlatform == StylePlatform::WindowsWin10; - } - if (IsWin8OrLater()) { - return aPlatform == StylePlatform::WindowsWin8; - } - return aPlatform == StylePlatform::WindowsWin7; - } #elif defined(ANDROID) case StylePlatform::Android: return true; diff --git a/layout/style/test/chrome/bug418986-2.js b/layout/style/test/chrome/bug418986-2.js index 99ca030116059..b4d4002dd7006 100644 --- a/layout/style/test/chrome/bug418986-2.js +++ b/layout/style/test/chrome/bug418986-2.js @@ -56,9 +56,7 @@ var suppressed_toggles = [ "-moz-scrollbar-end-forward", "-moz-scrollbar-start-backward", "-moz-scrollbar-start-forward", - "-moz-windows-compositor", "-moz-windows-default-theme", - "-moz-windows-glass", "-moz-gtk-csd-available", "-moz-gtk-csd-minimize-button", "-moz-gtk-csd-maximize-button", @@ -71,12 +69,6 @@ var toggles_enabled_in_content = []; // Read the current OS. var OS = SpecialPowers.Services.appinfo.OS; -// If we are using Windows, add an extra toggle only -// available on that OS. -if (OS === "WINNT") { - suppressed_toggles.push("-moz-windows-classic"); -} - // __keyValMatches(key, val)__. // Runs a media query and returns true if key matches to val. var keyValMatches = (key, val) => diff --git a/layout/style/test/chrome/chrome-only-media-queries.js b/layout/style/test/chrome/chrome-only-media-queries.js index ae71857d6601f..f1f483008454f 100644 --- a/layout/style/test/chrome/chrome-only-media-queries.js +++ b/layout/style/test/chrome/chrome-only-media-queries.js @@ -7,17 +7,11 @@ const CHROME_ONLY_TOGGLES = [ "-moz-scrollbar-end-backward", "-moz-scrollbar-end-forward", "-moz-overlay-scrollbars", - "-moz-windows-classic", - "-moz-windows-compositor", "-moz-windows-default-theme", "-moz-mac-graphite-theme", "-moz-mac-big-sur-theme", "-moz-menubar-drag", "-moz-windows-accent-color-in-titlebar", - "-moz-windows-compositor", - "-moz-windows-classic", - "-moz-windows-glass", - "-moz-windows-non-native-menus", "-moz-swipe-animation-enabled", "-moz-gtk-csd-available", "-moz-gtk-csd-minimize-button", @@ -34,9 +28,6 @@ const CHROME_ONLY_QUERIES = [ "(-moz-platform: windows)", "(-moz-platform: macos)", "(-moz-platform: android)", - "(-moz-platform: windows-win7)", - "(-moz-platform: windows-win8)", - "(-moz-platform: windows-win10)", "(-moz-content-prefers-color-scheme: dark)", "(-moz-content-prefers-color-scheme: light)", ]; diff --git a/servo/components/style/gecko/media_features.rs b/servo/components/style/gecko/media_features.rs index 8f049ce88ccfa..2e430aee3052a 100644 --- a/servo/components/style/gecko/media_features.rs +++ b/servo/components/style/gecko/media_features.rs @@ -572,12 +572,6 @@ pub enum Platform { Macos, /// Matches any Windows version. Windows, - /// Matches only Windows 7. - WindowsWin7, - /// Matches only Windows 8. - WindowsWin8, - /// Matches windows 10 and actually matches windows 11 too, as of right now. - WindowsWin10, } fn eval_moz_platform(_: &Context, query_value: Option) -> bool { @@ -614,10 +608,6 @@ fn eval_scripting(context: &Context, query_value: Option) -> bool { } } -fn eval_moz_windows_non_native_menus(context: &Context) -> bool { - unsafe { bindings::Gecko_MediaFeatures_WindowsNonNativeMenus(context.device().document()) } -} - fn eval_moz_overlay_scrollbars(context: &Context) -> bool { unsafe { bindings::Gecko_MediaFeatures_UseOverlayScrollbars(context.device().document()) } } @@ -694,7 +684,7 @@ macro_rules! bool_pref_feature { /// to support new types in these entries and (2) ensuring that either /// nsPresContext::MediaFeatureValuesChanged is called when the value that /// would be returned by the evaluator function could change. -pub static MEDIA_FEATURES: [QueryFeatureDescription; 68] = [ +pub static MEDIA_FEATURES: [QueryFeatureDescription; 64] = [ feature!( atom!("width"), AllowsRanges::Yes, @@ -958,12 +948,6 @@ pub static MEDIA_FEATURES: [QueryFeatureDescription; 68] = [ Evaluator::BoolInteger(eval_moz_non_native_content_theme), FeatureFlags::CHROME_AND_UA_ONLY, ), - feature!( - atom!("-moz-windows-non-native-menus"), - AllowsRanges::No, - Evaluator::BoolInteger(eval_moz_windows_non_native_menus), - FeatureFlags::CHROME_AND_UA_ONLY, - ), feature!( atom!("-moz-overlay-scrollbars"), AllowsRanges::No, @@ -999,9 +983,6 @@ pub static MEDIA_FEATURES: [QueryFeatureDescription; 68] = [ atom!("-moz-windows-accent-color-in-titlebar"), WindowsAccentColorInTitlebar ), - lnf_int_feature!(atom!("-moz-windows-compositor"), DWMCompositor), - lnf_int_feature!(atom!("-moz-windows-classic"), WindowsClassic), - lnf_int_feature!(atom!("-moz-windows-glass"), WindowsGlass), lnf_int_feature!(atom!("-moz-swipe-animation-enabled"), SwipeAnimationEnabled), lnf_int_feature!(atom!("-moz-gtk-csd-available"), GTKCSDAvailable), lnf_int_feature!(atom!("-moz-gtk-csd-minimize-button"), GTKCSDMinimizeButton), diff --git a/toolkit/themes/shared/checkbox.css b/toolkit/themes/shared/checkbox.css index 725c995a4d413..26c06fe3d3b96 100644 --- a/toolkit/themes/shared/checkbox.css +++ b/toolkit/themes/shared/checkbox.css @@ -119,13 +119,6 @@ checkbox:not([native]):focus-visible > .checkbox-check { color: GrayText; } - @media (-moz-windows-classic) { - checkbox[native][disabled="true"] { - color: ThreeDShadow; - text-shadow: 1px 1px ThreeDHighlight; - } - } - /* ::::: checkmark image ::::: */ .checkbox-check[native] { diff --git a/toolkit/themes/shared/tree.css b/toolkit/themes/shared/tree.css index 33a52cacaeac8..3a3e652d6e34d 100644 --- a/toolkit/themes/shared/tree.css +++ b/toolkit/themes/shared/tree.css @@ -271,27 +271,6 @@ html|input.tree-input { color: -moz-ButtonActiveText; } } - - @media (-moz-windows-classic) { - treecol, - .tree-columnpicker-button { - border: 1px solid; - border-top-color: ThreeDHighlight; - border-inline-end-color: ThreeDShadow; - border-bottom-color: ThreeDShadow; - border-inline-start-color: ThreeDHighlight; - box-shadow: none; - background-color: -moz-Dialog; - } - - treecol:where(:hover:active), - .tree-columnpicker-button:where(:hover:active) { - border-top-color: ThreeDShadow; - border-inline-end-color: ThreeDHighlight; - border-bottom-color: ThreeDHighlight; - border-inline-start-color: ThreeDShadow; - } - } } /* Stylelint doesn't cope with the Level 4 media query here. diff --git a/toolkit/themes/windows/global/button.css b/toolkit/themes/windows/global/button.css index 14a6be2e93566..8f5fb14059626 100644 --- a/toolkit/themes/windows/global/button.css +++ b/toolkit/themes/windows/global/button.css @@ -50,7 +50,7 @@ button:focus-visible { /* .......... default/hover/focused state .......... */ -@media (prefers-contrast) and (-moz-windows-compositor) { +@media (prefers-contrast) { /* This is for high-contrast black and white themes on Windows 8 and later, where the native appearance renders a different background (which appears to be equivalent to the Highlight color) if the button is in the @@ -69,13 +69,6 @@ button:where([disabled="true"]) { background-color: ButtonFace; } -@media (-moz-windows-classic) { - button:where([disabled="true"]) { - color: ThreeDShadow; - text-shadow: 1px 1px ThreeDHighlight; - } -} - /* ::::: menu buttons ::::: */ .button-menu-dropmarker { diff --git a/toolkit/themes/windows/global/global.css b/toolkit/themes/windows/global/global.css index 94ad3f064add4..ba032facb7a1e 100644 --- a/toolkit/themes/windows/global/global.css +++ b/toolkit/themes/windows/global/global.css @@ -15,19 +15,14 @@ background-color: -moz-Dialog; color: -moz-DialogText; font: message-box; + /* Override some menu color variables for light browser themes. */ + --menu-icon-opacity: 0.7; } -@media (-moz-windows-non-native-menus) { +/* Override the menu color variables for dark browser themes. */ +@media (prefers-color-scheme: dark) { :root { - /* Override some menu color variables for light browser themes. */ - --menu-icon-opacity: 0.7; - } - - /* Override the menu color variables for dark browser themes. */ - @media (prefers-color-scheme: dark) { - :root { - --menu-icon-opacity: 1; - } + --menu-icon-opacity: 1; } } @@ -109,15 +104,6 @@ xul|separator.groove[orient="vertical"] { margin-inline: 0.4em; } -/* Windows classic disabled labels */ - -@media (-moz-windows-classic) { - xul|label[disabled="true"] { - color: ThreeDShadow; - text-shadow: 1px 1px ThreeDHighlight; - } -} - /* Input margins */ html|input { diff --git a/toolkit/themes/windows/global/menu.css b/toolkit/themes/windows/global/menu.css index bf3dca827e853..d5222000ea399 100644 --- a/toolkit/themes/windows/global/menu.css +++ b/toolkit/themes/windows/global/menu.css @@ -20,31 +20,11 @@ menubar { menu, menuitem, menucaption { - appearance: auto; - -moz-default-appearance: menuitem; flex-shrink: 0; align-items: center; list-style-image: none; } -@media (-moz-windows-non-native-menus) { - /* For Windows 10, prevent using native OS drawing of certain menu elements, - especially background colors and shadows. */ - menu, menuitem, menucaption { - appearance: none; - } - - /* Menu item text also needs native drawing disabled. */ - menu > .menu-text, - menuitem > .menu-text, - menu > .menu-iconic-text, - menuitem > .menu-iconic-text { - appearance: none; - margin-inline-start: 0 !important; /* need !important to override the other !important below... */ - padding-inline-end: 0; - } -} - menu:where([disabled="true"]), menuitem:where([disabled="true"]), menu:where([_moz-menuactive="true"][disabled="true"]), @@ -53,20 +33,9 @@ menuitem:where([_moz-menuactive="true"][disabled="true"]) { text-shadow: none; } -@media (-moz-windows-non-native-menus) { - menu:where([_moz-menuactive="true"][disabled="true"]), - menuitem:where([_moz-menuactive="true"][disabled="true"]) { - background-color: -moz-menuhoverdisabled; - } -} - -@media (-moz-windows-classic) { - menu[disabled="true"], - menubar > menu[disabled="true"][_moz-menuactive="true"], - menuitem[disabled="true"] { - color: ThreeDShadow; - text-shadow: 1px 1px ThreeDHighlight; - } +menu:where([_moz-menuactive="true"][disabled="true"]), +menuitem:where([_moz-menuactive="true"][disabled="true"]) { + background-color: -moz-menuhoverdisabled; } menuitem[default="true"], @@ -89,27 +58,11 @@ menubar > menu:-moz-window-inactive { padding: 1px 0; } -.menu-text { - padding-inline-start: 1.45em !important; - appearance: auto; - -moz-default-appearance: menuitemtext; -} - -.menu-text, -.menu-iconic-text { - margin-inline-start: 2px !important; - padding-inline-end: 2px; -} - .menu-accel, .menu-iconic-accel { margin-inline: 0.74em 1.35em !important; } -.menu-iconic-left { - width: 1.45em; -} - .menu-iconic-icon { width: 16px; height: 16px; @@ -122,46 +75,25 @@ menubar > menu:-moz-window-inactive { padding-top: 2px; } -/* Don't leave space for icons on Win10. */ -@media (-moz-windows-non-native-menus) { - .menu-text { - padding-inline-start: 0 !important; - } -} - /* ..... menu arrow box ..... */ +/* Override the native menu arrow with a custom one for Win10. */ .menu-right { - appearance: auto; - -moz-default-appearance: menuarrow; - margin-inline-end: -2px; - list-style-image: none; - width: 1.28em; - padding-top: 1px; + list-style-image: url("chrome://global/skin/icons/arrow-right.svg"); + -moz-context-properties: fill, fill-opacity; + fill: currentColor; + fill-opacity: var(--menu-icon-opacity); + margin-inline-end: 1em; } -/* Override the native menu arrow with a custom one for Win10. */ -@media (-moz-windows-non-native-menus) { - .menu-right { - appearance: none; - width: unset; - list-style-image: url("chrome://global/skin/icons/arrow-right.svg"); - -moz-context-properties: fill, fill-opacity; - fill: currentColor; - fill-opacity: var(--menu-icon-opacity); - margin-inline-end: 1em; - padding-top: 0; - } - - .menu-right > image { - /* Do not make this smaller than the size of the svg, but upscale for - * people with large fonts. */ - width: max(1em, 16px); - } - - .menu-right:-moz-locale-dir(rtl) { - list-style-image: url("chrome://global/skin/icons/arrow-left.svg"); - } +.menu-right > image { + /* Do not make this smaller than the size of the svg, but upscale for + * people with large fonts. */ + width: max(1em, 16px); +} + +.menu-right:-moz-locale-dir(rtl) { + list-style-image: url("chrome://global/skin/icons/arrow-left.svg"); } /* ::::: menu/menuitems in menubar ::::: */ @@ -170,16 +102,6 @@ menubar > menu[_moz-menuactive="true"]:not([disabled="true"]) { color: -moz-menubarhovertext; } -@media (-moz-windows-classic) { - menubar > menu { - border: 2px solid transparent; - } - - menubar > menu[_moz-menuactive="true"][open="true"] { - border-width: 3px 1px 1px 3px; - } -} - menubar > menu:-moz-lwtheme { appearance: none; border-color: transparent; @@ -195,18 +117,6 @@ menubar > menu:-moz-lwtheme[_moz-menuactive="true"]:not([disabled="true"]) { text-shadow: none; } -@media (-moz-windows-default-theme) { - menubar > menu:-moz-lwtheme { - appearance: auto; - -moz-default-appearance: menuitem; - } - - menubar > menu:-moz-lwtheme[_moz-menuactive="true"]:not([disabled="true"]) { - color: inherit !important; - text-shadow: inherit; - } -} - /* ..... internal content .... */ .menubar-text { @@ -235,27 +145,10 @@ menulist > menupopup > menu { max-width: none; } -@media (-moz-windows-non-native-menus) { - menulist > menupopup > menuitem { - padding-inline-end: 1em; - } +menulist > menupopup > menuitem { + padding-inline-end: 1em; } -@media not (-moz-windows-non-native-menus) { - menulist > menupopup > menuitem, - menulist > menupopup > menucaption, - menulist > menupopup > menu { - appearance: none !important; - border: 1px solid transparent; - padding-inline: 5px; - } - - menulist > menupopup > menuitem[_moz-menuactive="true"], - menulist > menupopup > menu[_moz-menuactive="true"] { - background-color: highlight; - color: highlighttext; - } -} menulist > menupopup > menuitem > .menu-iconic-left, menulist > menupopup > menucaption > .menu-iconic-left, @@ -273,93 +166,42 @@ menulist > menupopup > menuitem[_moz-menuactive="true"][disabled="true"] { color: GrayText; } -@media (-moz-windows-classic) { - menulist > menupopup > menuitem[disabled="true"]:not([_moz-menuactive="true"]) { - color: GrayText; - text-shadow: none; - } -} - menulist > menupopup > :is(menuitem, menucaption):not(.menuitem-iconic) > .menu-iconic-text { margin: 0 !important; } /* ::::: checkbox and radio menuitems ::::: */ -menuitem:is([type="checkbox"], [checked="true"]) { - appearance: auto; - -moz-default-appearance: checkmenuitem; -} - -menuitem:is([type="checkbox"], [checked="true"]) > .menu-iconic-left { - appearance: auto; - -moz-default-appearance: menucheckbox; - padding-top: 0; -} - -menuitem[type="radio"] { - appearance: auto; - -moz-default-appearance: radiomenuitem; +menupopup[needsgutter] menu:not([icon], .menu-iconic), +menupopup[needsgutter] menuitem:not([checked="true"], [icon], .menuitem-iconic) { + padding-inline-start: 36px; } -menuitem[type="radio"] > .menu-iconic-left { - appearance: auto; - -moz-default-appearance: menuradio; - padding-top: 0; +.menu-iconic > .menu-iconic-left, +.menuitem-iconic > .menu-iconic-left { + margin-inline-end: 8px; } -menuitem:is([type="checkbox"], [checked="true"], [type="radio"]) > .menu-iconic-left > .menu-iconic-icon { - /* prevent .menu-iconic-icon from enforcing a minimal height of 16px (see bug 411064) - XXXzeniko apply that .menu-iconic-icon rule only for children of .menu-iconic */ - display: none; +menuitem[checked="true"] { + padding-inline-start: 12px; } -@media (-moz-windows-non-native-menus) { - menupopup[needsgutter] menu:not([icon], .menu-iconic), - menupopup[needsgutter] menuitem:not([checked="true"], [icon], .menuitem-iconic) { - padding-inline-start: 36px; - } - - /* For Windows 10, checkbox, radio and iconified menuitems need the default - appearance disabled so they pick up our custom styles instead. */ - .menu-iconic-left, - menuitem[type="checkbox"], - menuitem[type="radio"] { - appearance: none !important; /* to override more specific selectors above. */ - width: unset; - } - - .menu-iconic > .menu-iconic-left, - .menuitem-iconic > .menu-iconic-left { - margin-inline-end: 8px; - } - - menuitem[checked="true"] { - padding-inline-start: 12px; - } - - /* We need to do something to override the default style for selected - checkboxes and radio buttons because the native drawing we use on other - Windows versions looks pretty bad with the Win10 styles, so for now we'll - insert a generic checkmark icon for both types. */ - menuitem[checked="true"] > .menu-iconic-left { - -moz-context-properties: fill, fill-opacity; - fill: currentColor; - fill-opacity: var(--menu-icon-opacity); - list-style-image: url("chrome://global/skin/icons/menu-check.svg"); - width: 16px; - margin-inline-end: 8px; - } - menuitem[checked="true"] > .menu-iconic-left > .menu-iconic-icon { - display: initial; - } +/* We need to do something to override the default style for selected + checkboxes and radio buttons because the native drawing we use on other + Windows versions looks pretty bad with the Win10 styles, so for now we'll + insert a generic checkmark icon for both types. */ +menuitem[checked="true"] > .menu-iconic-left { + -moz-context-properties: fill, fill-opacity; + fill: currentColor; + fill-opacity: var(--menu-icon-opacity); + list-style-image: url("chrome://global/skin/icons/menu-check.svg"); + width: 16px; + margin-inline-end: 8px; } /* ::::: menuseparator ::::: */ -@media (-moz-windows-non-native-menus) { - menuseparator { - /* The side padding should align with the start of the menu item text. */ - padding-inline: 1em; - } +menuseparator { + /* The side padding should align with the start of the menu item text. */ + padding-inline: 1em; } diff --git a/toolkit/themes/windows/global/popup.css b/toolkit/themes/windows/global/popup.css index 54ffa2ec8ebeb..dbf12347a68e7 100644 --- a/toolkit/themes/windows/global/popup.css +++ b/toolkit/themes/windows/global/popup.css @@ -23,45 +23,22 @@ panel { margin: calc(-1 * var(--panel-shadow-margin)); } -@media not (-moz-windows-non-native-menus) { - menupopup { - appearance: auto; - -moz-default-appearance: menupopup; - - /* Native menus are always light */ - color-scheme: light !important; +menupopup { + /* Prevent any background or border around the outside of the shadow. */ + background-color: transparent; + border: none; - /* We set the background-color / border here so that it doesn't interfere with native styling. */ - background-color: Menu; - border: 1px solid ThreeDShadow; - --panel-background: transparent; - --panel-border-color: transparent; - --nested-margin: -3px; - --panel-shadow-margin: 0px; - } + --panel-border-radius: 4px; + --panel-padding: 4px 0; + --panel-border-color: ThreeDShadow; + --panel-background: Menu; + --nested-margin: -10px; } -@media (-moz-windows-non-native-menus) { - menupopup { - /* Disable the default appearance so we can override the native styling. */ - appearance: none; - - /* Prevent any background or border around the outside of the shadow. */ - background-color: transparent; - border: none; - - --panel-border-radius: 4px; - --panel-padding: 4px 0; - --panel-border-color: ThreeDShadow; - --panel-background: Menu; - --nested-margin: -10px; - } - - menupopup > menuitem, - menupopup > menu { - padding-block: 0.5em; - padding-inline-start: 1em; - } +menupopup > menuitem, +menupopup > menu { + padding-block: 0.5em; + padding-inline-start: 1em; } menupopup > menu > menupopup { @@ -113,13 +90,3 @@ menulist > menupopup { border: none; min-width: 0; } - -@media not (-moz-windows-non-native-menus) { - /* For Win10, the popup itself needs to have a transparent background because - otherwise the background color would appear behind the drop shadow. */ - menulist > menupopup { - color: FieldText; - --panel-background: Field; - --panel-border-color: ThreeDShadow; - } -} diff --git a/toolkit/themes/windows/global/radio.css b/toolkit/themes/windows/global/radio.css index 56c792fc49edd..691b03e2b2b11 100644 --- a/toolkit/themes/windows/global/radio.css +++ b/toolkit/themes/windows/global/radio.css @@ -52,10 +52,3 @@ radiogroup:focus-visible > radio[focused="true"] > .radio-label-box { radio[disabled="true"] { color: GrayText; } - -@media (-moz-windows-classic) { - radio[disabled="true"] { - color: ThreeDShadow; - text-shadow: 1px 1px ThreeDHighlight; - } -} diff --git a/toolkit/themes/windows/global/richlistbox.css b/toolkit/themes/windows/global/richlistbox.css index 7aff813299bf2..e8235d11969a9 100644 --- a/toolkit/themes/windows/global/richlistbox.css +++ b/toolkit/themes/windows/global/richlistbox.css @@ -114,37 +114,6 @@ richlistbox.theme-listbox > richlistitem > label { background-color: var(--listitem-selectedFocusCurrentBackground); outline: none; } - - @media (-moz-platform: windows-win7) { - richlistbox.theme-listbox > richlistitem { - --listitem-selectedBottomBorder: var(--listitem-selectedColor); - --listitem-selectedBackground: rgba(190,190,190,.15); - --listitem-selectedImage: linear-gradient(rgba(190,190,190,.1), rgba(190,190,190,.4)); - --listitem-selectedCurrentBorder: rgb(125,162,206); - --listitem-selectedFocusColor: rgb(132,172,221); - --listitem-selectedFocusBottomBorder: var(--listitem-selectedFocusColor); - --listitem-selectedFocusBackground: rgba(131,183,249,.02); - --listitem-selectedFocusImage: linear-gradient(rgba(131,183,249,.16), rgba(131,183,249,.375)); - --listitem-selectedFocusCurrentBackground: rgba(131,183,249,.15); - - border-radius: 3px; - box-shadow: inset 0 0 0 1px rgba(255,255,255,.4), inset 0 -1px 0 1px rgba(255,255,255,.2); - } - } - - @media (-moz-platform: windows-win8) { - richlistbox.theme-listbox > richlistitem { - --listitem-selectedBottomBorder: var(--listitem-selectedColor); - --listitem-selectedBackground: rgba(190,190,190,.15); - --listitem-selectedImage: linear-gradient(rgba(190,190,190,.4), rgba(190,190,190,.4)); - --listitem-selectedCurrentBorder: rgb(125,162,206); - --listitem-selectedFocusColor: rgb(132,172,221); - --listitem-selectedFocusBottomBorder: var(--listitem-selectedFocusColor); - --listitem-selectedFocusBackground: rgba(131,183,249,.02); - --listitem-selectedFocusImage: linear-gradient(rgba(131,183,249,.375), rgba(131,183,249,.375)); - --listitem-selectedFocusCurrentBackground: rgba(131,183,249,.15); - } - } } listheader { diff --git a/toolkit/themes/windows/global/toolbarbutton.css b/toolkit/themes/windows/global/toolbarbutton.css index 33ed1acf25f47..4a7c89d8df813 100644 --- a/toolkit/themes/windows/global/toolbarbutton.css +++ b/toolkit/themes/windows/global/toolbarbutton.css @@ -29,17 +29,6 @@ toolbarbutton:where([disabled="true"]) { text-shadow: none; } -@media (-moz-windows-classic) { - @media not (prefers-contrast) { - toolbarbutton:where([disabled="true"]) { - text-shadow: 1px 1px ThreeDHighlight; - } - } - toolbarbutton:where([disabled="true"]) { - color: ThreeDShadow; - } -} - @media (-moz-windows-default-theme) { :root[lwtheme-image] toolbarbutton { text-shadow: none; diff --git a/widget/LookAndFeel.h b/widget/LookAndFeel.h index 12ff7bbae8294..c3006d96bc9c7 100644 --- a/widget/LookAndFeel.h +++ b/widget/LookAndFeel.h @@ -117,32 +117,6 @@ class LookAndFeel { */ WindowsDefaultTheme, - /* - * A Boolean value to determine whether the DWM compositor is being used - * - * This metric is not used on non-Windows platforms. These platforms - * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric. - */ - DWMCompositor, - - /* - * A Boolean value to determine whether Windows is themed (Classic vs. - * uxtheme) - * - * This is Windows-specific and is not implemented on other platforms - * (will return the default of NS_ERROR_FAILURE). - */ - WindowsClassic, - - /* - * A Boolean value to determine whether the current Windows desktop theme - * supports Aero Glass. - * - * This is Windows-specific and is not implemented on other platforms - * (will return the default of NS_ERROR_FAILURE). - */ - WindowsGlass, - /* * A Boolean value to determine whether the Mac graphite theme is * being used. @@ -409,8 +383,6 @@ class LookAndFeel { using FontID = mozilla::StyleSystemFont; - static bool WindowsNonNativeMenusEnabled(); - static ColorScheme SystemColorScheme() { return GetInt(IntID::SystemUsesDarkTheme) ? ColorScheme::Dark : ColorScheme::Light; diff --git a/widget/headless/HeadlessLookAndFeelGTK.cpp b/widget/headless/HeadlessLookAndFeelGTK.cpp index 2017aa26577f0..1c41950e6bb59 100644 --- a/widget/headless/HeadlessLookAndFeelGTK.cpp +++ b/widget/headless/HeadlessLookAndFeelGTK.cpp @@ -95,15 +95,9 @@ nsresult HeadlessLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) { break; case IntID::WindowsAccentColorInTitlebar: case IntID::WindowsDefaultTheme: - case IntID::DWMCompositor: aResult = 0; res = NS_ERROR_NOT_IMPLEMENTED; break; - case IntID::WindowsClassic: - case IntID::WindowsGlass: - aResult = 0; - res = NS_ERROR_FAILURE; - break; case IntID::AlertNotificationOrigin: aResult = NS_ALERT_TOP; break; diff --git a/widget/nsXPLookAndFeel.cpp b/widget/nsXPLookAndFeel.cpp index 84e57a0585242..3f4f03c9b35ca 100644 --- a/widget/nsXPLookAndFeel.cpp +++ b/widget/nsXPLookAndFeel.cpp @@ -150,9 +150,6 @@ static const char sIntPrefs[][45] = { "ui.chosenMenuItemsShouldBlink", "ui.windowsAccentColorInTitlebar", "ui.windowsDefaultTheme", - "ui.dwmCompositor", - "ui.windowsClassic", - "ui.windowsGlass", "ui.macGraphiteTheme", "ui.macBigSurTheme", "ui.macRTL", @@ -487,27 +484,11 @@ void nsXPLookAndFeel::OnPrefChanged(const char* aPref, void* aClosure) { } } -bool LookAndFeel::WindowsNonNativeMenusEnabled() { - switch (StaticPrefs::browser_display_windows_non_native_menus()) { - case 0: - return false; - case 1: - return true; - default: -#ifdef XP_WIN - return IsWin10OrLater(); -#else - return false; -#endif - } -} - static constexpr struct { nsLiteralCString mName; widget::ThemeChangeKind mChangeKind = widget::ThemeChangeKind::MediaQueriesOnly; } kMediaQueryPrefs[] = { - {"browser.display.windows.non_native_menus"_ns}, // Affects whether standins are used for the accent color. {"widget.non-native-theme.use-theme-accent"_ns, widget::ThemeChangeKind::Style}, diff --git a/widget/windows/nsLookAndFeel.cpp b/widget/windows/nsLookAndFeel.cpp index 805cdcf96509a..d85b5e8a4d478 100644 --- a/widget/windows/nsLookAndFeel.cpp +++ b/widget/windows/nsLookAndFeel.cpp @@ -122,9 +122,6 @@ void nsLookAndFeel::RefreshImpl() { } static bool UseNonNativeMenuColors(ColorScheme aScheme) { - if (!LookAndFeel::WindowsNonNativeMenusEnabled()) { - return false; - } return LookAndFeel::GetInt(LookAndFeel::IntID::WindowsDefaultTheme) || aScheme == ColorScheme::Dark; } @@ -156,9 +153,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme, if (UseNonNativeMenuColors(aScheme)) { return false; } - if (!nsUXThemeData::IsAppThemed()) { - return nsUXThemeData::AreFlatMenusEnabled(); - } [[fallthrough]]; case ColorID::MozMenuhovertext: if (UseNonNativeMenuColors(aScheme)) { @@ -263,10 +257,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme, aColor = kNonNativeMenuText; return NS_OK; } - if (!nsUXThemeData::IsAppThemed()) { - idx = COLOR_MENUTEXT; - break; - } [[fallthrough]]; case ColorID::MozMenuhovertext: if (UseNonNativeMenuColors(aScheme)) { @@ -502,23 +492,12 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) { case IntID::TreeScrollLinesMax: aResult = 3; break; - case IntID::WindowsClassic: - aResult = !nsUXThemeData::IsAppThemed(); - break; case IntID::WindowsDefaultTheme: aResult = nsUXThemeData::IsDefaultWindowTheme(); break; - case IntID::DWMCompositor: - aResult = gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled(); - break; case IntID::WindowsAccentColorInTitlebar: { aResult = mTitlebarColors.mUseAccent; } break; - case IntID::WindowsGlass: - // Aero Glass is only available prior to Windows 8 when DWM is used. - aResult = (gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled() && - !IsWin8OrLater()); - break; case IntID::AlertNotificationOrigin: aResult = 0; { @@ -916,14 +895,12 @@ void nsLookAndFeel::EnsureInit() { } mInitialized = true; - if (nsUXThemeData::IsAppThemed()) { - mColorMenuHoverText = - ::GetColorFromTheme(eUXMenu, MENU_POPUPITEM, MPI_HOT, TMT_TEXTCOLOR); - mColorMediaText = ::GetColorFromTheme(eUXMediaToolbar, TP_BUTTON, TS_NORMAL, - TMT_TEXTCOLOR); - mColorCommunicationsText = ::GetColorFromTheme( - eUXCommunicationsToolbar, TP_BUTTON, TS_NORMAL, TMT_TEXTCOLOR); - } + mColorMenuHoverText = + ::GetColorFromTheme(eUXMenu, MENU_POPUPITEM, MPI_HOT, TMT_TEXTCOLOR); + mColorMediaText = + ::GetColorFromTheme(eUXMediaToolbar, TP_BUTTON, TS_NORMAL, TMT_TEXTCOLOR); + mColorCommunicationsText = ::GetColorFromTheme( + eUXCommunicationsToolbar, TP_BUTTON, TS_NORMAL, TMT_TEXTCOLOR); // Fill out the sys color table. for (int i = SYS_COLOR_MIN; i <= SYS_COLOR_MAX; ++i) { diff --git a/widget/windows/nsNativeThemeWin.cpp b/widget/windows/nsNativeThemeWin.cpp index 2d19910f3e2dc..0b495540c4ab4 100644 --- a/widget/windows/nsNativeThemeWin.cpp +++ b/widget/windows/nsNativeThemeWin.cpp @@ -350,11 +350,7 @@ static CaptionButtonPadding buttonData[3] = { // Adds "hot" caption button padding to minimum widget size. static void AddPaddingRect(LayoutDeviceIntSize* aSize, CaptionButton button) { if (!aSize) return; - RECT offset; - if (!nsUXThemeData::IsAppThemed()) - offset = buttonData[CAPTION_CLASSIC].hotPadding[button]; - else - offset = buttonData[CAPTION_BASIC].hotPadding[button]; + RECT offset = buttonData[CAPTION_BASIC].hotPadding[button]; aSize->width += offset.left + offset.right; aSize->height += offset.top + offset.bottom; } @@ -362,11 +358,7 @@ static void AddPaddingRect(LayoutDeviceIntSize* aSize, CaptionButton button) { // If we've added padding to the minimum widget size, offset // the area we draw into to compensate. static void OffsetBackgroundRect(RECT& rect, CaptionButton button) { - RECT offset; - if (!nsUXThemeData::IsAppThemed()) - offset = buttonData[CAPTION_CLASSIC].hotPadding[button]; - else - offset = buttonData[CAPTION_BASIC].hotPadding[button]; + RECT offset = buttonData[CAPTION_BASIC].hotPadding[button]; rect.left += offset.left; rect.top += offset.top; rect.right -= offset.right; @@ -1366,31 +1358,29 @@ nsNativeThemeWin::DrawWidgetBackground(gfxContext* aContext, nsIFrame* aFrame, aDirtyRect); // ^^ without the right sdk, assume xp theming and fall through. - if (gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled()) { - switch (aAppearance) { - case StyleAppearance::MozWindowTitlebar: - case StyleAppearance::MozWindowTitlebarMaximized: - // Nothing to draw, these areas are glass. Minimum dimensions - // should be set, so xul content should be layed out correctly. - return NS_OK; - case StyleAppearance::MozWindowButtonClose: - case StyleAppearance::MozWindowButtonMinimize: - case StyleAppearance::MozWindowButtonMaximize: - case StyleAppearance::MozWindowButtonRestore: - // Not conventional bitmaps, can't be retrieved. If we fall - // through here and call the theme library we'll get aero - // basic bitmaps. - return NS_OK; - case StyleAppearance::MozWinBorderlessGlass: - // Nothing to draw, this is the glass background. - return NS_OK; - case StyleAppearance::MozWindowButtonBox: - case StyleAppearance::MozWindowButtonBoxMaximized: - // We handle these through nsIWidget::UpdateThemeGeometries - return NS_OK; - default: - break; - } + switch (aAppearance) { + case StyleAppearance::MozWindowTitlebar: + case StyleAppearance::MozWindowTitlebarMaximized: + // Nothing to draw, these areas are glass. Minimum dimensions + // should be set, so xul content should be laid out correctly. + return NS_OK; + case StyleAppearance::MozWindowButtonClose: + case StyleAppearance::MozWindowButtonMinimize: + case StyleAppearance::MozWindowButtonMaximize: + case StyleAppearance::MozWindowButtonRestore: + // Not conventional bitmaps, can't be retrieved. If we fall + // through here and call the theme library we'll get aero + // basic bitmaps. + return NS_OK; + case StyleAppearance::MozWinBorderlessGlass: + // Nothing to draw, this is the glass background. + return NS_OK; + case StyleAppearance::MozWindowButtonBox: + case StyleAppearance::MozWindowButtonBoxMaximized: + // We handle these through nsIWidget::UpdateThemeGeometries + return NS_OK; + default: + break; } int32_t part, state; @@ -2113,65 +2103,16 @@ LayoutDeviceIntSize nsNativeThemeWin::GetMinimumWidgetSize( } break; - case StyleAppearance::MozWindowButtonMaximize: - case StyleAppearance::MozWindowButtonRestore: { - // The only way to get accurate titlebar button info is to query a - // window w/buttons when it's visible. nsWindow takes care of this and - // stores that info in nsUXThemeData. - SIZE sz = nsUXThemeData::GetCommandButtonMetrics(CMDBUTTONIDX_RESTORE); - LayoutDeviceIntSize result(sz.cx, sz.cy); - AddPaddingRect(&result, CAPTIONBUTTON_RESTORE); - return result; - } - - case StyleAppearance::MozWindowButtonMinimize: { - SIZE sz = nsUXThemeData::GetCommandButtonMetrics(CMDBUTTONIDX_MINIMIZE); - LayoutDeviceIntSize result(sz.cx, sz.cy); - AddPaddingRect(&result, CAPTIONBUTTON_MINIMIZE); - return result; - } - - case StyleAppearance::MozWindowButtonClose: { - SIZE sz = nsUXThemeData::GetCommandButtonMetrics(CMDBUTTONIDX_CLOSE); - LayoutDeviceIntSize result(sz.cx, sz.cy); - AddPaddingRect(&result, CAPTIONBUTTON_CLOSE); - return result; - } - case StyleAppearance::MozWindowTitlebar: case StyleAppearance::MozWindowTitlebarMaximized: { LayoutDeviceIntSize result; result.height = GetSystemMetrics(SM_CYCAPTION); result.height += GetSystemMetrics(SM_CYFRAME); result.height += GetSystemMetrics(SM_CXPADDEDBORDER); - // On Win8.1, we don't want this scaling, because Windows doesn't scale - // the non-client area of the window, and we can end up with ugly overlap - // of the window frame controls into the tab bar or content area. But on - // Win10, we render the window controls ourselves, and the result looks - // better if we do apply this scaling (particularly with themes such as - // DevEdition; see bug 1267636). - if (IsWin10OrLater()) { - ScaleForFrameDPI(&result, aFrame); - } + ScaleForFrameDPI(&result, aFrame); return result; } - case StyleAppearance::MozWindowButtonBox: - case StyleAppearance::MozWindowButtonBoxMaximized: { - if (gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled()) { - SIZE sz = nsUXThemeData::GetCommandButtonBoxMetrics(); - LayoutDeviceIntSize result(sz.cx, - sz.cy - GetSystemMetrics(SM_CYFRAME) - - GetSystemMetrics(SM_CXPADDEDBORDER)); - if (aAppearance == StyleAppearance::MozWindowButtonBoxMaximized) { - result.width += 1; - result.height -= 2; - } - return result; - } - break; - } - default: break; } @@ -2388,9 +2329,6 @@ bool nsNativeThemeWin::ClassicThemeSupportsWidget(nsIFrame* aFrame, switch (aAppearance) { case StyleAppearance::Menubar: case StyleAppearance::Menupopup: - // Classic non-flat menus are handled almost entirely through CSS. - if (!nsUXThemeData::AreFlatMenusEnabled()) return false; - [[fallthrough]]; case StyleAppearance::Button: case StyleAppearance::NumberInput: case StyleAppearance::Textfield: @@ -2484,14 +2422,8 @@ bool nsNativeThemeWin::ClassicGetWidgetPadding(nsDeviceContext* aContext, return false; if (part == 1) { // top-level menu - if (nsUXThemeData::AreFlatMenusEnabled() || !(state & DFCS_PUSHED)) { - (*aResult).top = (*aResult).bottom = (*aResult).left = - (*aResult).right = 2; - } else { - // make top-level menus look sunken when pushed in the Classic look - (*aResult).top = (*aResult).left = 3; - (*aResult).bottom = (*aResult).right = 1; - } + (*aResult).top = (*aResult).bottom = (*aResult).left = + (*aResult).right = 2; } else { (*aResult).top = 0; (*aResult).bottom = (*aResult).left = (*aResult).right = 2; @@ -2934,51 +2866,6 @@ static void DrawTab(HDC hdc, const RECT& R, int32_t aPosition, bool aSelected, if (aDrawRight) ::DrawEdge(hdc, &shadeRect, EDGE_RAISED, BF_SOFT | shadeFlag); } -static void DrawMenuImage(HDC hdc, const RECT& rc, int32_t aComponent, - uint32_t aColor) { - // This procedure creates a memory bitmap to contain the check mark, draws - // it into the bitmap (it is a mask image), then composes it onto the menu - // item in appropriate colors. - HDC hMemoryDC = ::CreateCompatibleDC(hdc); - if (hMemoryDC) { - // XXXjgr We should ideally be caching these, but we wont be notified when - // they change currently, so we can't do so easily. Same for the bitmap. - int checkW = ::GetSystemMetrics(SM_CXMENUCHECK); - int checkH = ::GetSystemMetrics(SM_CYMENUCHECK); - - HBITMAP hMonoBitmap = ::CreateBitmap(checkW, checkH, 1, 1, nullptr); - if (hMonoBitmap) { - HBITMAP hPrevBitmap = (HBITMAP)::SelectObject(hMemoryDC, hMonoBitmap); - if (hPrevBitmap) { - // XXXjgr This will go pear-shaped if the image is bigger than the - // provided rect. What should we do? - RECT imgRect = {0, 0, checkW, checkH}; - POINT imgPos = {rc.left + (rc.right - rc.left - checkW) / 2, - rc.top + (rc.bottom - rc.top - checkH) / 2}; - - // XXXzeniko Windows renders these 1px lower than you'd expect - if (aComponent == DFCS_MENUCHECK || aComponent == DFCS_MENUBULLET) - imgPos.y++; - - ::DrawFrameControl(hMemoryDC, &imgRect, DFC_MENU, aComponent); - COLORREF oldTextCol = ::SetTextColor(hdc, 0x00000000); - COLORREF oldBackCol = ::SetBkColor(hdc, 0x00FFFFFF); - ::BitBlt(hdc, imgPos.x, imgPos.y, checkW, checkH, hMemoryDC, 0, 0, - SRCAND); - ::SetTextColor(hdc, ::GetSysColor(aColor)); - ::SetBkColor(hdc, 0x00000000); - ::BitBlt(hdc, imgPos.x, imgPos.y, checkW, checkH, hMemoryDC, 0, 0, - SRCPAINT); - ::SetTextColor(hdc, oldTextCol); - ::SetBkColor(hdc, oldBackCol); - ::SelectObject(hMemoryDC, hPrevBitmap); - } - ::DeleteObject(hMonoBitmap); - } - ::DeleteDC(hMemoryDC); - } -} - void nsNativeThemeWin::DrawCheckedRect(HDC hdc, const RECT& rc, int32_t fore, int32_t back, HBRUSH defaultBack) { static WORD patBits[8] = {0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55}; @@ -3187,60 +3074,6 @@ nsresult nsNativeThemeWin::ClassicDrawWidgetBackground( break; case StyleAppearance::Menubar: break; - case StyleAppearance::Menupopup: - NS_ASSERTION(nsUXThemeData::AreFlatMenusEnabled(), - "Classic menus are styled entirely through CSS"); - ::FillRect(hdc, &widgetRect, (HBRUSH)(COLOR_MENU + 1)); - ::FrameRect(hdc, &widgetRect, ::GetSysColorBrush(COLOR_BTNSHADOW)); - break; - case StyleAppearance::Menuitem: - case StyleAppearance::Checkmenuitem: - case StyleAppearance::Radiomenuitem: - // part == 0 for normal items - // part == 1 for top-level menu items - if (nsUXThemeData::AreFlatMenusEnabled()) { - // Not disabled and hot/pushed. - if ((state & (DFCS_HOT | DFCS_PUSHED)) != 0) { - ::FillRect(hdc, &widgetRect, (HBRUSH)(COLOR_MENUHILIGHT + 1)); - ::FrameRect(hdc, &widgetRect, ::GetSysColorBrush(COLOR_HIGHLIGHT)); - } - } else { - if (part == 1) { - if ((state & DFCS_INACTIVE) == 0) { - if ((state & DFCS_PUSHED) != 0) { - ::DrawEdge(hdc, &widgetRect, BDR_SUNKENOUTER, BF_RECT); - } else if ((state & DFCS_HOT) != 0) { - ::DrawEdge(hdc, &widgetRect, BDR_RAISEDINNER, BF_RECT); - } - } - } else { - if ((state & (DFCS_HOT | DFCS_PUSHED)) != 0) { - ::FillRect(hdc, &widgetRect, (HBRUSH)(COLOR_HIGHLIGHT + 1)); - } - } - } - break; - case StyleAppearance::Menucheckbox: - case StyleAppearance::Menuradio: - if (!(state & DFCS_CHECKED)) break; // nothin' to do - [[fallthrough]]; - case StyleAppearance::Menuarrow: { - uint32_t color = COLOR_MENUTEXT; - if ((state & DFCS_INACTIVE)) - color = COLOR_GRAYTEXT; - else if ((state & DFCS_HOT)) - color = COLOR_HIGHLIGHTTEXT; - - if (aAppearance == StyleAppearance::Menucheckbox) - DrawMenuImage(hdc, widgetRect, DFCS_MENUCHECK, color); - else if (aAppearance == StyleAppearance::Menuradio) - DrawMenuImage(hdc, widgetRect, DFCS_MENUBULLET, color); - else if (aAppearance == StyleAppearance::Menuarrow) - DrawMenuImage(hdc, widgetRect, - (state & DFCS_RTL) ? DFCS_MENUARROWRIGHT : DFCS_MENUARROW, - color); - break; - } case StyleAppearance::Menuseparator: { // separators are offset by a bit (see menu.css) widgetRect.left++; diff --git a/widget/windows/nsUXThemeData.cpp b/widget/windows/nsUXThemeData.cpp index fe4061efb1787..722695a0344f9 100644 --- a/widget/windows/nsUXThemeData.cpp +++ b/widget/windows/nsUXThemeData.cpp @@ -19,30 +19,6 @@ using namespace mozilla::widget; nsUXThemeData::ThemeHandle nsUXThemeData::sThemes[eUXNumClasses]; -const int NUM_COMMAND_BUTTONS = 3; -SIZE nsUXThemeData::sCommandButtonMetrics[NUM_COMMAND_BUTTONS]; -bool nsUXThemeData::sCommandButtonMetricsInitialized = false; -SIZE nsUXThemeData::sCommandButtonBoxMetrics; -bool nsUXThemeData::sCommandButtonBoxMetricsInitialized = false; - -bool nsUXThemeData::sTitlebarInfoPopulatedAero = false; -bool nsUXThemeData::sTitlebarInfoPopulatedThemed = false; - -/** - * Windows themes we currently detect. - */ -enum class WindowsTheme { - Generic = 0, // unrecognized theme - Classic, - Aero, - Luna, - Royale, - Zune, - AeroLite -}; - -static WindowsTheme sThemeId = WindowsTheme::Generic; - nsUXThemeData::ThemeHandle::~ThemeHandle() { Close(); } void nsUXThemeData::ThemeHandle::OpenOnce(HWND aWindow, LPCWSTR aClassList) { @@ -123,165 +99,6 @@ const wchar_t* nsUXThemeData::GetClassName(nsUXThemeClass cls) { return L""; } } - -// static -void nsUXThemeData::EnsureCommandButtonMetrics() { - if (sCommandButtonMetricsInitialized) { - return; - } - sCommandButtonMetricsInitialized = true; - - // This code should never need to be evaluated for our UI since if we need - // these metrics for our UI we should make sure that we obtain the correct - // metrics when nsWindow::Create() is called. The generic metrics that we - // fetch here will likley not match the current theme, but we provide these - // values in case arbitrary content is styled with the '-moz-appearance' - // value '-moz-window-button-close' etc. - // - // ISSUE: We'd prefer to use MOZ_ASSERT_UNREACHABLE here, but since content - // (and at least one of our crashtests) can use '-moz-window-button-close' - // we need to use NS_WARNING instead. - NS_WARNING("Making expensive and likely unnecessary GetSystemMetrics calls"); - - sCommandButtonMetrics[0].cx = GetSystemMetrics(SM_CXSIZE); - sCommandButtonMetrics[0].cy = GetSystemMetrics(SM_CYSIZE); - sCommandButtonMetrics[1].cx = sCommandButtonMetrics[2].cx = - sCommandButtonMetrics[0].cx; - sCommandButtonMetrics[1].cy = sCommandButtonMetrics[2].cy = - sCommandButtonMetrics[0].cy; - - // Trigger a refresh on the next layout. - sTitlebarInfoPopulatedAero = sTitlebarInfoPopulatedThemed = false; -} - -// static -void nsUXThemeData::EnsureCommandButtonBoxMetrics() { - if (sCommandButtonBoxMetricsInitialized) { - return; - } - sCommandButtonBoxMetricsInitialized = true; - - EnsureCommandButtonMetrics(); - - sCommandButtonBoxMetrics.cx = sCommandButtonMetrics[0].cx + - sCommandButtonMetrics[1].cx + - sCommandButtonMetrics[2].cx; - sCommandButtonBoxMetrics.cy = sCommandButtonMetrics[0].cy + - sCommandButtonMetrics[1].cy + - sCommandButtonMetrics[2].cy; - - // Trigger a refresh on the next layout. - sTitlebarInfoPopulatedAero = sTitlebarInfoPopulatedThemed = false; -} - -// static -void nsUXThemeData::UpdateTitlebarInfo(HWND aWnd) { - if (!aWnd) return; - - if (!sTitlebarInfoPopulatedAero && - gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled()) { - RECT captionButtons; - if (SUCCEEDED(DwmGetWindowAttribute(aWnd, DWMWA_CAPTION_BUTTON_BOUNDS, - &captionButtons, - sizeof(captionButtons)))) { - sCommandButtonBoxMetrics.cx = - captionButtons.right - captionButtons.left - 3; - sCommandButtonBoxMetrics.cy = - (captionButtons.bottom - captionButtons.top) - 1; - sCommandButtonBoxMetricsInitialized = true; - MOZ_ASSERT( - sCommandButtonBoxMetrics.cx > 0 && sCommandButtonBoxMetrics.cy > 0, - "We must not cache bad command button box dimensions"); - sTitlebarInfoPopulatedAero = true; - } - } - - // NB: sTitlebarInfoPopulatedThemed is always true pre-vista. - if (sTitlebarInfoPopulatedThemed || IsWin8OrLater()) return; - - // Query a temporary, visible window with command buttons to get - // the right metrics. - WNDCLASSW wc; - wc.style = 0; - wc.lpfnWndProc = ::DefWindowProcW; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = nsToolkit::mDllInstance; - wc.hIcon = nullptr; - wc.hCursor = nullptr; - wc.hbrBackground = nullptr; - wc.lpszMenuName = nullptr; - wc.lpszClassName = kClassNameTemp; - ::RegisterClassW(&wc); - - // Create a transparent descendant of the window passed in. This - // keeps the window from showing up on the desktop or the taskbar. - // Note the parent (browser) window is usually still hidden, we - // don't want to display it, so we can't query it directly. - HWND hWnd = CreateWindowExW(WS_EX_LAYERED, kClassNameTemp, L"", - WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, aWnd, nullptr, - nsToolkit::mDllInstance, nullptr); - NS_ASSERTION(hWnd, "UpdateTitlebarInfo window creation failed."); - - int showType = SW_SHOWNA; - // We try to avoid activating this window, but on Aero basic (aero without - // compositor) and aero lite (special theme for win server 2012/2013) we may - // get the wrong information if the window isn't activated, so we have to: - if (sThemeId == WindowsTheme::AeroLite || - (sThemeId == WindowsTheme::Aero && - !gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled())) { - showType = SW_SHOW; - } - ShowWindow(hWnd, showType); - TITLEBARINFOEX info = {0}; - info.cbSize = sizeof(TITLEBARINFOEX); - SendMessage(hWnd, WM_GETTITLEBARINFOEX, 0, (LPARAM)&info); - DestroyWindow(hWnd); - - // Only set if we have valid data for all three buttons we use. - if ((info.rgrect[2].right - info.rgrect[2].left) == 0 || - (info.rgrect[3].right - info.rgrect[3].left) == 0 || - (info.rgrect[5].right - info.rgrect[5].left) == 0) { - NS_WARNING("WM_GETTITLEBARINFOEX query failed to find usable metrics."); - return; - } - // minimize - sCommandButtonMetrics[0].cx = info.rgrect[2].right - info.rgrect[2].left; - sCommandButtonMetrics[0].cy = info.rgrect[2].bottom - info.rgrect[2].top; - // maximize/restore - sCommandButtonMetrics[1].cx = info.rgrect[3].right - info.rgrect[3].left; - sCommandButtonMetrics[1].cy = info.rgrect[3].bottom - info.rgrect[3].top; - // close - sCommandButtonMetrics[2].cx = info.rgrect[5].right - info.rgrect[5].left; - sCommandButtonMetrics[2].cy = info.rgrect[5].bottom - info.rgrect[5].top; - sCommandButtonMetricsInitialized = true; - -#ifdef DEBUG - // Verify that all values for the command buttons are positive values - // otherwise we have cached bad values for the caption buttons - for (int i = 0; i < NUM_COMMAND_BUTTONS; i++) { - MOZ_ASSERT(sCommandButtonMetrics[i].cx > 0); - MOZ_ASSERT(sCommandButtonMetrics[i].cy > 0); - } -#endif - - sTitlebarInfoPopulatedThemed = true; -} - -// visual style (aero glass, aero basic) -// theme (aero, luna, zune) -// theme color (silver, olive, blue) -// system colors - -const struct { - LPCWSTR name; - WindowsTheme type; -} kKnownThemes[] = {{L"aero.msstyles", WindowsTheme::Aero}, - {L"aerolite.msstyles", WindowsTheme::AeroLite}, - {L"luna.msstyles", WindowsTheme::Luna}, - {L"zune.msstyles", WindowsTheme::Zune}, - {L"royale.msstyles", WindowsTheme::Royale}}; - bool nsUXThemeData::sIsDefaultWindowsTheme = false; bool nsUXThemeData::sIsHighContrastOn = false; @@ -292,12 +109,6 @@ bool nsUXThemeData::IsHighContrastOn() { return sIsHighContrastOn; } // static void nsUXThemeData::UpdateNativeThemeInfo() { - // Trigger a refresh of themed button metrics if needed - sTitlebarInfoPopulatedThemed = false; - - sIsDefaultWindowsTheme = false; - sThemeId = WindowsTheme::Generic; - HIGHCONTRAST highContrastInfo; highContrastInfo.cbSize = sizeof(HIGHCONTRAST); if (SystemParametersInfo(SPI_GETHIGHCONTRAST, 0, &highContrastInfo, 0)) { @@ -305,52 +116,5 @@ void nsUXThemeData::UpdateNativeThemeInfo() { } else { sIsHighContrastOn = false; } - - if (!nsUXThemeData::IsAppThemed()) { - sThemeId = WindowsTheme::Classic; - return; - } - - WCHAR themeFileName[MAX_PATH + 1]; - WCHAR themeColor[MAX_PATH + 1]; - if (FAILED(GetCurrentThemeName(themeFileName, MAX_PATH, themeColor, MAX_PATH, - nullptr, 0))) { - sThemeId = WindowsTheme::Classic; - return; - } - - LPCWSTR themeName = wcsrchr(themeFileName, L'\\'); - themeName = themeName ? themeName + 1 : themeFileName; - - sThemeId = [&] { - for (const auto& theme : kKnownThemes) { - if (!lstrcmpiW(themeName, theme.name)) { - return theme.type; - } - } - return WindowsTheme::Generic; - }(); - - // We're using the default theme if we're using any of Aero, Aero Lite, or - // luna. However, on Win8, GetCurrentThemeName (see above) returns - // AeroLite.msstyles for the 4 builtin highcontrast themes as well. Those - // themes "don't count" as default themes, so we specifically check for high - // contrast mode in that situation. - sIsDefaultWindowsTheme = [&] { - if (sIsHighContrastOn && IsWin8OrLater()) { - return false; - } - return sThemeId == WindowsTheme::Aero || - sThemeId == WindowsTheme::AeroLite || sThemeId == WindowsTheme::Luna; - }(); -} - -// static -bool nsUXThemeData::AreFlatMenusEnabled() { - BOOL useFlat = FALSE; - return !!::SystemParametersInfo(SPI_GETFLATMENU, 0, &useFlat, 0) ? useFlat - : false; + sIsDefaultWindowsTheme = !sIsHighContrastOn; } - -// static -bool nsUXThemeData::IsAppThemed() { return !!::IsAppThemed(); } diff --git a/widget/windows/nsUXThemeData.h b/widget/windows/nsUXThemeData.h index 33ab0354b767f..af67b0d5e23a7 100644 --- a/widget/windows/nsUXThemeData.h +++ b/widget/windows/nsUXThemeData.h @@ -38,13 +38,6 @@ enum nsUXThemeClass { eUXNumClasses }; -enum CmdButtonIdx { - CMDBUTTONIDX_MINIMIZE = 0, - CMDBUTTONIDX_RESTORE, - CMDBUTTONIDX_CLOSE, - CMDBUTTONIDX_BUTTONBOX -}; - class nsUXThemeData { // This class makes sure we don't attempt to open a theme if the previous // loading attempt has failed because OpenThemeData is a heavy task and @@ -68,22 +61,9 @@ class nsUXThemeData { }; static ThemeHandle sThemes[eUXNumClasses]; - - // We initialize sCommandButtonBoxMetrics separately as a performance - // optimization to avoid fetching dummy values for sCommandButtonMetrics - // when we don't need those. - static SIZE sCommandButtonMetrics[3]; - static bool sCommandButtonMetricsInitialized; - static SIZE sCommandButtonBoxMetrics; - static bool sCommandButtonBoxMetricsInitialized; - static const wchar_t* GetClassName(nsUXThemeClass); - static void EnsureCommandButtonMetrics(); - static void EnsureCommandButtonBoxMetrics(); public: - static bool sTitlebarInfoPopulatedAero; - static bool sTitlebarInfoPopulatedThemed; static bool sIsDefaultWindowsTheme; static bool sIsHighContrastOn; @@ -91,22 +71,8 @@ class nsUXThemeData { static HANDLE GetTheme(nsUXThemeClass cls); static HMODULE GetThemeDLL(); - // nsWindow calls this to update desktop settings info - static void UpdateTitlebarInfo(HWND aWnd); - - static SIZE GetCommandButtonMetrics(CmdButtonIdx aMetric) { - EnsureCommandButtonMetrics(); - return sCommandButtonMetrics[aMetric]; - } - static SIZE GetCommandButtonBoxMetrics() { - EnsureCommandButtonBoxMetrics(); - return sCommandButtonBoxMetrics; - } static void UpdateNativeThemeInfo(); static bool IsDefaultWindowTheme(); static bool IsHighContrastOn(); - - static bool AreFlatMenusEnabled(); - static bool IsAppThemed(); }; #endif // __UXThemeData_h__ diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index c38b291c90a3b..7b6344135ac29 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -826,15 +826,6 @@ nsWindow::~nsWindow() { // when the window is created or resized. int32_t nsWindow::GetHeight(int32_t aProposedHeight) { return aProposedHeight; } -static bool ShouldCacheTitleBarInfo(WindowType aWindowType, - BorderStyle aBorderStyle) { - return (aWindowType == WindowType::TopLevel) && - (aBorderStyle == BorderStyle::Default || - aBorderStyle == BorderStyle::All) && - (!nsUXThemeData::sTitlebarInfoPopulatedThemed || - !nsUXThemeData::sTitlebarInfoPopulatedAero); -} - void nsWindow::SendAnAPZEvent(InputData& aEvent) { LRESULT popupHandlingResult; if (DealWithPopups(mWnd, MOZ_WM_DMANIP, 0, 0, &popupHandlingResult)) { @@ -1219,12 +1210,6 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent, mDefaultIMC.Init(this); IMEHandler::InitInputContext(this, mInputContext); - // Query for command button metric data for rendering the titlebar. We - // only do this once on the first window that has an actual titlebar - if (ShouldCacheTitleBarInfo(mWindowType, mBorderStyle)) { - nsUXThemeData::UpdateTitlebarInfo(mWnd); - } - static bool a11yPrimed = false; if (!a11yPrimed && mWindowType == WindowType::TopLevel) { a11yPrimed = true; @@ -3282,12 +3267,6 @@ void nsWindow::UpdateOpaqueRegion(const LayoutDeviceIntRegion& aOpaqueRegion) { margins.cxLeftWidth = largest.X(); margins.cxRightWidth = clientBounds.Width() - largest.XMost(); margins.cyBottomHeight = clientBounds.Height() - largest.YMost(); - if (mCustomNonClient) { - // The minimum glass height must be the caption buttons height, - // otherwise the buttons are drawn incorrectly. - largest.MoveToY(std::max( - largest.Y(), nsUXThemeData::GetCommandButtonBoxMetrics().cy)); - } margins.cyTopHeight = largest.Y(); } diff --git a/xpcom/ds/StaticAtoms.py b/xpcom/ds/StaticAtoms.py index a1fedc48aa5d2..06410d4ca666b 100644 --- a/xpcom/ds/StaticAtoms.py +++ b/xpcom/ds/StaticAtoms.py @@ -2233,10 +2233,6 @@ Atom("forcemessagemanager", "forcemessagemanager"), Atom("initialBrowsingContextGroupId", "initialBrowsingContextGroupId"), Atom("initiallyactive", "initiallyactive"), - # windows media query names - Atom("windows_win7", "windows-win7"), - Atom("windows_win8", "windows-win8"), - Atom("windows_win10", "windows-win10"), # Names for system metrics. Atom("_moz_scrollbar_start_backward", "-moz-scrollbar-start-backward"), Atom("_moz_scrollbar_start_forward", "-moz-scrollbar-start-forward"), @@ -2249,10 +2245,6 @@ Atom("_moz_mac_big_sur_theme", "-moz-mac-big-sur-theme"), Atom("_moz_mac_rtl", "-moz-mac-rtl"), Atom("_moz_platform", "-moz-platform"), - Atom("_moz_windows_compositor", "-moz-windows-compositor"), - Atom("_moz_windows_classic", "-moz-windows-classic"), - Atom("_moz_windows_glass", "-moz-windows-glass"), - Atom("_moz_windows_non_native_menus", "-moz-windows-non-native-menus"), Atom("_moz_menubar_drag", "-moz-menubar-drag"), Atom("_moz_device_pixel_ratio", "-moz-device-pixel-ratio"), Atom("_moz_device_orientation", "-moz-device-orientation"),