Updated screenHasInvertedColors to use AppKit when available
https://bugs.webkit.org/show_bug.cgi?id=197935
<rdar://problem/50834405>
Patch by Greg Hughes <ghughes@apple.com> on 2019-05-16
Reviewed by Chris Fleizach.
* platform/mac/PlatformScreenMac.mm:
(WebCore::collectScreenProperties):
(WebCore::screenHasInvertedColors):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@245392 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 3804d09..b8354e0 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2019-05-16 Greg Hughes <ghughes@apple.com>
+
+ Updated screenHasInvertedColors to use AppKit when available
+ https://bugs.webkit.org/show_bug.cgi?id=197935
+ <rdar://problem/50834405>
+
+ Reviewed by Chris Fleizach.
+
+ * platform/mac/PlatformScreenMac.mm:
+ (WebCore::collectScreenProperties):
+ (WebCore::screenHasInvertedColors):
+
2019-05-15 Simon Fraser <simon.fraser@apple.com>
Avoid a recursive descendants layer walk sometimes
diff --git a/Source/WebCore/platform/mac/PlatformScreenMac.mm b/Source/WebCore/platform/mac/PlatformScreenMac.mm
index 0402319..7c3d960 100644
--- a/Source/WebCore/platform/mac/PlatformScreenMac.mm
+++ b/Source/WebCore/platform/mac/PlatformScreenMac.mm
@@ -112,6 +112,7 @@
ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
ScreenProperties screenProperties;
+ bool screenHasInvertedColors = [[NSWorkspace sharedWorkspace] accessibilityDisplayShouldInvertColors];
for (NSScreen *screen in [NSScreen screens]) {
auto displayID = WebCore::displayID(screen);
@@ -124,7 +125,6 @@
int screenDepth = NSBitsPerPixelFromDepth(screen.depth);
int screenDepthPerComponent = NSBitsPerSampleFromDepth(screen.depth);
bool screenSupportsExtendedColor = [screen canRepresentDisplayGamut:NSDisplayGamutP3];
- bool screenHasInvertedColors = CGDisplayUsesInvertedPolarity();
bool screenIsMonochrome = CGDisplayUsesForceToGray();
uint32_t displayMask = CGDisplayIDToOpenGLDisplayMask(displayID);
IORegistryGPUID gpuID = 0;
@@ -256,7 +256,7 @@
// This is a system-wide accessibility setting, same on all screens.
ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
- return CGDisplayUsesInvertedPolarity();
+ return [[NSWorkspace sharedWorkspace] accessibilityDisplayShouldInvertColors];
}
int screenDepth(Widget* widget)