Diff
Modified: trunk/Source/WTF/wtf/PlatformHave.h (278735 => 278736)
--- trunk/Source/WTF/wtf/PlatformHave.h 2021-06-10 22:19:21 UTC (rev 278735)
+++ trunk/Source/WTF/wtf/PlatformHave.h 2021-06-10 23:10:49 UTC (rev 278736)
@@ -1006,6 +1006,11 @@
#define HAVE_UIDATEPICKER_INSETS 1
#endif
+#if (((PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 150000) \
+ || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000))
+#define UPDATE_WEB_ACCESSIBILITY_SETTINGS 1
+#endif
+
#if PLATFORM(IOS) || PLATFORM(MACCATALYST)
#define HAVE_UIBLUREFFECT_STYLE_SYSTEM_MATERIAL 1
#endif
Modified: trunk/Source/WebKit/ChangeLog (278735 => 278736)
--- trunk/Source/WebKit/ChangeLog 2021-06-10 22:19:21 UTC (rev 278735)
+++ trunk/Source/WebKit/ChangeLog 2021-06-10 23:10:49 UTC (rev 278736)
@@ -1,3 +1,19 @@
+2021-06-10 Chris Fleizach <cfleiz...@apple.com>
+
+ AX: TestWebKitAPI.WebKit.AccessibilityReduceMotion failing on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=226758
+ <rdar://problem/78984253>
+
+ Reviewed by Alex Christensen.
+
+ For releases that don't have the accessibility update method, the direct setters need to be called
+ in order to update the cache.
+
+ * Platform/spi/Cocoa/AccessibilitySupportSPI.h:
+ * WebProcess/cocoa/WebProcessCocoa.mm:
+ (WebKit::increaseContrastPreferenceKey):
+ (WebKit::setPreferenceValue):
+
2021-06-10 Aditya Keerthi <akeer...@apple.com>
[iOS] VinylWall app crashes when tapping on 'format' dropdown menu in 'Add Record' menu
Modified: trunk/Source/WebKit/Platform/spi/Cocoa/AccessibilitySupportSPI.h (278735 => 278736)
--- trunk/Source/WebKit/Platform/spi/Cocoa/AccessibilitySupportSPI.h 2021-06-10 22:19:21 UTC (rev 278735)
+++ trunk/Source/WebKit/Platform/spi/Cocoa/AccessibilitySupportSPI.h 2021-06-10 23:10:49 UTC (rev 278736)
@@ -33,6 +33,8 @@
WTF_EXTERN_C_BEGIN
+extern void _AXSSetReduceMotionEnabled(Boolean enabled);
+extern void _AXSSetDarkenSystemColors(Boolean enabled);
extern Boolean _AXSKeyRepeatEnabled();
extern Boolean _AXSApplicationAccessibilityEnabled();
extern CFStringRef kAXSApplicationAccessibilityEnabledNotification;
Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (278735 => 278736)
--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2021-06-10 22:19:21 UTC (rev 278735)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2021-06-10 23:10:49 UTC (rev 278736)
@@ -86,6 +86,7 @@
#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>
@@ -173,7 +174,7 @@
SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(WebKit, HIServices, _AXSetAuditTokenIsAuthenticatedCallback, void, (AXAuditTokenIsAuthenticatedCallback callback), (callback))
#endif
-#if ENABLE(CFPREFS_DIRECT_MODE)
+#if HAVE(UPDATE_WEB_ACCESSIBILITY_SETTINGS) && ENABLE(CFPREFS_DIRECT_MODE)
SOFT_LINK_LIBRARY(libAccessibility)
SOFT_LINK_OPTIONAL(libAccessibility, _AXSUpdateWebAccessibilitySettings, void, (), ());
#endif
@@ -1078,6 +1079,14 @@
}
#endif
+#if 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"));
@@ -1130,8 +1139,17 @@
}
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)
Modified: trunk/Tools/ChangeLog (278735 => 278736)
--- trunk/Tools/ChangeLog 2021-06-10 22:19:21 UTC (rev 278735)
+++ trunk/Tools/ChangeLog 2021-06-10 23:10:49 UTC (rev 278736)
@@ -1,3 +1,16 @@
+2021-06-10 Chris Fleizach <cfleiz...@apple.com>
+
+ AX: TestWebKitAPI.WebKit.AccessibilityReduceMotion failing on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=226758
+ <rdar://problem/78984253>
+
+ Reviewed by Alex Christensen.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit/AccessibilityIncreaseContrast.mm: Added.
+ (-[WKPreferenceObserverForTestingIncreaseContrast preferenceDidChange:key:encodedValue:]):
+ (TEST):
+
2021-06-10 Jonathan Bedard <jbed...@apple.com>
[webkitcorepy] 6x performance improvement in Memoized
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (278735 => 278736)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2021-06-10 22:19:21 UTC (rev 278735)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2021-06-10 23:10:49 UTC (rev 278736)
@@ -143,6 +143,7 @@
290A9BB91735F63800D71BBC /* OpenNewWindow.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 290A9BB81735F42300D71BBC /* OpenNewWindow.html */; };
290F4275172A221C00939FF0 /* custom-protocol-sync-xhr.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 290F4274172A1FDE00939FF0 /* custom-protocol-sync-xhr.html */; };
297234B7173AFAC700983601 /* CustomProtocolsInvalidScheme_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 297234B5173AFAC700983601 /* CustomProtocolsInvalidScheme_Bundle.cpp */; };
+ 29E06E5E266F3C0600F1A707 /* AccessibilityIncreaseContrast.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29E06E5D266F3C0600F1A707 /* AccessibilityIncreaseContrast.mm */; };
2D00065F1C1F589A0088E6A7 /* WKPDFView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D00065D1C1F58940088E6A7 /* WKPDFView.mm */; };
2D01D06E23218FEE0039AA3A /* WKWebViewPrintFormatter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D01D06D23218FEE0039AA3A /* WKWebViewPrintFormatter.mm */; };
2D08E9372267D0F4002518DA /* ReparentWebViewTimeout.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D08E9362267D0F3002518DA /* ReparentWebViewTimeout.mm */; };
@@ -1921,6 +1922,7 @@
29AB8A9F164C735800D49BEC /* CustomProtocolsTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CustomProtocolsTest.mm; path = WebKitObjC/CustomProtocolsTest.mm; sourceTree = "<group>"; };
29AB8AA2164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestBrowsingContextLoadDelegate.mm; sourceTree = "<group>"; };
29AB8AA3164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestBrowsingContextLoadDelegate.h; sourceTree = "<group>"; };
+ 29E06E5D266F3C0600F1A707 /* AccessibilityIncreaseContrast.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AccessibilityIncreaseContrast.mm; sourceTree = "<group>"; };
2D00065D1C1F58940088E6A7 /* WKPDFView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPDFView.mm; sourceTree = "<group>"; };
2D01D06D23218FEE0039AA3A /* WKWebViewPrintFormatter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewPrintFormatter.mm; sourceTree = "<group>"; };
2D08E9362267D0F3002518DA /* ReparentWebViewTimeout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ReparentWebViewTimeout.mm; sourceTree = "<group>"; };
@@ -3307,6 +3309,7 @@
0F139E741A423A4600F590F5 /* cocoa */ = {
isa = PBXGroup;
children = (
+ 29E06E5D266F3C0600F1A707 /* AccessibilityIncreaseContrast.mm */,
C1F4840624EDDB400053ECB8 /* AccessibilityReduceMotion.mm */,
E3F8AB91241AB9CE003E2A7E /* AccessibilityRemoteUIApp.mm */,
C1F7B7382449083F00124557 /* AGXCompilerService.mm */,
@@ -5723,6 +5726,7 @@
5CCB10E4213457E000AC5AF0 /* ShouldGoToBackForwardListItem.mm in Sources */,
7CCE7F141A411AE600447C4C /* ShouldKeepCurrentBackForwardListItemInList.cpp in Sources */,
37BCA61C1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm in Sources */,
+ 29E06E5E266F3C0600F1A707 /* AccessibilityIncreaseContrast.mm in Sources */,
7C83E0C51D0A654600FEBCF3 /* ShrinkToFit.mm in Sources */,
7CCE7ECD1A411A7E00447C4C /* SimplifyMarkup.mm in Sources */,
C149D550242E98DF003EBB12 /* SleepDisabler.mm in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit/AccessibilityIncreaseContrast.mm (0 => 278736)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit/AccessibilityIncreaseContrast.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/AccessibilityIncreaseContrast.mm 2021-06-10 23:10:49 UTC (rev 278736)
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+
+#import "config.h"
+
+#if ENABLE(CFPREFS_DIRECT_MODE)
+
+#import "PlatformUtilities.h"
+#import "TestWKWebView.h"
+#import "WKWebViewConfigurationExtras.h"
+#import <WebKit/PreferenceObserver.h>
+#import <WebKit/WKProcessPoolPrivate.h>
+#import <WebKit/_WKProcessPoolConfiguration.h>
+
+#if PLATFORM(MAC)
+#import <pal/spi/mac/HIServicesSPI.h>
+#endif
+
+#if PLATFORM(IOS_FAMILY)
+#include <pal/spi/cocoa/AccessibilitySupportSPI.h>
+#include <wtf/SoftLinking.h>
+
+#define NOTIFICATION_CENTER CFNotificationCenterGetDarwinNotifyCenter()
+#define INCREASE_CONTRAST_PREFERENCE CFSTR("DarkenSystemColors")
+#define ACCESSIBILITY_DOMAIN CFSTR("com.apple.Accessibility")
+#else
+#define NOTIFICATION_CENTER CFNotificationCenterGetDistributedCenter()
+#define INCREASE_CONTRAST_PREFERENCE kAXInterfaceIncreaseContrastKey
+#define ACCESSIBILITY_DOMAIN CFSTR("com.apple.universalaccess")
+#endif
+
+static bool receivedPreferenceNotification = false;
+
+@interface WKPreferenceObserverForTestingIncreaseContrast : WKPreferenceObserver
+- (void)preferenceDidChange:(NSString *)domain key:(NSString *)key encodedValue:(NSString *)encodedValue;
+@end
+
+@implementation WKPreferenceObserverForTestingIncreaseContrast
+- (void)preferenceDidChange:(NSString *)domain key:(NSString *)key encodedValue:(NSString *)encodedValue
+{
+ receivedPreferenceNotification = true;
+ [super preferenceDidChange:domain key:key encodedValue:encodedValue];
+}
+@end
+
+TEST(WebKit, AccessibilityIncreaseContrast)
+{
+ WKWebViewConfiguration *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES];
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 300, 300) configuration:configuration addToWindow:YES]);
+
+ CFPreferencesSetAppValue(INCREASE_CONTRAST_PREFERENCE, kCFBooleanFalse, ACCESSIBILITY_DOMAIN);
+
+ auto observer = adoptNS([[WKPreferenceObserverForTestingIncreaseContrast alloc] init]);
+
+ [webView synchronouslyLoadTestPageNamed:@"simple"];
+
+ auto contrastCheck = [&] {
+ return [webView stringByEvaluatingJavaScript:@"window.internals.userPrefersContrast()"].boolValue;
+ };
+
+ ASSERT_FALSE(contrastCheck());
+
+ CFPreferencesSetAppValue(INCREASE_CONTRAST_PREFERENCE, kCFBooleanTrue, ACCESSIBILITY_DOMAIN);
+
+ TestWebKitAPI::Util::run(&receivedPreferenceNotification);
+
+ [webView synchronouslyLoadTestPageNamed:@"simple"];
+
+ ASSERT_TRUE(contrastCheck());
+
+ CFPreferencesSetAppValue(INCREASE_CONTRAST_PREFERENCE, nullptr, ACCESSIBILITY_DOMAIN);
+}
+
+#endif