Diff
Modified: trunk/Source/WebKit/ChangeLog (278744 => 278745)
--- trunk/Source/WebKit/ChangeLog 2021-06-11 00:31:29 UTC (rev 278744)
+++ trunk/Source/WebKit/ChangeLog 2021-06-11 00:49:38 UTC (rev 278745)
@@ -1,3 +1,32 @@
+2021-06-10 Per Arne Vollan <pvol...@apple.com>
+
+ [iOS] Sync Accessibility preferences
+ https://bugs.webkit.org/show_bug.cgi?id=226738
+ <rdar://77922839>
+
+ Reviewed by Brent Fulgham.
+
+ Implement Per-App Accessibility preferences on iOS. The Per-App Accessibility preferences in the WebContent process
+ should reflect the values in the UI process. This is addressed by syncing the values between the two processes on
+ startup of the WebContent process, and when the values change.
+
+ * Platform/spi/Cocoa/AccessibilitySupportSPI.h:
+ * Shared/WebProcessCreationParameters.cpp:
+ (WebKit::WebProcessCreationParameters::encode const):
+ (WebKit::WebProcessCreationParameters::decode):
+ * Shared/WebProcessCreationParameters.h:
+ * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+ (WebKit::WebProcessPool::platformInitializeWebProcess):
+ (WebKit::WebProcessPool::accessibilityPreferencesChangedCallback):
+ (WebKit::WebProcessPool::registerNotificationObservers):
+ (WebKit::WebProcessPool::unregisterNotificationObservers):
+ * UIProcess/WebProcessPool.h:
+ * WebProcess/WebProcess.h:
+ * WebProcess/WebProcess.messages.in:
+ * WebProcess/cocoa/WebProcessCocoa.mm:
+ (WebKit::WebProcess::platformInitializeWebProcess):
+ (WebKit::WebProcess::accessibilityPreferencesDidChange):
+
2021-06-10 Sihui Liu <sihui_...@apple.com>
Regression(r278449): add null check for completionHandler in WebIDBServer::close
Modified: trunk/Source/WebKit/Platform/spi/Cocoa/AccessibilitySupportSPI.h (278744 => 278745)
--- trunk/Source/WebKit/Platform/spi/Cocoa/AccessibilitySupportSPI.h 2021-06-11 00:31:29 UTC (rev 278744)
+++ trunk/Source/WebKit/Platform/spi/Cocoa/AccessibilitySupportSPI.h 2021-06-11 00:49:38 UTC (rev 278745)
@@ -44,7 +44,31 @@
#if PLATFORM(IOS_FAMILY)
extern CFStringRef kAXSReduceMotionPreference;
+
extern CFStringRef kAXSReduceMotionChangedNotification;
+extern CFStringRef kAXSIncreaseButtonLegibilityNotification;
+extern CFStringRef kAXSEnhanceTextLegibilityChangedNotification;
+extern CFStringRef kAXSDarkenSystemColorsEnabledNotification;
+extern CFStringRef kAXSInvertColorsEnabledNotification;
+
+typedef enum {
+ AXValueStateInvalid = -2,
+ AXValueStateEmpty = -1,
+ AXValueStateOff,
+ AXValueStateOn
+} AXValueState;
+
+extern AXValueState _AXSReduceMotionEnabledApp(CFStringRef appID);
+extern AXValueState _AXSIncreaseButtonLegibilityApp(CFStringRef appID);
+extern AXValueState _AXSEnhanceTextLegibilityEnabledApp(CFStringRef appID);
+extern AXValueState _AXDarkenSystemColorsApp(CFStringRef appID);
+extern AXValueState _AXSInvertColorsEnabledApp(CFStringRef appID);
+
+extern void _AXSSetReduceMotionEnabledApp(AXValueState enabled, CFStringRef appID);
+extern void _AXSSetIncreaseButtonLegibilityApp(AXValueState enabled, CFStringRef appID);
+extern void _AXSSetEnhanceTextLegibilityEnabledApp(AXValueState enabled, CFStringRef appID);
+extern void _AXSSetDarkenSystemColorsApp(AXValueState enabled, CFStringRef appID);
+extern void _AXSInvertColorsSetEnabledApp(AXValueState enabled, CFStringRef appID);
#endif
#if PLATFORM(IOS_FAMILY) && ENABLE(FULL_KEYBOARD_ACCESS)
Added: trunk/Source/WebKit/Shared/AccessibilityPreferences.cpp (0 => 278745)
--- trunk/Source/WebKit/Shared/AccessibilityPreferences.cpp (rev 0)
+++ trunk/Source/WebKit/Shared/AccessibilityPreferences.cpp 2021-06-11 00:49:38 UTC (rev 278745)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "AccessibilityPreferences.h"
+
+namespace IPC {
+
+void ArgumentCoder<WebKit::AccessibilityPreferences>::encode(Encoder& encoder, const WebKit::AccessibilityPreferences& preferences)
+{
+#if HAVE(PER_APP_ACCESSIBILITY_PREFERENCES)
+ encoder << preferences.reduceMotionEnabled;
+ encoder << preferences.increaseButtonLegibility;
+ encoder << preferences.enhanceTextLegibility;
+ encoder << preferences.darkenSystemColors;
+ encoder << preferences.invertColorsEnabled;
+#endif
+}
+
+std::optional<WebKit::AccessibilityPreferences> ArgumentCoder<WebKit::AccessibilityPreferences>::decode(Decoder& decoder)
+{
+ WebKit::AccessibilityPreferences preferences;
+#if HAVE(PER_APP_ACCESSIBILITY_PREFERENCES)
+ if (!decoder.decode(preferences.reduceMotionEnabled))
+ return std::nullopt;
+ if (!decoder.decode(preferences.increaseButtonLegibility))
+ return std::nullopt;
+ if (!decoder.decode(preferences.enhanceTextLegibility))
+ return std::nullopt;
+ if (!decoder.decode(preferences.darkenSystemColors))
+ return std::nullopt;
+ if (!decoder.decode(preferences.invertColorsEnabled))
+ return std::nullopt;
+#endif
+ return preferences;
+}
+
+} // namespace IPC
Added: trunk/Source/WebKit/Shared/AccessibilityPreferences.h (0 => 278745)
--- trunk/Source/WebKit/Shared/AccessibilityPreferences.h (rev 0)
+++ trunk/Source/WebKit/Shared/AccessibilityPreferences.h 2021-06-11 00:49:38 UTC (rev 278745)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "ArgumentCoders.h"
+
+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 };
+#endif
+};
+
+} // namespace WebKit
+
+namespace IPC {
+template<> struct ArgumentCoder<WebKit::AccessibilityPreferences> {
+ static void encode(Encoder&, const WebKit::AccessibilityPreferences&);
+ static std::optional<WebKit::AccessibilityPreferences> decode(Decoder&);
+};
+}
Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp (278744 => 278745)
--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp 2021-06-11 00:31:29 UTC (rev 278744)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp 2021-06-11 00:49:38 UTC (rev 278745)
@@ -202,6 +202,8 @@
#if HAVE(IOSURFACE)
encoder << maximumIOSurfaceSize;
#endif
+
+ encoder << accessibilityPreferences;
}
bool WebProcessCreationParameters::decode(IPC::Decoder& decoder, WebProcessCreationParameters& parameters)
@@ -549,6 +551,12 @@
return false;
#endif
+ std::optional<AccessibilityPreferences> accessibilityPreferences;
+ decoder >> accessibilityPreferences;
+ if (!accessibilityPreferences)
+ return false;
+ parameters.accessibilityPreferences = WTFMove(*accessibilityPreferences);
+
return true;
}
Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.h (278744 => 278745)
--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.h 2021-06-11 00:31:29 UTC (rev 278744)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.h 2021-06-11 00:49:38 UTC (rev 278745)
@@ -25,6 +25,7 @@
#pragma once
+#include "AccessibilityPreferences.h"
#include "CacheModel.h"
#include "SandboxExtension.h"
#include "TextCheckerState.h"
@@ -243,6 +244,8 @@
#if HAVE(IOSURFACE)
WebCore::IntSize maximumIOSurfaceSize;
#endif
+
+ AccessibilityPreferences accessibilityPreferences;
};
} // namespace WebKit
Modified: trunk/Source/WebKit/Sources.txt (278744 => 278745)
--- trunk/Source/WebKit/Sources.txt 2021-06-11 00:31:29 UTC (rev 278744)
+++ trunk/Source/WebKit/Sources.txt 2021-06-11 00:49:38 UTC (rev 278745)
@@ -164,6 +164,7 @@
PluginProcess/WebProcessConnection.cpp @no-unify
// TODO: The files here marked @no-unify should be unified once GTK's PluginProcess2 is removed.
+Shared/AccessibilityPreferences.cpp
Shared/ActivityAssertion.cpp @no-unify
Shared/AsyncRequest.cpp
Shared/AuxiliaryProcess.cpp @no-unify
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (278744 => 278745)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2021-06-11 00:31:29 UTC (rev 278744)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2021-06-11 00:49:38 UTC (rev 278745)
@@ -26,6 +26,7 @@
#import "config.h"
#import "WebProcessPool.h"
+#import "AccessibilityPreferences.h"
#import "AccessibilitySupportSPI.h"
#import "CookieStorageUtilsCF.h"
#import "DefaultWebBrowserChecks.h"
@@ -267,6 +268,21 @@
#endif
}
+static AccessibilityPreferences accessibilityPreferences()
+{
+ AccessibilityPreferences preferences;
+#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;
+#endif
+ return preferences;
+}
+
void WebProcessPool::platformInitializeWebProcess(const WebProcessProxy& process, WebProcessCreationParameters& parameters)
{
parameters.mediaMIMETypes = process.mediaMIMETypes();
@@ -453,6 +469,8 @@
// However, querying this is a launch time regression, so limit this to only the necessary case.
if (m_defaultPageGroup->preferences().useGPUProcessForDOMRenderingEnabled())
parameters.maximumIOSurfaceSize = WebCore::IOSurface::maximumSize();
+
+ parameters.accessibilityPreferences = accessibilityPreferences();
}
void WebProcessPool::platformInitializeNetworkProcess(NetworkProcessCreationParameters& parameters)
@@ -557,6 +575,13 @@
auto* pool = reinterpret_cast<WebProcessPool*>(observer);
pool->sendToAllProcesses(Messages::WebProcess::BacklightLevelDidChange(BKSDisplayBrightnessGetCurrent()));
}
+
+void WebProcessPool::accessibilityPreferencesChangedCallback(CFNotificationCenterRef, void *observer, CFStringRef name, const void *, CFDictionaryRef userInfo)
+{
+ auto* pool = reinterpret_cast<WebProcessPool*>(observer);
+ pool->sendToAllProcesses(Messages::WebProcess::AccessibilityPreferencesDidChange(accessibilityPreferences()));
+}
+
#endif
#if PLATFORM(MAC)
@@ -687,6 +712,14 @@
m_powerSourceNotifier = WTF::makeUnique<WebCore::PowerSourceNotifier>([this] (bool hasAC) {
sendToAllProcesses(Messages::WebProcess::PowerSourceDidChange(hasAC));
});
+
+#if HAVE(PER_APP_ACCESSIBILITY_PREFERENCES)
+ CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, accessibilityPreferencesChangedCallback, kAXSReduceMotionChangedNotification, nullptr, CFNotificationSuspensionBehaviorCoalesce);
+ CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, accessibilityPreferencesChangedCallback, kAXSIncreaseButtonLegibilityNotification, nullptr, CFNotificationSuspensionBehaviorCoalesce);
+ CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, accessibilityPreferencesChangedCallback, kAXSEnhanceTextLegibilityChangedNotification, nullptr, CFNotificationSuspensionBehaviorCoalesce);
+ CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, accessibilityPreferencesChangedCallback, kAXSDarkenSystemColorsEnabledNotification, nullptr, CFNotificationSuspensionBehaviorCoalesce);
+ CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, accessibilityPreferencesChangedCallback, kAXSInvertColorsEnabledNotification, nullptr, CFNotificationSuspensionBehaviorCoalesce);
+#endif
}
void WebProcessPool::unregisterNotificationObservers()
@@ -720,6 +753,14 @@
[[NSNotificationCenter defaultCenter] removeObserver:m_activationObserver.get()];
m_powerSourceNotifier = nullptr;
+
+#if HAVE(PER_APP_ACCESSIBILITY_PREFERENCES)
+ CFNotificationCenterRemoveObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, kAXSReduceMotionChangedNotification, nullptr);
+ CFNotificationCenterRemoveObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, kAXSIncreaseButtonLegibilityNotification, nullptr);
+ CFNotificationCenterRemoveObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, kAXSEnhanceTextLegibilityChangedNotification, nullptr);
+ CFNotificationCenterRemoveObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, kAXSDarkenSystemColorsEnabledNotification, nullptr);
+ CFNotificationCenterRemoveObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, kAXSInvertColorsEnabledNotification, nullptr);
+#endif
}
bool WebProcessPool::isURLKnownHSTSHost(const String& urlString) const
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.h (278744 => 278745)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.h 2021-06-11 00:31:29 UTC (rev 278744)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.h 2021-06-11 00:49:38 UTC (rev 278745)
@@ -577,6 +577,10 @@
#endif
#endif
+#if PLATFORM(COCOA)
+ static void accessibilityPreferencesChangedCallback(CFNotificationCenterRef, void *observer, CFStringRef name, const void *, CFDictionaryRef userInfo);
+#endif
+
#if PLATFORM(MAC)
static void colorPreferencesDidChangeCallback(CFNotificationCenterRef, void *observer, CFStringRef name, const void *, CFDictionaryRef userInfo);
#endif
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (278744 => 278745)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-06-11 00:31:29 UTC (rev 278744)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2021-06-11 00:49:38 UTC (rev 278745)
@@ -5899,6 +5899,8 @@
E39628DB23960CC500658ECD /* WebDeviceOrientationUpdateProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientationUpdateProvider.h; sourceTree = "<group>"; };
E39628DC23960CC600658ECD /* WebDeviceOrientationUpdateProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebDeviceOrientationUpdateProvider.cpp; sourceTree = "<group>"; };
E39628E423971F3400658ECD /* WebDeviceOrientationUpdateProvider.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebDeviceOrientationUpdateProvider.messages.in; sourceTree = "<group>"; };
+ E3BCE877267252120011D8DB /* AccessibilityPreferences.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityPreferences.cpp; sourceTree = "<group>"; };
+ E3BCE878267252120011D8DB /* AccessibilityPreferences.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AccessibilityPreferences.h; sourceTree = "<group>"; };
E3CAAA432413278A00CED2E2 /* AccessibilitySupportSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilitySupportSPI.h; sourceTree = "<group>"; };
E3EFB02C2550617C003C2F96 /* WebSystemSoundDelegate.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebSystemSoundDelegate.cpp; sourceTree = "<group>"; };
E3EFB02D2550617C003C2F96 /* WebSystemSoundDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebSystemSoundDelegate.h; sourceTree = "<group>"; };
@@ -6682,6 +6684,8 @@
1AAE058C1279DCD400852418 /* Plugins */,
2D2E04761F5BEC4F00BB25ED /* RemoteLayerTree */,
1ABF43781A368035003FB0E6 /* WebsiteData */,
+ E3BCE877267252120011D8DB /* AccessibilityPreferences.cpp */,
+ E3BCE878267252120011D8DB /* AccessibilityPreferences.h */,
A7D792D51767CB6E00881CBE /* ActivityAssertion.cpp */,
A7D792D41767CB0900881CBE /* ActivityAssertion.h */,
BC329D9A16ACCE9900316DE2 /* APIWebArchive.h */,
Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (278744 => 278745)
--- trunk/Source/WebKit/WebProcess/WebProcess.h 2021-06-11 00:31:29 UTC (rev 278744)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h 2021-06-11 00:49:38 UTC (rev 278745)
@@ -25,6 +25,7 @@
#pragma once
+#include "AccessibilityPreferences.h"
#include "AuxiliaryProcess.h"
#include "CacheModel.h"
#include "PluginProcessConnectionManager.h"
@@ -566,6 +567,8 @@
void backlightLevelDidChange(float backlightLevel);
#endif
+ void accessibilityPreferencesDidChange(const AccessibilityPreferences&);
+
#if PLATFORM(MAC) || PLATFORM(MACCATALYST)
void colorPreferencesDidChange();
#endif
Modified: trunk/Source/WebKit/WebProcess/WebProcess.messages.in (278744 => 278745)
--- trunk/Source/WebKit/WebProcess/WebProcess.messages.in 2021-06-11 00:31:29 UTC (rev 278744)
+++ trunk/Source/WebKit/WebProcess/WebProcess.messages.in 2021-06-11 00:49:38 UTC (rev 278745)
@@ -201,5 +201,6 @@
#if PLATFORM(COCOA)
ConsumeAudioComponentRegistrations(IPC::SharedBufferDataReference registrationData)
+ AccessibilityPreferencesDidChange(struct WebKit::AccessibilityPreferences accessibilityPreferences)
#endif
}
Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (278744 => 278745)
--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2021-06-11 00:31:29 UTC (rev 278744)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2021-06-11 00:49:38 UTC (rev 278745)
@@ -26,6 +26,7 @@
#import "config.h"
#import "WebProcess.h"
+#import "AccessibilitySupportSPI.h"
#import "GPUProcessConnectionParameters.h"
#import "LegacyCustomProtocolManager.h"
#import "LogInitialization.h"
@@ -448,6 +449,8 @@
if (!parameters.maximumIOSurfaceSize.isEmpty())
WebCore::IOSurface::setMaximumSize(parameters.maximumIOSurfaceSize);
+
+ accessibilityPreferencesDidChange(parameters.accessibilityPreferences);
}
void WebProcess::platformSetWebsiteDataStoreParameters(WebProcessDataStoreParameters&& parameters)
@@ -1036,6 +1039,18 @@
}
#endif
+void WebProcess::accessibilityPreferencesDidChange(const AccessibilityPreferences& preferences)
+{
+#if HAVE(PER_APP_ACCESSIBILITY_PREFERENCES)
+ auto appID = CFSTR("com.apple.WebKit.WebContent");
+ _AXSSetReduceMotionEnabledApp(preferences.reduceMotionEnabled ? AXValueStateOn : AXValueStateOff, appID);
+ _AXSSetIncreaseButtonLegibilityApp(preferences.increaseButtonLegibility ? AXValueStateOn : AXValueStateOff, appID);
+ _AXSSetEnhanceTextLegibilityEnabledApp(preferences.enhanceTextLegibility ? AXValueStateOn : AXValueStateOff, appID);
+ _AXSSetDarkenSystemColorsApp(preferences.darkenSystemColors ? AXValueStateOn : AXValueStateOff, appID);
+ _AXSInvertColorsSetEnabledApp(preferences.invertColorsEnabled ? AXValueStateOn : AXValueStateOff, appID);
+#endif
+}
+
#if PLATFORM(MAC) || PLATFORM(MACCATALYST)
void WebProcess::colorPreferencesDidChange()
{