Add -moz-windows-accent-color-is-dark

#31 point 4
This commit is contained in:
wolfbeast 2017-07-19 16:34:50 +02:00 committed by Roy Tam
commit 8aa201ff06
6 changed files with 37 additions and 0 deletions

View file

@ -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")

View file

@ -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);

View file

@ -723,6 +723,14 @@ nsMediaFeatures::features[] = {
{ &nsGkAtoms::windows_accent_color_applies },
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,

View file

@ -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

View file

@ -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());

View file

@ -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();
}
}
}