Title: [226807] trunk/Source
Revision
226807
Author
pvol...@apple.com
Date
2018-01-11 14:19:22 -0800 (Thu, 11 Jan 2018)

Log Message

VoiceOver does not work when the WebContent process is using NSRunLoop.
https://bugs.webkit.org/show_bug.cgi?id=181331
<rdar://problem/36408004>

Reviewed by Brent Fulgham.

Source/WebCore/PAL:

Add NSApplication class method to initialize accessibility.

* pal/spi/mac/NSApplicationSPI.h:

Source/WebKit:

When the WebContent process is using NSRunLoop instead of the NSApplication run loop,
accessibility must be initialized for VoiceOver to work. This patch also switches to
using NSRunLoop in the WebContent process.

* Configurations/WebContentService.xcconfig:
* Platform/IPC/mac/ConnectionMac.mm:
(IPC::AccessibilityProcessSuspendedNotification): Remove unneccessary workaround.
* WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist: Switch to NSRunLoop.
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeProcess): Initialize accessibility.

Modified Paths

Diff

Modified: trunk/Source/WebCore/PAL/ChangeLog (226806 => 226807)


--- trunk/Source/WebCore/PAL/ChangeLog	2018-01-11 22:18:17 UTC (rev 226806)
+++ trunk/Source/WebCore/PAL/ChangeLog	2018-01-11 22:19:22 UTC (rev 226807)
@@ -1,3 +1,15 @@
+2018-01-10  Per Arne Vollan  <pvol...@apple.com>
+
+        VoiceOver does not work when the WebContent process is using NSRunLoop.
+        https://bugs.webkit.org/show_bug.cgi?id=181331
+        <rdar://problem/36408004>
+
+        Reviewed by Brent Fulgham.
+
+        Add NSApplication class method to initialize accessibility.
+
+        * pal/spi/mac/NSApplicationSPI.h:
+
 2018-01-05  Eric Carlson  <eric.carl...@apple.com>
 
         [MediaStream] Add Mac screen capture source

Modified: trunk/Source/WebCore/PAL/pal/spi/mac/NSApplicationSPI.h (226806 => 226807)


--- trunk/Source/WebCore/PAL/pal/spi/mac/NSApplicationSPI.h	2018-01-11 22:18:17 UTC (rev 226806)
+++ trunk/Source/WebCore/PAL/pal/spi/mac/NSApplicationSPI.h	2018-01-11 22:19:22 UTC (rev 226807)
@@ -30,6 +30,10 @@
 - (void)speakString:(NSString *)string;
 - (void)_setCurrentEvent:(NSEvent *)event;
 
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
++ (void)_accessibilityInitialize;
+#endif
+
 @end
 
 #endif // USE(APPKIT)

Modified: trunk/Source/WebKit/ChangeLog (226806 => 226807)


--- trunk/Source/WebKit/ChangeLog	2018-01-11 22:18:17 UTC (rev 226806)
+++ trunk/Source/WebKit/ChangeLog	2018-01-11 22:19:22 UTC (rev 226807)
@@ -1,3 +1,22 @@
+2018-01-09  Per Arne Vollan  <pvol...@apple.com>
+
+        VoiceOver does not work when the WebContent process is using NSRunLoop.
+        https://bugs.webkit.org/show_bug.cgi?id=181331
+        <rdar://problem/36408004>
+
+        Reviewed by Brent Fulgham.
+
+        When the WebContent process is using NSRunLoop instead of the NSApplication run loop,
+        accessibility must be initialized for VoiceOver to work. This patch also switches to
+        using NSRunLoop in the WebContent process.
+
+        * Configurations/WebContentService.xcconfig:
+        * Platform/IPC/mac/ConnectionMac.mm:
+        (IPC::AccessibilityProcessSuspendedNotification): Remove unneccessary workaround.
+        * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist: Switch to NSRunLoop.
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::platformInitializeProcess): Initialize accessibility.
+
 2018-01-11  Don Olmstead  <don.olmst...@sony.com>
 
         WebContextMenuListenerProxy.cpp not including config on first line

Modified: trunk/Source/WebKit/Configurations/WebContentService.xcconfig (226806 => 226807)


--- trunk/Source/WebKit/Configurations/WebContentService.xcconfig	2018-01-11 22:18:17 UTC (rev 226806)
+++ trunk/Source/WebKit/Configurations/WebContentService.xcconfig	2018-01-11 22:19:22 UTC (rev 226807)
@@ -49,3 +49,8 @@
 
 WK_XPC_DOMAIN_EXTENSION_CODE_SIGN_FLAGS = $(WK_XPC_DOMAIN_EXTENSION_CODE_SIGN_FLAGS_$(WK_WEBCONTENT_SERVICE_NEEDS_XPC_DOMAIN_EXTENSION_ENTITLEMENT));
 WK_XPC_DOMAIN_EXTENSION_CODE_SIGN_FLAGS_YES = -o library;
+
+RUNLOOP_TYPE[sdk=macosx*] = NSRunLoop;
+RUNLOOP_TYPE[sdk=macosx10.13*] = _NSApplicationMain;
+RUNLOOP_TYPE[sdk=macosx10.12*] = _NSApplicationMain;
+RUNLOOP_TYPE[sdk=macosx10.11*] = _NSApplicationMain;

Modified: trunk/Source/WebKit/Platform/IPC/mac/ConnectionMac.mm (226806 => 226807)


--- trunk/Source/WebKit/Platform/IPC/mac/ConnectionMac.mm	2018-01-11 22:18:17 UTC (rev 226806)
+++ trunk/Source/WebKit/Platform/IPC/mac/ConnectionMac.mm	2018-01-11 22:19:22 UTC (rev 226807)
@@ -586,11 +586,6 @@
 static void AccessibilityProcessSuspendedNotification(bool suspended)
 {
 #if PLATFORM(MAC)
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
-    // Calling _AXUIElementNotifyProcessSuspendStatus will crash if the NSApplication event loop is not running.
-    if (![NSApp isRunning])
-        return;
-#endif
     _AXUIElementNotifyProcessSuspendStatus(suspended ? AXSuspendStatusSuspended : AXSuspendStatusRunning);
 #elif PLATFORM(IOS)
     UIAccessibilityPostNotification(kAXPidStatusChangedNotification, @{ @"pid" : @(getpid()), @"suspended" : @(suspended) });

Modified: trunk/Source/WebKit/WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist (226806 => 226807)


--- trunk/Source/WebKit/WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist	2018-01-11 22:18:17 UTC (rev 226806)
+++ trunk/Source/WebKit/WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist	2018-01-11 22:19:22 UTC (rev 226807)
@@ -45,7 +45,7 @@
 		<key>ServiceType</key>
 		<string>Application</string>
 		<key>RunLoopType</key>
-		<string>_NSApplicationMain</string>
+		<string>${RUNLOOP_TYPE}</string>
 		<key>_MultipleInstances</key>
 		<true/>
 		<key>_HighBitsASLR</key>

Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (226806 => 226807)


--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2018-01-11 22:18:17 UTC (rev 226806)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2018-01-11 22:19:22 UTC (rev 226807)
@@ -67,6 +67,7 @@
 #import <pal/spi/cocoa/QuartzCoreSPI.h>
 #import <pal/spi/cocoa/pthreadSPI.h>
 #import <pal/spi/mac/NSAccessibilitySPI.h>
+#import <pal/spi/mac/NSApplicationSPI.h>
 #import <runtime/ConfigFile.h>
 #import <stdio.h>
 
@@ -168,6 +169,15 @@
     Method methodToPatch = class_getInstanceMethod([NSApplication class], @selector(accessibilityFocusedUIElement));
     method_setImplementation(methodToPatch, (IMP)NSApplicationAccessibilityFocusedUIElement);
 #endif
+    
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+    // Need to initialize accessibility for VoiceOver to work when the WebContent process is using NSRunLoop.
+    // Currently, it is also needed to allocate and initialize an NSApplication object.
+    // FIXME: Remove the following line when rdar://problem/36323569 is fixed.
+    [NSApplication sharedApplication];
+    [NSApplication _accessibilityInitialize];
+#endif
+    
     _CFNetworkSetATSContext(parameters.networkATSContext.get());
 
 #if TARGET_OS_IPHONE
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to