Title: [279342] trunk/Source/WebKit
Revision
279342
Author
[email protected]
Date
2021-06-28 10:41:25 -0700 (Mon, 28 Jun 2021)

Log Message

Pass correct value of AX per app settings to the WebContent process
https://bugs.webkit.org/show_bug.cgi?id=227441
<rdar://problem/79857797>

Reviewed by Brent Fulgham.

Pass value of type AXValueState instead of a boolean value for per app AX settings.

* Shared/AccessibilityPreferences.h:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::accessibilityPreferences):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::accessibilityPreferencesDidChange):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (279341 => 279342)


--- trunk/Source/WebKit/ChangeLog	2021-06-28 16:48:33 UTC (rev 279341)
+++ trunk/Source/WebKit/ChangeLog	2021-06-28 17:41:25 UTC (rev 279342)
@@ -1,3 +1,19 @@
+2021-06-28  Per Arne  <[email protected]>
+
+        Pass correct value of AX per app settings to the WebContent process
+        https://bugs.webkit.org/show_bug.cgi?id=227441
+        <rdar://problem/79857797>
+
+        Reviewed by Brent Fulgham.
+
+        Pass value of type AXValueState instead of a boolean value for per app AX settings.
+
+        * Shared/AccessibilityPreferences.h:
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::accessibilityPreferences):
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::accessibilityPreferencesDidChange):
+
 2021-06-28  Alex Christensen  <[email protected]>
 
         RELEASE_ASSERT hit in NetworkSessionCocoa::removeWebSocketTask when using WKWebViewConfiguration._attributedBundleIdentifier

Modified: trunk/Source/WebKit/Shared/AccessibilityPreferences.h (279341 => 279342)


--- trunk/Source/WebKit/Shared/AccessibilityPreferences.h	2021-06-28 16:48:33 UTC (rev 279341)
+++ trunk/Source/WebKit/Shared/AccessibilityPreferences.h	2021-06-28 17:41:25 UTC (rev 279342)
@@ -31,15 +31,19 @@
 #include <WebCore/CaptionUserPreferences.h>
 #endif
 
+#if HAVE(PER_APP_ACCESSIBILITY_PREFERENCES)
+#include "AccessibilitySupportSPI.h"
+#endif
+
 namespace WebKit {
 
 struct AccessibilityPreferences {
 #if HAVE(PER_APP_ACCESSIBILITY_PREFERENCES)
-    bool reduceMotionEnabled { false };
-    bool increaseButtonLegibility { false };
-    bool enhanceTextLegibility { false };
-    bool darkenSystemColors { false };
-    bool invertColorsEnabled { false };
+    AXValueState reduceMotionEnabled { AXValueStateEmpty };
+    AXValueState increaseButtonLegibility { AXValueStateEmpty };
+    AXValueState enhanceTextLegibility { AXValueStateEmpty };
+    AXValueState darkenSystemColors { AXValueStateEmpty };
+    AXValueState invertColorsEnabled { AXValueStateEmpty };
 #endif
 #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
     WebCore::CaptionUserPreferences::CaptionDisplayMode captionDisplayMode;
@@ -55,3 +59,19 @@
     static std::optional<WebKit::AccessibilityPreferences> decode(Decoder&);
 };
 }
+
+#if HAVE(PER_APP_ACCESSIBILITY_PREFERENCES)
+namespace WTF {
+
+template<> struct EnumTraits<AXValueState> {
+    using values = EnumValues<
+        AXValueState,
+        AXValueState::AXValueStateInvalid,
+        AXValueState::AXValueStateEmpty,
+        AXValueState::AXValueStateOff,
+        AXValueState::AXValueStateOn
+    >;
+};
+
+} // namespace WTF
+#endif

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (279341 => 279342)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2021-06-28 16:48:33 UTC (rev 279341)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2021-06-28 17:41:25 UTC (rev 279342)
@@ -279,11 +279,11 @@
 #if HAVE(PER_APP_ACCESSIBILITY_PREFERENCES)
     auto appId = WebCore::applicationBundleIdentifier().createCFString();
 
-    preferences.reduceMotionEnabled = _AXSReduceMotionEnabledApp(appId.get()) == AXValueStateOn;
-    preferences.increaseButtonLegibility = _AXSIncreaseButtonLegibilityApp(appId.get()) == AXValueStateOn;
-    preferences.enhanceTextLegibility = _AXSEnhanceTextLegibilityEnabledApp(appId.get()) == AXValueStateOn;
-    preferences.darkenSystemColors = _AXDarkenSystemColorsApp(appId.get()) == AXValueStateOn;
-    preferences.invertColorsEnabled = _AXSInvertColorsEnabledApp(appId.get()) == AXValueStateOn;
+    preferences.reduceMotionEnabled = _AXSReduceMotionEnabledApp(appId.get());
+    preferences.increaseButtonLegibility = _AXSIncreaseButtonLegibilityApp(appId.get());
+    preferences.enhanceTextLegibility = _AXSEnhanceTextLegibilityEnabledApp(appId.get());
+    preferences.darkenSystemColors = _AXDarkenSystemColorsApp(appId.get());
+    preferences.invertColorsEnabled = _AXSInvertColorsEnabledApp(appId.get());
 #endif
 #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
     preferences.captionDisplayMode = WebCore::CaptionUserPreferencesMediaAF::platformCaptionDisplayMode();

Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (279341 => 279342)


--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2021-06-28 16:48:33 UTC (rev 279341)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2021-06-28 17:41:25 UTC (rev 279342)
@@ -1094,19 +1094,20 @@
 {
 #if HAVE(PER_APP_ACCESSIBILITY_PREFERENCES)
     auto appID = CFSTR("com.apple.WebKit.WebContent");
-    auto reduceMotionEnabled = preferences.reduceMotionEnabled ? AXValueStateOn : AXValueStateOff;
+    auto reduceMotionEnabled = preferences.reduceMotionEnabled;
+    WTFLogAlways("AX: reduce motion: %d", (int)reduceMotionEnabled);
     if (_AXSReduceMotionEnabledApp(appID) != reduceMotionEnabled)
         _AXSSetReduceMotionEnabledApp(reduceMotionEnabled, appID);
-    auto increaseButtonLegibility = preferences.increaseButtonLegibility ? AXValueStateOn : AXValueStateOff;
+    auto increaseButtonLegibility = preferences.increaseButtonLegibility;
     if (_AXSIncreaseButtonLegibilityApp(appID) != increaseButtonLegibility)
         _AXSSetIncreaseButtonLegibilityApp(increaseButtonLegibility, appID);
-    auto enhanceTextLegibility = preferences.enhanceTextLegibility ? AXValueStateOn : AXValueStateOff;
+    auto enhanceTextLegibility = preferences.enhanceTextLegibility;
     if (_AXSEnhanceTextLegibilityEnabledApp(appID) != enhanceTextLegibility)
         _AXSSetEnhanceTextLegibilityEnabledApp(enhanceTextLegibility, appID);
-    auto darkenSystemColors = preferences.darkenSystemColors ? AXValueStateOn : AXValueStateOff;
+    auto darkenSystemColors = preferences.darkenSystemColors;
     if (_AXDarkenSystemColorsApp(appID) != darkenSystemColors)
         _AXSSetDarkenSystemColorsApp(darkenSystemColors, appID);
-    auto invertColorsEnabled = preferences.invertColorsEnabled ? AXValueStateOn : AXValueStateOff;
+    auto invertColorsEnabled = preferences.invertColorsEnabled;
     if (_AXSInvertColorsEnabledApp(appID) != invertColorsEnabled)
         _AXSInvertColorsSetEnabledApp(invertColorsEnabled, appID);
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to