Bug 946595 - High contrast themes on Windows 8 shouldn't be considered the default theme in CSS, r=jimm

This commit is contained in:
Gijs Kruitbosch 2014-03-28 22:13:10 +00:00
Родитель 501514dd27
Коммит db121ad14f
3 изменённых файлов: 27 добавлений и 7 удалений

Просмотреть файл

@ -369,11 +369,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
// High contrast is a misnomer under Win32 -- any theme can be used with it,
// e.g. normal contrast with large fonts, low contrast, etc.
// The high contrast flag really means -- use this theme and don't override it.
HIGHCONTRAST contrastThemeInfo;
contrastThemeInfo.cbSize = sizeof(contrastThemeInfo);
::SystemParametersInfo(SPI_GETHIGHCONTRAST, 0, &contrastThemeInfo, 0);
aResult = ((contrastThemeInfo.dwFlags & HCF_HIGHCONTRASTON) != 0);
aResult = nsUXThemeData::IsHighContrastOn();
break;
case eIntID_ScrollArrowStyle:
aResult = eScrollArrowStyle_Single;

Просмотреть файл

@ -253,6 +253,8 @@ nsUXThemeData::sThemeId = LookAndFeel::eWindowsTheme_Generic;
bool
nsUXThemeData::sIsDefaultWindowsTheme = false;
bool
nsUXThemeData::sIsHighContrastOn = false;
// static
LookAndFeel::WindowsTheme
@ -267,6 +269,11 @@ bool nsUXThemeData::IsDefaultWindowTheme()
return sIsDefaultWindowsTheme;
}
bool nsUXThemeData::IsHighContrastOn()
{
return sIsHighContrastOn;
}
// static
bool nsUXThemeData::CheckForCompositor(bool aUpdateCache)
{
@ -292,6 +299,14 @@ nsUXThemeData::UpdateNativeThemeInfo()
return;
}
HIGHCONTRAST highContrastInfo;
highContrastInfo.cbSize = sizeof(HIGHCONTRAST);
if (SystemParametersInfo(SPI_GETHIGHCONTRAST, 0, &highContrastInfo, 0)) {
sIsHighContrastOn = ((highContrastInfo.dwFlags & HCF_HIGHCONTRASTON) != 0);
} else {
sIsHighContrastOn = false;
}
WCHAR themeFileName[MAX_PATH + 1];
WCHAR themeColor[MAX_PATH + 1];
if (FAILED(GetCurrentThemeName(themeFileName,
@ -317,9 +332,16 @@ nsUXThemeData::UpdateNativeThemeInfo()
if (theme == WINTHEME_UNRECOGNIZED)
return;
if (theme == WINTHEME_AERO || theme == WINTHEME_AERO_LITE || theme == WINTHEME_LUNA)
// 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.
if (!(IsWin8OrLater() && sIsHighContrastOn) &&
(theme == WINTHEME_AERO || theme == WINTHEME_AERO_LITE || theme == WINTHEME_LUNA)) {
sIsDefaultWindowsTheme = true;
}
if (theme != WINTHEME_LUNA) {
switch(theme) {
case WINTHEME_AERO:

Просмотреть файл

@ -92,6 +92,7 @@ public:
static SIZE sCommandButtons[4];
static mozilla::LookAndFeel::WindowsTheme sThemeId;
static bool sIsDefaultWindowsTheme;
static bool sIsHighContrastOn;
static void Initialize();
static void Teardown();
@ -106,6 +107,7 @@ public:
static void UpdateNativeThemeInfo();
static mozilla::LookAndFeel::WindowsTheme GetNativeThemeId();
static bool IsDefaultWindowTheme();
static bool IsHighContrastOn();
// This method returns the cached compositor state. Most
// callers should call without the argument. The cache