Skip to content

Commit 44b3bc8

Browse files
committed
Bug 1919611 - Fix #ifdef for windows. r=nchevobbe,dshin
And add a test. Differential Revision: https://phabricator.services.mozilla.com/D222759 UltraBlame original commit: ab2530c2962f5b3e7e17dad49f6a6be59ee4b0b3
1 parent b69d0e9 commit 44b3bc8

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

browser/components/tests/browser/browser.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ reason = "test depends on update channel"
3030
["browser_default_webprotocol_handler_mailto.js"]
3131
run-if = ["os == 'win'"]
3232

33+
["browser_forced_colors.js"]
34+
3335
["browser_initial_tab_remoteType.js"]
3436
https_first_disabled = true
3537

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
3+
4+
"use strict";
5+
6+
add_task(async function test_forced_colors_windows() {
7+
await SpecialPowers.pushPrefEnv({
8+
set: [["ui.useAccessibilityTheme", 1]],
9+
});
10+
11+
ok(
12+
!matchMedia("(forced-colors: active)").matches,
13+
"forced-colors: active shouldn't match in chrome"
14+
);
15+
is(
16+
matchMedia("(forced-colors)").matches,
17+
AppConstants.platform == "win",
18+
"forced-colors should match with HCM enabled on windows, even in chrome"
19+
);
20+
});

layout/base/nsPresContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ void nsPresContext::UpdateForcedColors(bool aNotify) {
766766

767767

768768

769-
#ifdef XP_WINDOWS
769+
#ifdef XP_WIN
770770
if (prefs.mUseAccessibilityTheme && prefs.mIsChrome) {
771771
return StyleForcedColors::Requested;
772772
}

0 commit comments

Comments
 (0)