Diff
Modified: trunk/Source/WebKit/ChangeLog (282668 => 282669)
--- trunk/Source/WebKit/ChangeLog 2021-09-17 17:27:01 UTC (rev 282668)
+++ trunk/Source/WebKit/ChangeLog 2021-09-17 17:36:27 UTC (rev 282669)
@@ -1,3 +1,30 @@
+2021-09-17 Per Arne Vollan <pvol...@apple.com>
+
+ [GPUP] Update AX settings on preference updates
+ https://bugs.webkit.org/show_bug.cgi?id=230409
+
+ Reviewed by Chris Fleizach.
+
+ We should update AX settings in the GPUP process on preference updates, like we do in the WebContent process. To address this,
+ move associated code from the WebProcess class to the AuxiliaryProcess class.
+
+ * GPUProcess/GPUProcess.h:
+ * GPUProcess/cocoa/GPUProcessCocoa.mm:
+ (WebKit::GPUProcess::notifyPreferencesChanged):
+ (WebKit::GPUProcess::dispatchSimulatedNotificationsForPreferenceChange):
+ * Shared/AuxiliaryProcess.h:
+ (WebKit::AuxiliaryProcess::dispatchSimulatedNotificationsForPreferenceChange):
+ * Shared/Cocoa/AuxiliaryProcessCocoa.mm:
+ (WebKit::AuxiliaryProcess::preferenceDidUpdate):
+ (WebKit::AuxiliaryProcess::handlePreferenceChange):
+ * WebProcess/WebProcess.h:
+ * WebProcess/cocoa/WebProcessCocoa.mm:
+ (WebKit::WebProcess::dispatchSimulatedNotificationsForPreferenceChange):
+ (WebKit::WebProcess::handlePreferenceChange):
+ (WebKit::WebProcess::notifyPreferencesChanged):
+ (WebKit::dispatchSimulatedNotificationsForPreferenceChange): Deleted.
+ (WebKit::handlePreferenceChange): Deleted.
+
2021-09-17 Chris Dumez <cdu...@apple.com>
Crash under RemoteMediaPlayerManager::getSupportedTypes()
Modified: trunk/Source/WebKit/GPUProcess/GPUProcess.h (282668 => 282669)
--- trunk/Source/WebKit/GPUProcess/GPUProcess.h 2021-09-17 17:27:01 UTC (rev 282668)
+++ trunk/Source/WebKit/GPUProcess/GPUProcess.h 2021-09-17 17:36:27 UTC (rev 282669)
@@ -157,6 +157,7 @@
#if ENABLE(CFPREFS_DIRECT_MODE)
void notifyPreferencesChanged(const String& domain, const String& key, const std::optional<String>& encodedValue);
+ void dispatchSimulatedNotificationsForPreferenceChange(const String& key) final;
#endif
// Connections to WebProcesses.
Modified: trunk/Source/WebKit/GPUProcess/cocoa/GPUProcessCocoa.mm (282668 => 282669)
--- trunk/Source/WebKit/GPUProcess/cocoa/GPUProcessCocoa.mm 2021-09-17 17:27:01 UTC (rev 282668)
+++ trunk/Source/WebKit/GPUProcess/cocoa/GPUProcessCocoa.mm 2021-09-17 17:36:27 UTC (rev 282669)
@@ -69,16 +69,15 @@
#if ENABLE(CFPREFS_DIRECT_MODE)
void GPUProcess::notifyPreferencesChanged(const String& domain, const String& key, const std::optional<String>& encodedValue)
{
- id value = nil;
- if (encodedValue) {
- value = decodePreferenceValue(encodedValue);
- if (!value)
- return;
- }
- setPreferenceValue(domain, key, value);
+ preferenceDidUpdate(domain, key, encodedValue);
}
-#endif
+void GPUProcess::dispatchSimulatedNotificationsForPreferenceChange(const String& key)
+{
+}
+
+#endif // ENABLE(CFPREFS_DIRECT_MODE)
+
} // namespace WebKit
#endif // ENABLE(GPU_PROCESS) && PLATFORM(COCOA)
Modified: trunk/Source/WebKit/Shared/AuxiliaryProcess.h (282668 => 282669)
--- trunk/Source/WebKit/Shared/AuxiliaryProcess.h 2021-09-17 17:27:01 UTC (rev 282668)
+++ trunk/Source/WebKit/Shared/AuxiliaryProcess.h 2021-09-17 17:36:27 UTC (rev 282669)
@@ -138,6 +138,10 @@
#if ENABLE(CFPREFS_DIRECT_MODE)
static id decodePreferenceValue(const std::optional<String>& encodedValue);
static void setPreferenceValue(const String& domain, const String& key, id value);
+
+ virtual void preferenceDidUpdate(const String& domain, const String& key, const std::optional<String>& encodedValue);
+ virtual void handlePreferenceChange(const String& domain, const String& key, id value);
+ virtual void dispatchSimulatedNotificationsForPreferenceChange(const String& key) { }
#endif
private:
Modified: trunk/Source/WebKit/Shared/Cocoa/AuxiliaryProcessCocoa.mm (282668 => 282669)
--- trunk/Source/WebKit/Shared/Cocoa/AuxiliaryProcessCocoa.mm 2021-09-17 17:27:01 UTC (rev 282668)
+++ trunk/Source/WebKit/Shared/Cocoa/AuxiliaryProcessCocoa.mm 2021-09-17 17:36:27 UTC (rev 282669)
@@ -35,6 +35,16 @@
#import <wtf/cocoa/Entitlements.h>
#import <wtf/cocoa/RuntimeApplicationChecksCocoa.h>
+#if ENABLE(CFPREFS_DIRECT_MODE)
+#import "AccessibilitySupportSPI.h"
+#import <pal/spi/cocoa/AccessibilitySupportSPI.h>
+#endif
+
+#if HAVE(UPDATE_WEB_ACCESSIBILITY_SETTINGS) && ENABLE(CFPREFS_DIRECT_MODE)
+SOFT_LINK_LIBRARY(libAccessibility)
+SOFT_LINK_OPTIONAL(libAccessibility, _AXSUpdateWebAccessibilitySettings, void, (), ());
+#endif
+
namespace WebKit {
#if PLATFORM(MAC) || PLATFORM(MACCATALYST)
@@ -160,6 +170,46 @@
} else
CFPreferencesSetValue(key.createCFString().get(), (__bridge CFPropertyListRef)value, domain.createCFString().get(), kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
}
+
+void AuxiliaryProcess::preferenceDidUpdate(const String& domain, const String& key, const std::optional<String>& encodedValue)
+{
+ id value = nil;
+ if (encodedValue) {
+ value = decodePreferenceValue(encodedValue);
+ if (!value)
+ return;
+ }
+ setPreferenceValue(domain, key, value);
+ handlePreferenceChange(domain, key, value);
+}
+
+#if !HAVE(UPDATE_WEB_ACCESSIBILITY_SETTINGS) && PLATFORM(IOS_FAMILY)
+static const WTF::String& increaseContrastPreferenceKey()
+{
+ static NeverDestroyed<WTF::String> key(MAKE_STATIC_STRING_IMPL("DarkenSystemColors"));
+ return key;
+}
+#endif
+
+void AuxiliaryProcess::handlePreferenceChange(const String& domain, const String& key, id value)
+{
+ if (domain == String(kAXSAccessibilityPreferenceDomain)) {
+#if HAVE(UPDATE_WEB_ACCESSIBILITY_SETTINGS)
+ if (_AXSUpdateWebAccessibilitySettingsPtr())
+ _AXSUpdateWebAccessibilitySettingsPtr()();
+#elif PLATFORM(IOS_FAMILY)
+ // If the update method is not available, to update the cache inside AccessibilitySupport,
+ // these methods need to be called directly.
+ if (CFEqual(key.createCFString().get(), kAXSReduceMotionPreference) && [value isKindOfClass:[NSNumber class]])
+ _AXSSetReduceMotionEnabled([(NSNumber *)value boolValue]);
+ else if (CFEqual(key.createCFString().get(), increaseContrastPreferenceKey()) && [value isKindOfClass:[NSNumber class]])
+ _AXSSetDarkenSystemColors([(NSNumber *)value boolValue]);
+#endif
+ }
+
+ dispatchSimulatedNotificationsForPreferenceChange(key);
+}
+
#endif // ENABLE(CFPREFS_DIRECT_MODE)
} // namespace WebKit
Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (282668 => 282669)
--- trunk/Source/WebKit/WebProcess/WebProcess.h 2021-09-17 17:27:01 UTC (rev 282668)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h 2021-09-17 17:36:27 UTC (rev 282669)
@@ -607,6 +607,11 @@
void setUseSystemAppearanceForScrollbars(bool);
#endif
+#if ENABLE(CFPREFS_DIRECT_MODE)
+ void handlePreferenceChange(const String& domain, const String& key, id value) final;
+ void dispatchSimulatedNotificationsForPreferenceChange(const String& key) final;
+#endif
+
RefPtr<WebConnectionToUIProcess> m_webConnection;
HashMap<WebCore::PageIdentifier, RefPtr<WebPage>> m_pageMap;
Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (282668 => 282669)
--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2021-09-17 17:27:01 UTC (rev 282668)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2021-09-17 17:36:27 UTC (rev 282669)
@@ -90,7 +90,6 @@
#import <pal/spi/cf/CFUtilitiesSPI.h>
#import <pal/spi/cg/CoreGraphicsSPI.h>
#import <pal/spi/cocoa/AVFoundationSPI.h>
-#import <pal/spi/cocoa/AccessibilitySupportSPI.h>
#import <pal/spi/cocoa/CoreServicesSPI.h>
#import <pal/spi/cocoa/LaunchServicesSPI.h>
#import <pal/spi/cocoa/NSAccessibilitySPI.h>
@@ -108,10 +107,6 @@
#import <wtf/cocoa/RuntimeApplicationChecksCocoa.h>
#import <wtf/cocoa/VectorCocoa.h>
-#if ENABLE(CFPREFS_DIRECT_MODE)
-#import "AccessibilitySupportSPI.h"
-#endif
-
#if ENABLE(REMOTE_INSPECTOR)
#import <_javascript_Core/RemoteInspector.h>
#endif
@@ -186,11 +181,6 @@
SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(WebKit, HIServices, _AXSetAuditTokenIsAuthenticatedCallback, void, (AXAuditTokenIsAuthenticatedCallback callback), (callback))
#endif
-#if HAVE(UPDATE_WEB_ACCESSIBILITY_SETTINGS) && ENABLE(CFPREFS_DIRECT_MODE)
-SOFT_LINK_LIBRARY(libAccessibility)
-SOFT_LINK_OPTIONAL(libAccessibility, _AXSUpdateWebAccessibilitySettings, void, (), ());
-#endif
-
namespace WebKit {
using namespace WebCore;
@@ -1093,14 +1083,6 @@
}
#endif
-#if !(HAVE(UPDATE_WEB_ACCESSIBILITY_SETTINGS) && ENABLE(CFPREFS_DIRECT_MODE)) && PLATFORM(IOS_FAMILY)
-static const WTF::String& increaseContrastPreferenceKey()
-{
- static NeverDestroyed<WTF::String> key(MAKE_STATIC_STRING_IMPL("DarkenSystemColors"));
- return key;
-}
-#endif
-
static const WTF::String& captionProfilePreferenceKey()
{
static NeverDestroyed<WTF::String> key(MAKE_STATIC_STRING_IMPL("MACaptionActiveProfile"));
@@ -1107,7 +1089,7 @@
return key;
}
-static void dispatchSimulatedNotificationsForPreferenceChange(const String& key)
+void WebProcess::dispatchSimulatedNotificationsForPreferenceChange(const String& key)
{
#if USE(APPKIT)
// Ordinarily, other parts of the system ensure that this notification is posted after this default is changed.
@@ -1131,7 +1113,7 @@
}
}
-static void handlePreferenceChange(const String& domain, const String& key, id value)
+void WebProcess::handlePreferenceChange(const String& domain, const String& key, id value)
{
if (key == "AppleLanguages") {
// We need to set AppleLanguages for the volatile domain, similarly to what we do in XPCServiceMain.mm.
@@ -1143,20 +1125,6 @@
WTF::languageDidChange();
}
- if (domain == String(kAXSAccessibilityPreferenceDomain)) {
-#if HAVE(UPDATE_WEB_ACCESSIBILITY_SETTINGS) && ENABLE(CFPREFS_DIRECT_MODE)
- if (_AXSUpdateWebAccessibilitySettingsPtr())
- _AXSUpdateWebAccessibilitySettingsPtr()();
-#elif PLATFORM(IOS_FAMILY)
- // If the update method is not available, to update the cache inside AccessibilitySupport,
- // these methods need to be called directly.
- if (CFEqual(key.createCFString().get(), kAXSReduceMotionPreference) && [value isKindOfClass:[NSNumber class]])
- _AXSSetReduceMotionEnabled([(NSNumber *)value boolValue]);
- else if (CFEqual(key.createCFString().get(), increaseContrastPreferenceKey()) && [value isKindOfClass:[NSNumber class]])
- _AXSSetDarkenSystemColors([(NSNumber *)value boolValue]);
-#endif
- }
-
#if USE(APPKIT)
auto cfKey = key.createCFString();
if (CFEqual(cfKey.get(), kAXInterfaceReduceMotionKey) || CFEqual(cfKey.get(), kAXInterfaceIncreaseContrastKey) || key == invertColorsPreferenceKey())
@@ -1163,19 +1131,12 @@
[NSWorkspace _invalidateAccessibilityDisplayValues];
#endif
- dispatchSimulatedNotificationsForPreferenceChange(key);
+ AuxiliaryProcess::handlePreferenceChange(domain, key, value);
}
void WebProcess::notifyPreferencesChanged(const String& domain, const String& key, const std::optional<String>& encodedValue)
{
- id value = nil;
- if (encodedValue) {
- value = decodePreferenceValue(encodedValue);
- if (!value)
- return;
- }
- setPreferenceValue(domain, key, value);
- handlePreferenceChange(domain, key, value);
+ preferenceDidUpdate(domain, key, encodedValue);
}
void WebProcess::unblockPreferenceService(Vector<SandboxExtension::Handle>&& handleArray)