Updated screenHasInvertedColors to use AppKit when available
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 May 2019 09:22:22 +0000 (09:22 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 May 2019 09:22:22 +0000 (09:22 +0000)
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: https://svn.webkit.org/repository/webkit/trunk@245392 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/mac/PlatformScreenMac.mm

index 3804d09..b8354e0 100644 (file)
@@ -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
index 0402319..7c3d960 100644 (file)
@@ -112,6 +112,7 @@ ScreenProperties collectScreenProperties()
     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 @@ ScreenProperties collectScreenProperties()
         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 @@ bool screenHasInvertedColors()
 
     // 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)