summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dom/base/nsGkAtomList.h2
-rw-r--r--layout/style/nsCSSRuleProcessor.cpp5
-rw-r--r--layout/style/nsMediaFeatures.cpp8
-rw-r--r--widget/LookAndFeel.h9
-rw-r--r--widget/windows/nsLookAndFeel.cpp8
-rw-r--r--widget/windows/nsWindow.cpp5
6 files changed, 37 insertions, 0 deletions
diff --git a/dom/base/nsGkAtomList.h b/dom/base/nsGkAtomList.h
index f6b097a73e..0b76b2bea0 100644
--- a/dom/base/nsGkAtomList.h
+++ b/dom/base/nsGkAtomList.h
@@ -2231,6 +2231,7 @@ GK_ATOM(scrollbar_end_forward, "scrollbar-end-forward")
GK_ATOM(scrollbar_thumb_proportional, "scrollbar-thumb-proportional")
GK_ATOM(overlay_scrollbars, "overlay-scrollbars")
GK_ATOM(windows_accent_color_applies, "windows-accent-color-applies")
+GK_ATOM(windows_accent_color_is_dark, "windows-accent-color-is-dark")
GK_ATOM(windows_default_theme, "windows-default-theme")
GK_ATOM(mac_graphite_theme, "mac-graphite-theme")
GK_ATOM(mac_yosemite_theme, "mac-yosemite-theme")
@@ -2261,6 +2262,7 @@ GK_ATOM(_moz_scrollbar_end_forward, "-moz-scrollbar-end-forward")
GK_ATOM(_moz_scrollbar_thumb_proportional, "-moz-scrollbar-thumb-proportional")
GK_ATOM(_moz_overlay_scrollbars, "-moz-overlay-scrollbars")
GK_ATOM(_moz_windows_accent_color_applies, "-moz-windows-accent-color-applies")
+GK_ATOM(_moz_windows_accent_color_is_dark, "-moz-windows-accent-color-is-dark")
GK_ATOM(_moz_windows_default_theme, "-moz-windows-default-theme")
GK_ATOM(_moz_mac_graphite_theme, "-moz-mac-graphite-theme")
GK_ATOM(_moz_mac_yosemite_theme, "-moz-mac-yosemite-theme")
diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp
index 4dc7ea1c88..8760a330e1 100644
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -1132,6 +1132,11 @@ InitSystemMetrics()
sSystemMetrics->AppendElement(nsGkAtoms::windows_accent_color_applies);
}
+ rv = LookAndFeel::GetInt(LookAndFeel::eIntID_WindowsAccentColorIsDark, &metricResult);
+ if (NS_SUCCEEDED(rv) && metricResult) {
+ sSystemMetrics->AppendElement(nsGkAtoms::windows_accent_color_is_dark);
+ }
+
rv = LookAndFeel::GetInt(LookAndFeel::eIntID_DWMCompositor, &metricResult);
if (NS_SUCCEEDED(rv) && metricResult) {
sSystemMetrics->AppendElement(nsGkAtoms::windows_compositor);
diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp
index f314835a40..052ce58e84 100644
--- a/layout/style/nsMediaFeatures.cpp
+++ b/layout/style/nsMediaFeatures.cpp
@@ -724,6 +724,14 @@ nsMediaFeatures::features[] = {
GetSystemMetric
},
{
+ &nsGkAtoms::_moz_windows_accent_color_is_dark,
+ nsMediaFeature::eMinMaxNotAllowed,
+ nsMediaFeature::eBoolInteger,
+ nsMediaFeature::eNoRequirements,
+ { &nsGkAtoms::windows_accent_color_is_dark },
+ GetSystemMetric
+ },
+ {
&nsGkAtoms::_moz_windows_compositor,
nsMediaFeature::eMinMaxNotAllowed,
nsMediaFeature::eBoolInteger,
diff --git a/widget/LookAndFeel.h b/widget/LookAndFeel.h
index 8d510f69fe..e2502c559a 100644
--- a/widget/LookAndFeel.h
+++ b/widget/LookAndFeel.h
@@ -250,6 +250,15 @@ public:
* should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
*/
eIntID_WindowsAccentColorApplies,
+
+ /*
+ * A Boolean value to determine whether the Windows accent color
+ * is considered dark and should get bright text/controls.
+ *
+ * The value of this metric is not used on other platforms. These platforms
+ * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
+ */
+ eIntID_WindowsAccentColorIsDark,
/*
* A Boolean value to determine whether the Windows default theme is
diff --git a/widget/windows/nsLookAndFeel.cpp b/widget/windows/nsLookAndFeel.cpp
index 5c0358bd94..e649802b18 100644
--- a/widget/windows/nsLookAndFeel.cpp
+++ b/widget/windows/nsLookAndFeel.cpp
@@ -442,6 +442,14 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
aResult = NS_SUCCEEDED(GetAccentColor(unused)) ? 1 : 0;
}
break;
+ case eIntID_WindowsAccentColorIsDark:
+ {
+ nscolor accentColor;
+ if (NS_SUCCEEDED(GetAccentColor(accentColor))) {
+ aResult = AccentColorIsDark(accentColor) ? 1 : 0;
+ }
+ }
+ break;
case eIntID_WindowsGlass:
// Aero Glass is only available prior to Windows 8 when DWM is used.
aResult = (nsUXThemeData::CheckForCompositor() && !IsWin8OrLater());
diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp
index dd4f359f73..85321a189d 100644
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -7138,6 +7138,11 @@ nsWindow::OnSysColorChanged()
// so all presentations get notified properly.
// See nsWindow::GlobalMsgWindowProc.
NotifySysColorChanged();
+ // On Windows 10 only, we trigger a theme change to pick up changed media
+ // queries that are needed for accent color changes.
+ if (IsWin10OrLater()) {
+ NotifyThemeChanged();
+ }
}
}