Bug 1475462 - Implement prefers-reduced-motion for MacOSX. r=mstange

The local declaration part was done by jfkthame.

Differential Revision: https://phabricator.services.mozilla.com/D4499

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Hiroyuki Ikezoe 2018-08-29 01:36:37 +00:00
Родитель 804a02dafb
Коммит 08a872d1f5
1 изменённых файлов: 13 добавлений и 0 удалений

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

@ -32,6 +32,11 @@ typedef NSInteger mozNSScrollerStyle;
+ (mozNSScrollerStyle)preferredScrollerStyle; + (mozNSScrollerStyle)preferredScrollerStyle;
@end @end
// Available from 10.12 onwards; test availability at runtime before using
@interface NSWorkspace(AvailableSinceSierra)
@property (readonly) BOOL accessibilityDisplayShouldReduceMotion;
@end
nsLookAndFeel::nsLookAndFeel() nsLookAndFeel::nsLookAndFeel()
: nsXPLookAndFeel() : nsXPLookAndFeel()
, mUseOverlayScrollbars(-1) , mUseOverlayScrollbars(-1)
@ -544,6 +549,14 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
case eIntID_SystemUsesDarkTheme: case eIntID_SystemUsesDarkTheme:
aResult = SystemWantsDarkTheme(); aResult = SystemWantsDarkTheme();
break; break;
case eIntID_PrefersReducedMotion:
aResult = 0;
if ([[NSWorkspace sharedWorkspace] respondsToSelector:@selector(
accessibilityDisplayShouldReduceMotion)]) {
aResult =
[[NSWorkspace sharedWorkspace] accessibilityDisplayShouldReduceMotion] ? 1 : 0;
}
break;
default: default:
aResult = 0; aResult = 0;
res = NS_ERROR_FAILURE; res = NS_ERROR_FAILURE;