Bug 1243720 - Send accessibility theme state down to the content process on Windows. r=jimm

--HG--
extra : commitid : Bl9KE70LQHT
extra : rebase_source : 001c5608ccc5024d7000d26fcd35e247b62925f4
extra : amend_source : 22a5a6bd72dc54bfb16b159237d94375862abecc
This commit is contained in:
Mike Conley 2016-02-03 15:49:36 -05:00
Родитель 4217ddaae3
Коммит 887467fe9f
2 изменённых файлов: 45 добавлений и 2 удалений

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

@ -65,7 +65,9 @@ static int32_t GetSystemParam(long flag, int32_t def)
return ::SystemParametersInfo(flag, 0, &value, 0) ? value : def;
}
nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel()
nsLookAndFeel::nsLookAndFeel()
: nsXPLookAndFeel()
, mUseAccessibilityTheme(0)
{
mozilla::Telemetry::Accumulate(mozilla::Telemetry::TOUCH_ENABLED_DEVICE,
WinUtils::IsTouchDeviceSupportPresent());
@ -359,7 +361,16 @@ 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.
aResult = nsUXThemeData::IsHighContrastOn();
if (XRE_IsContentProcess()) {
// If we're running in the content process, then the parent should
// have sent us the accessibility state when nsLookAndFeel
// initialized, and stashed it in the mUseAccessibilityTheme cache.
aResult = mUseAccessibilityTheme;
} else {
// Otherwise, we can ask the OS to see if we're using High Contrast
// mode.
aResult = nsUXThemeData::IsHighContrastOn();
}
break;
case eIntID_ScrollArrowStyle:
aResult = eScrollArrowStyle_Single;
@ -663,3 +674,29 @@ nsLookAndFeel::GetPasswordCharacterImpl()
#define UNICODE_BLACK_CIRCLE_CHAR 0x25cf
return UNICODE_BLACK_CIRCLE_CHAR;
}
nsTArray<LookAndFeelInt>
nsLookAndFeel::GetIntCacheImpl()
{
nsTArray<LookAndFeelInt> lookAndFeelIntCache =
nsXPLookAndFeel::GetIntCacheImpl();
LookAndFeelInt useAccessibilityTheme;
useAccessibilityTheme.id = eIntID_UseAccessibilityTheme;
useAccessibilityTheme.value = GetInt(eIntID_UseAccessibilityTheme);
lookAndFeelIntCache.AppendElement(useAccessibilityTheme);
return lookAndFeelIntCache;
}
void
nsLookAndFeel::SetIntCacheImpl(const nsTArray<LookAndFeelInt>& aLookAndFeelIntCache)
{
for (auto entry : aLookAndFeelIntCache) {
if (entry.id == eIntID_UseAccessibilityTheme) {
mUseAccessibilityTheme = entry.value;
break;
}
}
}

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

@ -54,6 +54,12 @@ public:
gfxFontStyle& aFontStyle,
float aDevPixPerCSSPixel);
virtual char16_t GetPasswordCharacterImpl();
virtual nsTArray<LookAndFeelInt> GetIntCacheImpl();
virtual void SetIntCacheImpl(const nsTArray<LookAndFeelInt>& aLookAndFeelIntCache);
private:
int32_t mUseAccessibilityTheme;
};
#endif