Diff
Modified: branches/safari-610.1.28.1-branch/Source/WebCore/PAL/ChangeLog (266184 => 266185)
--- branches/safari-610.1.28.1-branch/Source/WebCore/PAL/ChangeLog 2020-08-26 20:04:32 UTC (rev 266184)
+++ branches/safari-610.1.28.1-branch/Source/WebCore/PAL/ChangeLog 2020-08-26 20:04:37 UTC (rev 266185)
@@ -1,3 +1,52 @@
+2020-08-26 Russell Epstein <[email protected]>
+
+ Cherry-pick r265996. rdar://problem/67707045
+
+ [macOS] Web pages are not responding correctly to changes in "Reduce motion" setting
+ https://bugs.webkit.org/show_bug.cgi?id=215664
+
+ Reviewed by Darin Adler.
+
+ Source/WebCore/PAL:
+
+ Declare "Reduce motion" preference key, as well as notification sent when the "Reduce motion" setting is changed.
+
+ * pal/spi/mac/HIServicesSPI.h:
+
+ Source/WebKit:
+
+ This happens because there is a race between the preference change and notification being received in the WebContent
+ process. This race is usually won by the notification, which then reads the wrong preference value when being handled.
+ This bug was introduced when access to the preference daemon was closed in the WebContent process, and preferences
+ were updated from the UI process. This patch addresses this issue by re-posting the notification when the preference
+ value is updated in the WebContent process.
+
+ API test: WebKit.AccessibilityReduceMotion
+
+ * WebProcess/cocoa/WebProcessCocoa.mm:
+ (WebKit::reduceMotionPreferenceKey):
+ (WebKit::dispatchSimulatedNotificationsForPreferenceChange):
+
+ Tools:
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit/AccessibilityReduceMotion.mm: Added.
+ (TEST):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265996 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-08-20 Per Arne Vollan <[email protected]>
+
+ [macOS] Web pages are not responding correctly to changes in "Reduce motion" setting
+ https://bugs.webkit.org/show_bug.cgi?id=215664
+
+ Reviewed by Darin Adler.
+
+ Declare "Reduce motion" preference key, as well as notification sent when the "Reduce motion" setting is changed.
+
+ * pal/spi/mac/HIServicesSPI.h:
+
2020-08-10 Alan Coon <[email protected]>
Cherry-pick r265264. rdar://problem/66644041
Modified: branches/safari-610.1.28.1-branch/Source/WebCore/PAL/pal/spi/mac/HIServicesSPI.h (266184 => 266185)
--- branches/safari-610.1.28.1-branch/Source/WebCore/PAL/pal/spi/mac/HIServicesSPI.h 2020-08-26 20:04:32 UTC (rev 266184)
+++ branches/safari-610.1.28.1-branch/Source/WebCore/PAL/pal/spi/mac/HIServicesSPI.h 2020-08-26 20:04:37 UTC (rev 266185)
@@ -149,6 +149,9 @@
void _AXSetClientIdentificationOverride(AXClientType);
#endif // HAVE(AX_CLIENT_TYPE)
+extern CFStringRef kAXInterfaceReduceMotionKey;
+extern CFStringRef kAXInterfaceReduceMotionStatusDidChangeNotification;
+
WTF_EXTERN_C_END
#endif // USE(APPLE_INTERNAL_SDK)
Modified: branches/safari-610.1.28.1-branch/Source/WebKit/ChangeLog (266184 => 266185)
--- branches/safari-610.1.28.1-branch/Source/WebKit/ChangeLog 2020-08-26 20:04:32 UTC (rev 266184)
+++ branches/safari-610.1.28.1-branch/Source/WebKit/ChangeLog 2020-08-26 20:04:37 UTC (rev 266185)
@@ -1,3 +1,60 @@
+2020-08-26 Russell Epstein <[email protected]>
+
+ Cherry-pick r265996. rdar://problem/67707045
+
+ [macOS] Web pages are not responding correctly to changes in "Reduce motion" setting
+ https://bugs.webkit.org/show_bug.cgi?id=215664
+
+ Reviewed by Darin Adler.
+
+ Source/WebCore/PAL:
+
+ Declare "Reduce motion" preference key, as well as notification sent when the "Reduce motion" setting is changed.
+
+ * pal/spi/mac/HIServicesSPI.h:
+
+ Source/WebKit:
+
+ This happens because there is a race between the preference change and notification being received in the WebContent
+ process. This race is usually won by the notification, which then reads the wrong preference value when being handled.
+ This bug was introduced when access to the preference daemon was closed in the WebContent process, and preferences
+ were updated from the UI process. This patch addresses this issue by re-posting the notification when the preference
+ value is updated in the WebContent process.
+
+ API test: WebKit.AccessibilityReduceMotion
+
+ * WebProcess/cocoa/WebProcessCocoa.mm:
+ (WebKit::reduceMotionPreferenceKey):
+ (WebKit::dispatchSimulatedNotificationsForPreferenceChange):
+
+ Tools:
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit/AccessibilityReduceMotion.mm: Added.
+ (TEST):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265996 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-08-20 Per Arne Vollan <[email protected]>
+
+ [macOS] Web pages are not responding correctly to changes in "Reduce motion" setting
+ https://bugs.webkit.org/show_bug.cgi?id=215664
+
+ Reviewed by Darin Adler.
+
+ This happens because there is a race between the preference change and notification being received in the WebContent
+ process. This race is usually won by the notification, which then reads the wrong preference value when being handled.
+ This bug was introduced when access to the preference daemon was closed in the WebContent process, and preferences
+ were updated from the UI process. This patch addresses this issue by re-posting the notification when the preference
+ value is updated in the WebContent process.
+
+ API test: WebKit.AccessibilityReduceMotion
+
+ * WebProcess/cocoa/WebProcessCocoa.mm:
+ (WebKit::reduceMotionPreferenceKey):
+ (WebKit::dispatchSimulatedNotificationsForPreferenceChange):
+
2020-08-21 Russell Epstein <[email protected]>
Cherry-pick r265953. rdar://problem/67560218
Modified: branches/safari-610.1.28.1-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (266184 => 266185)
--- branches/safari-610.1.28.1-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2020-08-26 20:04:32 UTC (rev 266184)
+++ branches/safari-610.1.28.1-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2020-08-26 20:04:37 UTC (rev 266185)
@@ -126,6 +126,7 @@
#import "WebSwitchingGPUClient.h"
#import <WebCore/GraphicsContextGLOpenGLManager.h>
#import <WebCore/ScrollbarThemeMac.h>
+#import <pal/spi/mac/HIServicesSPI.h>
#import <pal/spi/mac/NSScrollerImpSPI.h>
#endif
@@ -941,6 +942,12 @@
static NeverDestroyed<WTF::String> userHighlightColorPreferenceKey(MAKE_STATIC_STRING_IMPL("AppleHighlightColor"));
return userHighlightColorPreferenceKey;
}
+
+static const WTF::String& reduceMotionPreferenceKey()
+{
+ static NeverDestroyed<WTF::String> key(MAKE_STATIC_STRING_IMPL("reduceMotion"));
+ return key;
+}
#endif
static void dispatchSimulatedNotificationsForPreferenceChange(const String& key)
@@ -951,15 +958,17 @@
// of the system, we must re-post the notification in the Web Content process after updating the default.
if (key == userAccentColorPreferenceKey()) {
- NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
+ auto notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter postNotificationName:@"kCUINotificationAquaColorVariantChanged" object:nil];
[notificationCenter postNotificationName:@"NSSystemColorsWillChangeNotification" object:nil];
[notificationCenter postNotificationName:NSSystemColorsDidChangeNotification object:nil];
- }
- if (key == userHighlightColorPreferenceKey()) {
- NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
+ } else if (key == userHighlightColorPreferenceKey()) {
+ auto notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter postNotificationName:@"NSSystemColorsWillChangeNotification" object:nil];
[notificationCenter postNotificationName:NSSystemColorsDidChangeNotification object:nil];
+ } else if (key == reduceMotionPreferenceKey()) {
+ auto notificationCenter = CFNotificationCenterGetDistributedCenter();
+ CFNotificationCenterPostNotification(notificationCenter, kAXInterfaceReduceMotionStatusDidChangeNotification, nullptr, nullptr, true);
}
#endif
}
Modified: branches/safari-610.1.28.1-branch/Tools/ChangeLog (266184 => 266185)
--- branches/safari-610.1.28.1-branch/Tools/ChangeLog 2020-08-26 20:04:32 UTC (rev 266184)
+++ branches/safari-610.1.28.1-branch/Tools/ChangeLog 2020-08-26 20:04:37 UTC (rev 266185)
@@ -1,3 +1,52 @@
+2020-08-26 Russell Epstein <[email protected]>
+
+ Cherry-pick r265996. rdar://problem/67707045
+
+ [macOS] Web pages are not responding correctly to changes in "Reduce motion" setting
+ https://bugs.webkit.org/show_bug.cgi?id=215664
+
+ Reviewed by Darin Adler.
+
+ Source/WebCore/PAL:
+
+ Declare "Reduce motion" preference key, as well as notification sent when the "Reduce motion" setting is changed.
+
+ * pal/spi/mac/HIServicesSPI.h:
+
+ Source/WebKit:
+
+ This happens because there is a race between the preference change and notification being received in the WebContent
+ process. This race is usually won by the notification, which then reads the wrong preference value when being handled.
+ This bug was introduced when access to the preference daemon was closed in the WebContent process, and preferences
+ were updated from the UI process. This patch addresses this issue by re-posting the notification when the preference
+ value is updated in the WebContent process.
+
+ API test: WebKit.AccessibilityReduceMotion
+
+ * WebProcess/cocoa/WebProcessCocoa.mm:
+ (WebKit::reduceMotionPreferenceKey):
+ (WebKit::dispatchSimulatedNotificationsForPreferenceChange):
+
+ Tools:
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit/AccessibilityReduceMotion.mm: Added.
+ (TEST):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265996 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-08-20 Per Arne Vollan <[email protected]>
+
+ [macOS] Web pages are not responding correctly to changes in "Reduce motion" setting
+ https://bugs.webkit.org/show_bug.cgi?id=215664
+
+ Reviewed by Darin Adler.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit/AccessibilityReduceMotion.mm: Added.
+ (TEST):
+
2020-08-19 Russell Epstein <[email protected]>
Cherry-pick r265835. rdar://problem/67364262
Modified: branches/safari-610.1.28.1-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (266184 => 266185)
--- branches/safari-610.1.28.1-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-08-26 20:04:32 UTC (rev 266184)
+++ branches/safari-610.1.28.1-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-08-26 20:04:37 UTC (rev 266185)
@@ -927,6 +927,7 @@
C15CBB3023F1FF1A00300CC7 /* BacklightLevelNotification.mm in Sources */ = {isa = PBXBuildFile; fileRef = C15CBB2F23F1FF1A00300CC7 /* BacklightLevelNotification.mm */; };
C15CBB3F23FB177A00300CC7 /* PreferenceChanges.mm in Sources */ = {isa = PBXBuildFile; fileRef = C15CBB3E23FB177A00300CC7 /* PreferenceChanges.mm */; };
C1692DCA23D10DAE006E88F7 /* Battery.mm in Sources */ = {isa = PBXBuildFile; fileRef = C1692DC923D10DAE006E88F7 /* Battery.mm */; };
+ C1F4840724EDDB400053ECB8 /* AccessibilityReduceMotion.mm in Sources */ = {isa = PBXBuildFile; fileRef = C1F4840624EDDB400053ECB8 /* AccessibilityReduceMotion.mm */; };
C1F7B7392449083F00124557 /* AGXCompilerService.mm in Sources */ = {isa = PBXBuildFile; fileRef = C1F7B7382449083F00124557 /* AGXCompilerService.mm */; };
C1FF9EDB244644F000839AE4 /* WebFilter.mm in Sources */ = {isa = PBXBuildFile; fileRef = C1FF9EDA244644F000839AE4 /* WebFilter.mm */; };
C20F88A72295B96700D610FA /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C20F88A62295B96700D610FA /* CoreText.framework */; };
@@ -2594,6 +2595,7 @@
C15CBB3E23FB177A00300CC7 /* PreferenceChanges.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PreferenceChanges.mm; sourceTree = "<group>"; };
C1692DC923D10DAE006E88F7 /* Battery.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = Battery.mm; sourceTree = "<group>"; };
C1D8EE212028E8E3008EB141 /* WebProcessTerminate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessTerminate.mm; sourceTree = "<group>"; };
+ C1F4840624EDDB400053ECB8 /* AccessibilityReduceMotion.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AccessibilityReduceMotion.mm; sourceTree = "<group>"; };
C1F7B7382449083F00124557 /* AGXCompilerService.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AGXCompilerService.mm; sourceTree = "<group>"; };
C1FF9EDA244644F000839AE4 /* WebFilter.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebFilter.mm; sourceTree = "<group>"; };
C20F88A62295B96700D610FA /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; };
@@ -3070,6 +3072,7 @@
0F139E741A423A4600F590F5 /* cocoa */ = {
isa = PBXGroup;
children = (
+ C1F4840624EDDB400053ECB8 /* AccessibilityReduceMotion.mm */,
E3F8AB91241AB9CE003E2A7E /* AccessibilityRemoteUIApp.mm */,
C1F7B7382449083F00124557 /* AGXCompilerService.mm */,
C15CBB2F23F1FF1A00300CC7 /* BacklightLevelNotification.mm */,
@@ -4844,6 +4847,7 @@
7C83DED21D0A590C00FEBCF3 /* HashMap.cpp in Sources */,
7C83DED41D0A590C00FEBCF3 /* HashSet.cpp in Sources */,
7C8BFF7123C0107A00C009B3 /* HexNumber.cpp in Sources */,
+ 33976D8324DC479B00812304 /* IndexSparseSet.cpp in Sources */,
7C83DEE01D0A590C00FEBCF3 /* IntegerToStringConversion.cpp in Sources */,
53FCDE6B229EFFB900598ECF /* IsoHeap.cpp in Sources */,
7CEB62AB223609DE0069CBB0 /* IteratorRange.cpp in Sources */,
@@ -4931,6 +4935,7 @@
57C6244E2346BCFA00383FE7 /* _WKWebAuthenticationPanel.mm in Sources */,
7CCE7EE41A411AE600447C4C /* AboutBlankLoad.cpp in Sources */,
7CCE7EB31A411A7E00447C4C /* AcceptsFirstMouse.mm in Sources */,
+ C1F4840724EDDB400053ECB8 /* AccessibilityReduceMotion.mm in Sources */,
E3F8AB92241AB9CE003E2A7E /* AccessibilityRemoteUIApp.mm in Sources */,
2E205BA41F527746005952DD /* AccessibilityTestsIOS.mm in Sources */,
9BD5111C1FE8E11600D2B630 /* AccessingPastedImage.mm in Sources */,
Added: branches/safari-610.1.28.1-branch/Tools/TestWebKitAPI/Tests/WebKit/AccessibilityReduceMotion.mm (0 => 266185)
--- branches/safari-610.1.28.1-branch/Tools/TestWebKitAPI/Tests/WebKit/AccessibilityReduceMotion.mm (rev 0)
+++ branches/safari-610.1.28.1-branch/Tools/TestWebKitAPI/Tests/WebKit/AccessibilityReduceMotion.mm 2020-08-26 20:04:37 UTC (rev 266185)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2020 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 WK_HAVE_C_SPI
+
+#import "PlatformUtilities.h"
+#import "TestWKWebView.h"
+#import <WebKit/PreferenceObserver.h>
+#import <WebKit/WKProcessPoolPrivate.h>
+#import <WebKit/_WKProcessPoolConfiguration.h>
+
+#import <pal/spi/mac/HIServicesSPI.h>
+
+static bool reduceMotionNotificationReceived = false;
+static bool receivedPreferenceNotification = false;
+
+@interface WKPreferenceObserverForTesting : WKPreferenceObserver
+- (void)preferenceDidChange:(NSString *)domain key:(NSString *)key encodedValue:(NSString *)encodedValue;
+@end
+
+@implementation WKPreferenceObserverForTesting
+- (void)preferenceDidChange:(NSString *)domain key:(NSString *)key encodedValue:(NSString *)encodedValue
+{
+ receivedPreferenceNotification = true;
+ [super preferenceDidChange:domain key:key encodedValue:encodedValue];
+}
+@end
+
+TEST(WebKit, AccessibilityReduceMotion)
+{
+ RetainPtr<NSObject> accessibilityObserver = [[NSDistributedNotificationCenter defaultCenter] addObserverForName:(__bridge id)kAXInterfaceReduceMotionStatusDidChangeNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *note) {
+ reduceMotionNotificationReceived = true;
+ }];
+
+ auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ WKRetainPtr<WKContextRef> context = adoptWK(TestWebKitAPI::Util::createContextForInjectedBundleTest("InternalsInjectedBundleTest"));
+ configuration.get().processPool = (WKProcessPool *)context.get();
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 300, 300) configuration:configuration.get() addToWindow:YES]);
+
+ CFPreferencesSetAppValue(kAXInterfaceReduceMotionKey, kCFBooleanFalse, CFSTR("com.apple.universalaccess"));
+
+ auto observer = adoptNS([[WKPreferenceObserverForTesting alloc] init]);
+
+ [webView synchronouslyLoadTestPageNamed:@"simple"];
+
+ CFPreferencesSetAppValue(kAXInterfaceReduceMotionKey, kCFBooleanTrue, CFSTR("com.apple.universalaccess"));
+
+ TestWebKitAPI::Util::run(&receivedPreferenceNotification);
+
+ auto reduceMotion = [&] {
+ return [webView stringByEvaluatingJavaScript:@"window.internals.userPrefersReducedMotion()"].boolValue;
+ };
+
+ [webView synchronouslyLoadTestPageNamed:@"simple"];
+
+ TestWebKitAPI::Util::run(&reduceMotionNotificationReceived);
+
+ ASSERT_TRUE(reduceMotion());
+
+ CFPreferencesSetAppValue(kAXInterfaceReduceMotionKey, nullptr, CFSTR("com.apple.universalaccess"));
+
+ [[NSNotificationCenter defaultCenter] removeObserver:accessibilityObserver.get()];
+}
+
+#endif