Diff
Modified: trunk/Source/WebKit/ChangeLog (239261 => 239262)
--- trunk/Source/WebKit/ChangeLog 2018-12-16 22:29:13 UTC (rev 239261)
+++ trunk/Source/WebKit/ChangeLog 2018-12-17 00:44:23 UTC (rev 239262)
@@ -1,3 +1,27 @@
+2018-12-16 Chris Fleizach <[email protected]>
+
+ AX: Support keyboard access preference for iOS in WebKit
+ https://bugs.webkit.org/show_bug.cgi?id=192373
+ <rdar://problem/46462670>
+
+ Reviewed by Tim Horton.
+
+ * Platform/spi/ios/AccessibilitySupportSPI.h:
+ * PlatformMac.cmake:
+ * SourcesCocoa.txt:
+ * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.h: Added.
+ * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm: Added.
+ (platformIsFullKeyboardAccessEnabled):
+ (-[WKFullKeyboardAccessWatcher notifyAllProcessPools]):
+ (-[WKFullKeyboardAccessWatcher retrieveKeyboardUIModeFromPreferences:]):
+ (-[WKFullKeyboardAccessWatcher init]):
+ (+[WKFullKeyboardAccessWatcher fullKeyboardAccessEnabled]):
+ * UIProcess/ios/WebProcessProxyIOS.mm:
+ (WebKit::WebProcessProxy::fullKeyboardAccessEnabled):
+ * UIProcess/mac/WKFullKeyboardAccessWatcher.h: Removed.
+ * UIProcess/mac/WKFullKeyboardAccessWatcher.mm: Removed.
+ * WebKit.xcodeproj/project.pbxproj:
+
2018-12-16 Adrian Perez de Castro <[email protected]>
Unreviewed follow up after r239260
Modified: trunk/Source/WebKit/Platform/spi/ios/AccessibilitySupportSPI.h (239261 => 239262)
--- trunk/Source/WebKit/Platform/spi/ios/AccessibilitySupportSPI.h 2018-12-16 22:29:13 UTC (rev 239261)
+++ trunk/Source/WebKit/Platform/spi/ios/AccessibilitySupportSPI.h 2018-12-17 00:44:23 UTC (rev 239262)
@@ -38,5 +38,7 @@
extern CFTimeInterval _AXSKeyRepeatDelay();
extern CFStringRef kAXSWebAccessibilityEventsEnabledNotification;
extern Boolean _AXSWebAccessibilityEventsEnabled();
+extern CFStringRef kAXSFullKeyboardAccessEnabledNotification;
+extern Boolean _AXSFullKeyboardAccessEnabled();
WTF_EXTERN_C_END
Modified: trunk/Source/WebKit/PlatformMac.cmake (239261 => 239262)
--- trunk/Source/WebKit/PlatformMac.cmake 2018-12-16 22:29:13 UTC (rev 239261)
+++ trunk/Source/WebKit/PlatformMac.cmake 2018-12-17 00:44:23 UTC (rev 239262)
@@ -256,6 +256,7 @@
UIProcess/Cocoa/UIDelegate.mm
UIProcess/Cocoa/VersionChecks.mm
UIProcess/Cocoa/ViewGestureController.cpp
+ UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm
UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm
UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm
UIProcess/Cocoa/WebPageProxyCocoa.mm
@@ -296,7 +297,6 @@
UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm
UIProcess/mac/ViewGestureControllerMac.mm
UIProcess/mac/ViewSnapshotStore.mm
- UIProcess/mac/WKFullKeyboardAccessWatcher.mm
UIProcess/mac/WKFullScreenWindowController.mm
UIProcess/mac/WKImmediateActionController.mm
UIProcess/mac/WKInspectorViewController.mm
Modified: trunk/Source/WebKit/SourcesCocoa.txt (239261 => 239262)
--- trunk/Source/WebKit/SourcesCocoa.txt 2018-12-16 22:29:13 UTC (rev 239261)
+++ trunk/Source/WebKit/SourcesCocoa.txt 2018-12-17 00:44:23 UTC (rev 239262)
@@ -338,6 +338,7 @@
UIProcess/Cocoa/WebProcessProxyCocoa.mm
UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm
UIProcess/Cocoa/WebViewImpl.mm
+UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm
UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm
UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm
@@ -425,7 +426,6 @@
UIProcess/mac/WebPreferencesMac.mm
UIProcess/mac/WebProcessProxyMac.mm
UIProcess/mac/WindowServerConnection.mm
-UIProcess/mac/WKFullKeyboardAccessWatcher.mm
UIProcess/mac/WKFullScreenWindowController.mm
UIProcess/mac/WKImmediateActionController.mm
UIProcess/mac/WKInspectorViewController.mm
Copied: trunk/Source/WebKit/UIProcess/Cocoa/WKFullKeyboardAccessWatcher.h (from rev 239261, trunk/Source/WebKit/UIProcess/mac/WKFullKeyboardAccessWatcher.h) (0 => 239262)
--- trunk/Source/WebKit/UIProcess/Cocoa/WKFullKeyboardAccessWatcher.h (rev 0)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKFullKeyboardAccessWatcher.h 2018-12-17 00:44:23 UTC (rev 239262)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2011 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
+
+#if PLATFORM(COCOA)
+
+@interface WKFullKeyboardAccessWatcher : NSObject {
+@private
+ BOOL fullKeyboardAccessEnabled;
+}
+
++ (BOOL)fullKeyboardAccessEnabled;
+
+@end;
+
+#endif // PLATFORM(COCOA)
Copied: trunk/Source/WebKit/UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm (from rev 239261, trunk/Source/WebKit/UIProcess/mac/WKFullKeyboardAccessWatcher.mm) (0 => 239262)
--- trunk/Source/WebKit/UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm (rev 0)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm 2018-12-17 00:44:23 UTC (rev 239262)
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2011, 2018 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"
+#import "WKFullKeyboardAccessWatcher.h"
+
+#if PLATFORM(COCOA)
+
+#import "AccessibilitySupportSPI.h"
+#import "WebProcessPool.h"
+
+#if PLATFORM(MAC)
+static NSString * const KeyboardUIModeDidChangeNotification = @"com.apple.KeyboardUIModeDidChange";
+static const CFStringRef AppleKeyboardUIMode = CFSTR("AppleKeyboardUIMode");
+#endif
+
+@implementation WKFullKeyboardAccessWatcher
+
+static inline BOOL platformIsFullKeyboardAccessEnabled()
+{
+ BOOL fullKeyboardAccessEnabled = NO;
+#if PLATFORM(MAC)
+ CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
+
+ Boolean keyExistsAndHasValidFormat;
+ int mode = CFPreferencesGetAppIntegerValue(AppleKeyboardUIMode, kCFPreferencesCurrentApplication, &keyExistsAndHasValidFormat);
+ if (keyExistsAndHasValidFormat) {
+ // The keyboard access mode has two bits:
+ // Bit 0 is set if user can set the focus to menus, the dock, and various windows using the keyboard.
+ // Bit 1 is set if controls other than text fields are included in the tab order (WebKit also always includes lists).
+ fullKeyboardAccessEnabled = (mode & 0x2);
+ }
+#elif PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000
+ fullKeyboardAccessEnabled = _AXSFullKeyboardAccessEnabled();
+#endif
+
+ return fullKeyboardAccessEnabled;
+}
+
+- (void)notifyAllProcessPools
+{
+ for (auto* processPool : WebKit::WebProcessPool::allProcessPools())
+ processPool->fullKeyboardAccessModeChanged(fullKeyboardAccessEnabled);
+}
+
+- (void)retrieveKeyboardUIModeFromPreferences:(NSNotification *)notification
+{
+ BOOL oldValue = fullKeyboardAccessEnabled;
+
+ fullKeyboardAccessEnabled = platformIsFullKeyboardAccessEnabled();
+
+ if (fullKeyboardAccessEnabled != oldValue)
+ [self notifyAllProcessPools];
+}
+
+- (id)init
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ [self retrieveKeyboardUIModeFromPreferences:nil];
+
+ NSNotificationCenter *notificationCenter = nil;
+ NSString *notitificationName = nil;
+
+#if PLATFORM(MAC)
+ notificationCenter = [NSDistributedNotificationCenter defaultCenter];
+ notitificationName = KeyboardUIModeDidChangeNotification;
+#elif PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000
+ notificationCenter = [NSNotificationCenter defaultCenter];
+ notitificationName = (NSString *)kAXSFullKeyboardAccessEnabledNotification;
+#endif
+
+ if (notitificationName)
+ [notificationCenter addObserver:self selector:@selector(retrieveKeyboardUIModeFromPreferences:) name:notitificationName object:nil];
+
+ return self;
+}
+
++ (BOOL)fullKeyboardAccessEnabled
+{
+ static WKFullKeyboardAccessWatcher *watcher = [[WKFullKeyboardAccessWatcher alloc] init];
+ return watcher->fullKeyboardAccessEnabled;
+}
+
+@end
+
+#endif // PLATFORM(COCOA)
Modified: trunk/Source/WebKit/UIProcess/ios/WebProcessProxyIOS.mm (239261 => 239262)
--- trunk/Source/WebKit/UIProcess/ios/WebProcessProxyIOS.mm 2018-12-16 22:29:13 UTC (rev 239261)
+++ trunk/Source/WebKit/UIProcess/ios/WebProcessProxyIOS.mm 2018-12-17 00:44:23 UTC (rev 239262)
@@ -28,8 +28,7 @@
#if PLATFORM(IOS_FAMILY)
-#import <WebCore/NotImplemented.h>
-
+#import "WKFullKeyboardAccessWatcher.h"
#import "WebProcessMessages.h"
namespace WebKit {
@@ -36,8 +35,7 @@
bool WebProcessProxy::fullKeyboardAccessEnabled()
{
- notImplemented();
- return false;
+ return [WKFullKeyboardAccessWatcher fullKeyboardAccessEnabled];
}
} // namespace WebKit
Deleted: trunk/Source/WebKit/UIProcess/mac/WKFullKeyboardAccessWatcher.h (239261 => 239262)
--- trunk/Source/WebKit/UIProcess/mac/WKFullKeyboardAccessWatcher.h 2018-12-16 22:29:13 UTC (rev 239261)
+++ trunk/Source/WebKit/UIProcess/mac/WKFullKeyboardAccessWatcher.h 2018-12-17 00:44:23 UTC (rev 239262)
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-#ifndef WKFullKeyboardAccessWatcher_h
-#define WKFullKeyboardAccessWatcher_h
-
-#if PLATFORM(MAC)
-
-@interface WKFullKeyboardAccessWatcher : NSObject {
-@private
- BOOL fullKeyboardAccessEnabled;
-}
-
-+ (BOOL)fullKeyboardAccessEnabled;
-
-@end;
-
-#endif // PLATFORM(MAC)
-
-#endif // WKFullKeyboardAccessWatcher_h
Deleted: trunk/Source/WebKit/UIProcess/mac/WKFullKeyboardAccessWatcher.mm (239261 => 239262)
--- trunk/Source/WebKit/UIProcess/mac/WKFullKeyboardAccessWatcher.mm 2018-12-16 22:29:13 UTC (rev 239261)
+++ trunk/Source/WebKit/UIProcess/mac/WKFullKeyboardAccessWatcher.mm 2018-12-17 00:44:23 UTC (rev 239262)
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2011 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"
-#import "WKFullKeyboardAccessWatcher.h"
-
-#if PLATFORM(MAC)
-
-#import "WebProcessPool.h"
-
-NSString * const KeyboardUIModeDidChangeNotification = @"com.apple.KeyboardUIModeDidChange";
-const CFStringRef AppleKeyboardUIMode = CFSTR("AppleKeyboardUIMode");
-
-@implementation WKFullKeyboardAccessWatcher
-
-- (void)notifyAllProcessPools
-{
- for (auto* processPool : WebKit::WebProcessPool::allProcessPools())
- processPool->fullKeyboardAccessModeChanged(fullKeyboardAccessEnabled);
-}
-
-- (void)retrieveKeyboardUIModeFromPreferences:(NSNotification *)notification
-{
- BOOL oldValue = fullKeyboardAccessEnabled;
-
- CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
-
- Boolean keyExistsAndHasValidFormat;
- int mode = CFPreferencesGetAppIntegerValue(AppleKeyboardUIMode, kCFPreferencesCurrentApplication, &keyExistsAndHasValidFormat);
- if (keyExistsAndHasValidFormat) {
- // The keyboard access mode has two bits:
- // Bit 0 is set if user can set the focus to menus, the dock, and various windows using the keyboard.
- // Bit 1 is set if controls other than text fields are included in the tab order (WebKit also always includes lists).
- fullKeyboardAccessEnabled = (mode & 0x2);
- }
-
- if (fullKeyboardAccessEnabled != oldValue)
- [self notifyAllProcessPools];
-}
-
-- (id)init
-{
- self = [super init];
- if (!self)
- return nil;
-
- [self retrieveKeyboardUIModeFromPreferences:nil];
-
- [[NSDistributedNotificationCenter defaultCenter]
- addObserver:self selector:@selector(retrieveKeyboardUIModeFromPreferences:)
- name:KeyboardUIModeDidChangeNotification object:nil];
-
- return self;
-}
-
-+ (BOOL)fullKeyboardAccessEnabled
-{
- static WKFullKeyboardAccessWatcher *watcher = [[WKFullKeyboardAccessWatcher alloc] init];
- return watcher->fullKeyboardAccessEnabled;
-}
-
-@end
-
-#endif // PLATFORM(MAC)
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (239261 => 239262)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2018-12-16 22:29:13 UTC (rev 239261)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2018-12-17 00:44:23 UTC (rev 239262)
@@ -5332,6 +5332,8 @@
51D124321E6DE521002B2820 /* WebURLSchemeHandlerCocoa.mm */,
2DFC7DB91BCCC19500C1548C /* WebViewImpl.h */,
2DFC7DBA1BCCC19500C1548C /* WebViewImpl.mm */,
+ E1AEA22D14687BDB00804569 /* WKFullKeyboardAccessWatcher.h */,
+ E1AEA22E14687BDB00804569 /* WKFullKeyboardAccessWatcher.mm */,
1AD01BCB1905D54900C9C45F /* WKReloadFrameErrorRecoveryAttempter.h */,
1AD01BCA1905D54900C9C45F /* WKReloadFrameErrorRecoveryAttempter.mm */,
5CA26D80217ABBB600F97A35 /* WKSafeBrowsingWarning.h */,
@@ -8163,8 +8165,6 @@
51D130571382F10500351EDD /* WebProcessProxyMac.mm */,
868160CD18763D4B0021E79D /* WindowServerConnection.h */,
868160CF187645370021E79D /* WindowServerConnection.mm */,
- E1AEA22D14687BDB00804569 /* WKFullKeyboardAccessWatcher.h */,
- E1AEA22E14687BDB00804569 /* WKFullKeyboardAccessWatcher.mm */,
CDCA85C7132ABA4E00E961DF /* WKFullScreenWindowController.h */,
CDCA85C6132ABA4E00E961DF /* WKFullScreenWindowController.mm */,
9321D5851A38EE3C008052BE /* WKImmediateActionController.h */,