+2014-02-28 Chris Fleizach <cfleizach@apple.com>
+
+ AX: Support IOS Accessibility in WK2
+ https://bugs.webkit.org/show_bug.cgi?id=129527
+
+ Reviewed by Sam Weinig.
+
+ Update the iOS wrapper so that it can convert points to screen space in WebKit2.
+
+ * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+ (-[WebAccessibilityObjectWrapper convertPointToScreenSpace:]):
+ (-[WebAccessibilityObjectWrapper convertRectToScreenSpace:]):
+
2014-03-03 Martin Hock <mhock@apple.com>
Add support for sessions to MemoryCache.
#if HAVE(ACCESSIBILITY) && PLATFORM(IOS)
#import "AccessibilityRenderObject.h"
+#import "AccessibilityScrollView.h"
#import "AccessibilityTable.h"
#import "AccessibilityTableCell.h"
+#import "Chrome.h"
+#import "ChromeClient.h"
#import "Font.h"
#import "Frame.h"
#import "FrameSelection.h"
#import "HTMLNames.h"
#import "IntRect.h"
#import "IntSize.h"
+#import "Page.h"
#import "Range.h"
#import "RenderView.h"
#import "RuntimeApplicationChecksIOS.h"
CGPoint cgPoint = CGPointMake(point.x(), point.y());
FrameView* frameView = m_object->documentFrameView();
- if (frameView) {
- WAKView* view = frameView->documentView();
- cgPoint = [view convertPoint:cgPoint toView:nil];
+ WAKView* documentView = frameView ? frameView->documentView() : nullptr;
+ if (documentView) {
+ cgPoint = [documentView convertPoint:cgPoint toView:nil];
+
+ // we need the web document view to give us our final screen coordinates
+ // because that can take account of the scroller
+ id webDocument = [self _accessibilityWebDocumentView];
+ if (webDocument)
+ cgPoint = [webDocument convertPoint:cgPoint toView:nil];
+ }
+ else {
+ // Find the appropriate scroll view to use to convert the contents to the window.
+ ScrollView* scrollView = 0;
+ AccessibilityObject* parent = 0;
+ for (parent = m_object->parentObject(); parent; parent = parent->parentObject()) {
+ if (parent->isAccessibilityScrollView()) {
+ scrollView = toAccessibilityScrollView(parent)->scrollView();
+ break;
+ }
+ }
+
+ IntPoint intPoint = flooredIntPoint(point);
+ if (scrollView)
+ intPoint = scrollView->contentsToRootView(intPoint);
+
+ Page* page = m_object->page();
+
+ // If we have an empty chrome client (like SVG) then we should use the page
+ // of the scroll view parent to help us get to the screen rect.
+ if (parent && page && page->chrome().client().isEmptyChromeClient())
+ page = parent->page();
+
+ if (page) {
+ IntRect rect = IntRect(intPoint, IntSize(0, 0));
+ intPoint = page->chrome().rootViewToScreen(rect).location();
+ }
+
+ cgPoint = (CGPoint)intPoint;
}
-
- // we need the web document view to give us our final screen coordinates
- // because that can take account of the scroller
- id webDocument = [self _accessibilityWebDocumentView];
- if (webDocument)
- cgPoint = [webDocument convertPoint:cgPoint toView:nil];
return cgPoint;
}
CGRect frame = CGRectMake(point.x, point.y, size.width, size.height);
FrameView* frameView = m_object->documentFrameView();
- if (frameView) {
- WAKView* view = frameView->documentView();
- frame = [view convertRect:frame toView:nil];
+ WAKView* documentView = frameView ? frameView->documentView() : nil;
+ if (documentView) {
+ frame = [documentView convertRect:frame toView:nil];
+
+ // we need the web document view to give us our final screen coordinates
+ // because that can take account of the scroller
+ id webDocument = [self _accessibilityWebDocumentView];
+ if (webDocument)
+ frame = [webDocument convertRect:frame toView:nil];
+
+ } else {
+ // Find the appropriate scroll view to use to convert the contents to the window.
+ ScrollView* scrollView = 0;
+ AccessibilityObject* parent = 0;
+ for (parent = m_object->parentObject(); parent; parent = parent->parentObject()) {
+ if (parent->isAccessibilityScrollView()) {
+ scrollView = toAccessibilityScrollView(parent)->scrollView();
+ break;
+ }
+ }
+
+ if (scrollView)
+ rect = scrollView->contentsToRootView(rect);
+
+ Page* page = m_object->page();
+
+ // If we have an empty chrome client (like SVG) then we should use the page
+ // of the scroll view parent to help us get to the screen rect.
+ if (parent && page && page->chrome().client().isEmptyChromeClient())
+ page = parent->page();
+
+ if (page)
+ rect = page->chrome().rootViewToScreen(rect);
+
+ frame = (CGRect)rect;
}
- // we need the web document view to give us our final screen coordinates
- // because that can take account of the scroller
- id webDocument = [self _accessibilityWebDocumentView];
- if (webDocument)
- frame = [webDocument convertRect:frame toView:nil];
-
return frame;
}
+2014-02-28 Chris Fleizach <cfleizach@apple.com>
+
+ AX: Support IOS Accessibility in WK2
+ https://bugs.webkit.org/show_bug.cgi?id=129527
+
+ Reviewed by Sam Weinig.
+
+ Implement enough AX hooks so that accessibility can work in WebKit2.
+
+ * Platform/IPC/Connection.h:
+ * Platform/IPC/mac/ConnectionMac.cpp:
+ (IPC::Connection::identifier):
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::accessibilityWebProcessTokenReceived):
+ * UIProcess/ios/WKContentView.h:
+ * UIProcess/ios/WKContentView.mm:
+ (-[WKContentView _updateForScreen:]):
+ (-[WKContentView _setAccessibilityWebProcessToken:]):
+ (-[WKContentView _accessibilityRegisterUIProcessTokens]):
+ (-[WKContentView _didRelaunchProcess]):
+ * UIProcess/ios/WebPageProxyIOS.mm:
+ (WebKit::WebPageProxy::registerWebProcessAccessibilityToken):
+ (WebKit::WebPageProxy::registerUIProcessAccessibilityTokens):
+ * WebKit2.xcodeproj/project.pbxproj:
+ * WebProcess/Plugins/PDF/PDFPlugin.mm:
+ * WebProcess/WebPage/WKAccessibilityWebPageObjectIOS.h: Added.
+ * WebProcess/WebPage/WKAccessibilityWebPageObjectIOS.mm: Added.
+ (-[WKAccessibilityWebPageObject init]):
+ (-[WKAccessibilityWebPageObject _accessibilityCategoryInstalled:]):
+ (-[WKAccessibilityWebPageObject pageScale]):
+ (-[WKAccessibilityWebPageObject dealloc]):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::platformInitialize):
+ (WebKit::WebPage::platformInitializeAccessibility):
+ (WebKit::WebPage::accessibilityObjectForMainFramePlugin):
+ (WebKit::WebPage::registerUIProcessAccessibilityTokens):
+ * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.h: Copied from Source/WebKit2/WebProcess/WebPage/mac/WKAccessibilityWebPageObject.h.
+ * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm: Copied from Source/WebKit2/WebProcess/WebPage/mac/WKAccessibilityWebPageObject.mm.
+ (-[WKAccessibilityWebPageObjectBase accessibilityFocusedUIElement]):
+ * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.h: Added.
+ * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: Added.
+ (-[WKAccessibilityWebPageObject accessibilityIsIgnored]):
+ (-[WKAccessibilityWebPageObject accessibilityAttributeNames]):
+ (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]):
+ (-[WKAccessibilityWebPageObject accessibilityIsAttributeSettable:]):
+ (-[WKAccessibilityWebPageObject accessibilitySetValue:forAttribute:]):
+ (-[WKAccessibilityWebPageObject convertScreenPointToRootView:]):
+ (-[WKAccessibilityWebPageObject accessibilityActionNames]):
+ (-[WKAccessibilityWebPageObject accessibilityChildren]):
+ (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]):
+ (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]):
+ (-[WKAccessibilityWebPageObject accessibilityShouldUseUniqueId]):
+ (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
+ * WebProcess/WebPage/mac/WebPageMac.mm:
+ * WebProcess/cocoa/WebProcessCocoa.mm:
+ (WebKit::WebProcess::platformInitializeProcess):
+
2014-03-03 Martin Hock <mhock@apple.com>
Add support for sessions to MemoryCache.
bool inSendSync() const { return m_inSendSyncCount; }
+ Identifier identifier() const;
+
private:
Connection(Identifier, bool isServer, Client*, WTF::RunLoop* clientRunLoop);
void platformInitialize(Identifier);
}
#endif
+IPC::Connection::Identifier Connection::identifier() const
+{
+ return Identifier(m_isServer ? m_receivePort : m_sendPort, m_xpcConnection);
+}
+
} // namespace IPC
#if PLATFORM(IOS)
+#import "DataReference.h"
#import "NativeWebKeyboardEvent.h"
#import "InteractionInformationAtPosition.h"
#import "WKContentView.h"
notImplemented();
}
-void PageClientImpl::accessibilityWebProcessTokenReceived(const IPC::DataReference&)
+void PageClientImpl::accessibilityWebProcessTokenReceived(const IPC::DataReference& data)
{
- notImplemented();
+ NSData *remoteToken = [NSData dataWithBytes:data.data() length:data.size()];
+ [m_contentView _setAccessibilityWebProcessToken:remoteToken];
}
bool PageClientImpl::interpretKeyEvent(const NativeWebKeyboardEvent&, Vector<KeypressCommand>&)
- (void)_decidePolicyForGeolocationRequestFromOrigin:(WebKit::WebSecurityOrigin&)origin frame:(WebKit::WebFrameProxy&)frame request:(WebKit::GeolocationPermissionRequestProxy&)permissionRequest;
- (RetainPtr<CGImageRef>)_takeViewSnapshot;
+- (void)_setAccessibilityWebProcessToken:(NSData *)data;
- (BOOL)_zoomToRect:(CGRect)targetRect withOrigin:(CGPoint)origin fitEntireRect:(BOOL)fitEntireRect minimumScale:(double)minimumScale maximumScale:(double)maximumScale minimumScrollDistance:(CGFloat)minimumScrollDistance;
- (void)_zoomOutWithOrigin:(CGPoint)origin;
#import "WebFrameProxy.h"
#import "WebPageGroup.h"
#import "WebSystemInterface.h"
+#import "WebKitSystemInterfaceIOS.h"
#import <UIKit/UIWindow_Private.h>
#import <wtf/RetainPtr.h>
{
ASSERT(screen);
_page->setIntrinsicDeviceScaleFactor(screen.scale);
+ [self _accessibilityRegisterUIProcessTokens];
+}
+
+- (void)_setAccessibilityWebProcessToken:(NSData *)data
+{
+ // This means the web process has checked in and we should send information back to that process.
+ [self _accessibilityRegisterUIProcessTokens];
+}
+
+- (void)_accessibilityRegisterUIProcessTokens
+{
+ RetainPtr<CFUUIDRef> uuid = CFUUIDCreate(kCFAllocatorDefault);
+ NSData *remoteElementToken = WKAXRemoteToken(uuid.get());
+ IPC::Connection* connection = _page->process().connection();
+
+ // Store information about the WebProcess that can later be retrieved by the iOS Accessibility runtime.
+ if (connection)
+ WKAXStoreRemoteConnectionInformation(self, _page->process().processIdentifier(), connection->identifier().port, uuid.get());
+
+ IPC::DataReference elementToken = IPC::DataReference(reinterpret_cast<const uint8_t*>([remoteElementToken bytes]), [remoteElementToken length]);
+ _page->registerUIProcessAccessibilityTokens(elementToken, elementToken);
}
#pragma mark PageClientImpl methods
- (void)_didRelaunchProcess
{
- // FIXME: Implement.
+ [self _accessibilityRegisterUIProcessTokens];
}
- (void)_didCommitLoadForMainFrame
#if PLATFORM(IOS)
+#import "DataReference.h"
#import "NativeWebKeyboardEvent.h"
#import "PageClient.h"
#import "ViewUpdateDispatcherMessages.h"
notImplemented();
}
-void WebPageProxy::registerWebProcessAccessibilityToken(const IPC::DataReference&)
+void WebPageProxy::registerWebProcessAccessibilityToken(const IPC::DataReference& data)
{
- notImplemented();
+ m_pageClient.accessibilityWebProcessTokenReceived(data);
}
void WebPageProxy::makeFirstResponder()
notImplemented();
}
-void WebPageProxy::registerUIProcessAccessibilityTokens(const IPC::DataReference&, const IPC::DataReference&)
+void WebPageProxy::registerUIProcessAccessibilityTokens(const IPC::DataReference& elementToken, const IPC::DataReference& windowToken)
{
- notImplemented();
+ if (!isValid())
+ return;
+
+ process().send(Messages::WebPage::RegisterUIProcessAccessibilityTokens(elementToken, windowToken), m_pageID);
}
void WebPageProxy::pluginFocusOrWindowFocusChanged(uint64_t, bool)
2684055318B86ED60022C38B /* ViewUpdateDispatcherMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 2684055118B86ED60022C38B /* ViewUpdateDispatcherMessages.h */; };
26F9A83B18A3468100AEB88A /* WKWebViewPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 26F9A83A18A3463F00AEB88A /* WKWebViewPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
290F4272172A0C7400939FF0 /* ChildProcessSupplement.h in Headers */ = {isa = PBXBuildFile; fileRef = 290F4271172A0C7400939FF0 /* ChildProcessSupplement.h */; };
+ 29232DF418B29D6800D0596F /* WKAccessibilityWebPageObjectMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 29232DF318B29D6800D0596F /* WKAccessibilityWebPageObjectMac.h */; };
+ 29232DF818B2A9AE00D0596F /* WKAccessibilityWebPageObjectIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29232DF618B29DCE00D0596F /* WKAccessibilityWebPageObjectIOS.mm */; };
+ 29232DF918B2AB3A00D0596F /* WKAccessibilityWebPageObjectMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29232DF118B29D1100D0596F /* WKAccessibilityWebPageObjectMac.mm */; };
293EBEAB1627D9C9005F89F1 /* WKDOMText.h in Headers */ = {isa = PBXBuildFile; fileRef = 293EBEA91627D9C9005F89F1 /* WKDOMText.h */; settings = {ATTRIBUTES = (Private, ); }; };
293EBEAC1627D9C9005F89F1 /* WKDOMText.mm in Sources */ = {isa = PBXBuildFile; fileRef = 293EBEAA1627D9C9005F89F1 /* WKDOMText.mm */; };
29501724162A4504004A9D71 /* WKWebProcessPlugInBrowserContextControllerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 29501723162A4504004A9D71 /* WKWebProcessPlugInBrowserContextControllerPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
2989A414167D184B004F96D2 /* CustomProtocolManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 2989A412167D184B004F96D2 /* CustomProtocolManager.h */; };
29AD3093164B4C5D0072DEA9 /* CustomProtocolManagerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 29AD3092164B4C5D0072DEA9 /* CustomProtocolManagerProxy.h */; };
29AD3096164B4C930072DEA9 /* CustomProtocolManagerProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29AD3095164B4C930072DEA9 /* CustomProtocolManagerProxyMac.mm */; };
- 29CD55AA128E294F00133C85 /* WKAccessibilityWebPageObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CD55A8128E294F00133C85 /* WKAccessibilityWebPageObject.h */; };
- 29CD55AB128E294F00133C85 /* WKAccessibilityWebPageObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29CD55A9128E294F00133C85 /* WKAccessibilityWebPageObject.mm */; };
+ 29CD55AA128E294F00133C85 /* WKAccessibilityWebPageObjectBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CD55A8128E294F00133C85 /* WKAccessibilityWebPageObjectBase.h */; };
+ 29CD55AB128E294F00133C85 /* WKAccessibilityWebPageObjectBase.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29CD55A9128E294F00133C85 /* WKAccessibilityWebPageObjectBase.mm */; };
29D55DF1161BF9F10031A2E3 /* WebPageGroupProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29D55DEF161BF9F10031A2E3 /* WebPageGroupProxyMessageReceiver.cpp */; };
29D55DF2161BF9F10031A2E3 /* WebPageGroupProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 29D55DF0161BF9F10031A2E3 /* WebPageGroupProxyMessages.h */; };
2D125C5E1857EA05003BA3CB /* ViewGestureController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D125C5C1857EA05003BA3CB /* ViewGestureController.h */; };
2684055118B86ED60022C38B /* ViewUpdateDispatcherMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewUpdateDispatcherMessages.h; sourceTree = "<group>"; };
26F9A83A18A3463F00AEB88A /* WKWebViewPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKWebViewPrivate.h; sourceTree = "<group>"; };
290F4271172A0C7400939FF0 /* ChildProcessSupplement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChildProcessSupplement.h; sourceTree = "<group>"; };
+ 29232DF118B29D1100D0596F /* WKAccessibilityWebPageObjectMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKAccessibilityWebPageObjectMac.mm; sourceTree = "<group>"; };
+ 29232DF318B29D6800D0596F /* WKAccessibilityWebPageObjectMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKAccessibilityWebPageObjectMac.h; sourceTree = "<group>"; };
+ 29232DF518B29DCE00D0596F /* WKAccessibilityWebPageObjectIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKAccessibilityWebPageObjectIOS.h; sourceTree = "<group>"; };
+ 29232DF618B29DCE00D0596F /* WKAccessibilityWebPageObjectIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKAccessibilityWebPageObjectIOS.mm; sourceTree = "<group>"; };
293EBEA91627D9C9005F89F1 /* WKDOMText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDOMText.h; sourceTree = "<group>"; };
293EBEAA1627D9C9005F89F1 /* WKDOMText.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKDOMText.mm; sourceTree = "<group>"; };
29501723162A4504004A9D71 /* WKWebProcessPlugInBrowserContextControllerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInBrowserContextControllerPrivate.h; sourceTree = "<group>"; };
29AD3092164B4C5D0072DEA9 /* CustomProtocolManagerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomProtocolManagerProxy.h; path = CustomProtocols/CustomProtocolManagerProxy.h; sourceTree = "<group>"; };
29AD3095164B4C930072DEA9 /* CustomProtocolManagerProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CustomProtocolManagerProxyMac.mm; path = CustomProtocols/mac/CustomProtocolManagerProxyMac.mm; sourceTree = "<group>"; };
29AD3097164B4E210072DEA9 /* CustomProtocolManagerProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CustomProtocolManagerProxy.messages.in; path = CustomProtocols/CustomProtocolManagerProxy.messages.in; sourceTree = "<group>"; };
- 29CD55A8128E294F00133C85 /* WKAccessibilityWebPageObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKAccessibilityWebPageObject.h; sourceTree = "<group>"; };
- 29CD55A9128E294F00133C85 /* WKAccessibilityWebPageObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKAccessibilityWebPageObject.mm; sourceTree = "<group>"; };
+ 29CD55A8128E294F00133C85 /* WKAccessibilityWebPageObjectBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKAccessibilityWebPageObjectBase.h; sourceTree = "<group>"; };
+ 29CD55A9128E294F00133C85 /* WKAccessibilityWebPageObjectBase.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKAccessibilityWebPageObjectBase.mm; sourceTree = "<group>"; };
29D55DEE161BF8780031A2E3 /* WebPageGroupProxy.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebPageGroupProxy.messages.in; sourceTree = "<group>"; };
29D55DEF161BF9F10031A2E3 /* WebPageGroupProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageGroupProxyMessageReceiver.cpp; sourceTree = "<group>"; };
29D55DF0161BF9F10031A2E3 /* WebPageGroupProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageGroupProxyMessages.h; sourceTree = "<group>"; };
children = (
2DA944B51884EA3500ED86DB /* WebBackForwardListProxyIOS.mm */,
2DA944B61884EA3500ED86DB /* WebPageIOS.mm */,
+ 29232DF518B29DCE00D0596F /* WKAccessibilityWebPageObjectIOS.h */,
+ 29232DF618B29DCE00D0596F /* WKAccessibilityWebPageObjectIOS.mm */,
);
name = ios;
sourceTree = "<group>";
1AAF263614687C39004A1E8A /* TiledCoreAnimationDrawingArea.mm */,
1C8E2DAD1278C5B200BC7BD0 /* WebInspectorMac.mm */,
BC963D6D113DD1A500574BE2 /* WebPageMac.mm */,
- 29CD55A8128E294F00133C85 /* WKAccessibilityWebPageObject.h */,
- 29CD55A9128E294F00133C85 /* WKAccessibilityWebPageObject.mm */,
+ 29CD55A8128E294F00133C85 /* WKAccessibilityWebPageObjectBase.h */,
+ 29CD55A9128E294F00133C85 /* WKAccessibilityWebPageObjectBase.mm */,
+ 29232DF318B29D6800D0596F /* WKAccessibilityWebPageObjectMac.h */,
+ 29232DF118B29D1100D0596F /* WKAccessibilityWebPageObjectMac.mm */,
);
path = mac;
sourceTree = "<group>";
BCE2315D122C30CA00D5C35A /* APIURLRequest.h in Headers */,
BC90A1D2122DD55E00CC8C50 /* APIURLResponse.h in Headers */,
F6113E25126CE1820057D0A7 /* WebUserContentURLPattern.h in Headers */,
- 29CD55AA128E294F00133C85 /* WKAccessibilityWebPageObject.h in Headers */,
+ 29CD55AA128E294F00133C85 /* WKAccessibilityWebPageObjectBase.h in Headers */,
BCDDB32D124EC2E10048D13C /* WKAPICast.h in Headers */,
512E34E5130B4D0500ABD19A /* WKApplicationCacheManager.h in Headers */,
BC4075F4124FF0270068F20A /* WKArray.h in Headers */,
51EFC1CF1524E62500C9A938 /* WKBundleDOMWindowExtension.h in Headers */,
BCD25F1711D6BDE100169B0E /* WKBundleFrame.h in Headers */,
BCF049E611FE20F600F86A58 /* WKBundleFramePrivate.h in Headers */,
+ 29232DF418B29D6800D0596F /* WKAccessibilityWebPageObjectMac.h in Headers */,
BC49862F124D18C100D834E1 /* WKBundleHitTestResult.h in Headers */,
BC204EF211C83EC8008F3375 /* WKBundleInitialize.h in Headers */,
65B86F1E12F11DE300B7DD8A /* WKBundleInspector.h in Headers */,
BC111A5B112F4FBB00337BAB /* WebContextMenuClient.cpp in Sources */,
51021E9C12B16788005C033C /* WebContextMenuClientMac.mm in Sources */,
512935D71288D19400A4B695 /* WebContextMenuItem.cpp in Sources */,
+ 29232DF918B2AB3A00D0596F /* WKAccessibilityWebPageObjectMac.mm in Sources */,
510FBB9A1288C95E00AFFDF4 /* WebContextMenuItemData.cpp in Sources */,
2D819BA11862800E001F03D1 /* ViewGestureGeometryCollectorMessageReceiver.cpp in Sources */,
51A84CE3127F386B00CA6EA4 /* WebContextMenuProxy.cpp in Sources */,
F6A25FDC12ADC6CC00DC40CC /* WebDatabaseManager.cpp in Sources */,
F62A76B612B1B25F0005F1B6 /* WebDatabaseManagerMessageReceiver.cpp in Sources */,
51E35209180F5D6B00E53BE9 /* DatabaseServiceEntryPoint.mm in Sources */,
+ 29232DF818B2A9AE00D0596F /* WKAccessibilityWebPageObjectIOS.mm in Sources */,
3F418EF91887BD97002795FD /* WebVideoFullscreenManagerMessageReceiver.cpp in Sources */,
F62A765C12B1ABC30005F1B6 /* WebDatabaseManagerProxy.cpp in Sources */,
BCAC112012C92C1F00B08EEE /* WebDatabaseManagerProxyClient.cpp in Sources */,
BC90A1D3122DD55E00CC8C50 /* APIURLResponse.cpp in Sources */,
C0337DD1127A2980008FF4F4 /* WebWheelEvent.cpp in Sources */,
51FCB18517BBFE0300394CD8 /* AsynchronousNetworkLoaderClient.cpp in Sources */,
- 29CD55AB128E294F00133C85 /* WKAccessibilityWebPageObject.mm in Sources */,
+ 29CD55AB128E294F00133C85 /* WKAccessibilityWebPageObjectBase.mm in Sources */,
1AC7537F183BE50F0072CB15 /* DataReference.cpp in Sources */,
0FCB4E4718BBE044000FCFC9 /* PageClientImplIOS.mm in Sources */,
512E34E4130B4D0500ABD19A /* WKApplicationCacheManager.cpp in Sources */,
#import "PDFPluginAnnotation.h"
#import "PDFPluginPasswordField.h"
#import "PluginView.h"
-#import "WKAccessibilityWebPageObject.h"
+#import "WKAccessibilityWebPageObjectMac.h"
#import "WKPageFindMatchesClient.h"
#import "WebContextMessages.h"
#import "WebCoreArgumentCoders.h"
--- /dev/null
+/*
+ * Copyright (C) 2014 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 WKAccessibilityWebPageObjectIOS_h
+#define WKAccessibilityWebPageObjectIOS_h
+
+#if PLATFORM(IOS)
+
+#include "WKAccessibilityWebPageObjectBase.h"
+
+@interface WKAccessibilityWebPageObject : WKAccessibilityWebPageObjectBase
+
+@property(nonatomic, retain) NSData *remoteTokenData;
+
+@end
+
+#endif // PLATFORM(IOS)
+
+#endif // WKAccessibilityWebPageObjectIOS_h
--- /dev/null
+/*
+ * Copyright (C) 2014 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 "WKAccessibilityWebPageObjectIOS.h"
+
+#if PLATFORM(IOS)
+
+#import "WebFrame.h"
+#import "WebPage.h"
+#import <WebCore/FrameView.h>
+
+/*
+ The implementation of this class will be augmented by an accesibility bundle that is loaded only when accessibility is requested to be enabled.
+ */
+
+@implementation WKAccessibilityWebPageObject
+
+- (id)init
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_accessibilityCategoryInstalled:) name:@"AccessibilityCategoryInstalled" object:nil];
+
+ return self;
+}
+
+- (void)_accessibilityCategoryInstalled:(id)notification
+{
+ // Accessibility bundle will override this method so that it knows when to initialize the accessibility runtime within the WebProcess.
+}
+
+- (double)pageScale
+{
+ return m_page->pageScaleFactor();
+}
+
+- (void)dealloc
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+ self.remoteTokenData = nil;
+ [super dealloc];
+}
+
+@end
+
+#endif // PLATFORM(IOS)
+
PassRefPtr<WebCore::Range> expandedRangeFromHandle(WebCore::Range*, WKHandlePosition);
PassRefPtr<WebCore::Range> contractedRangeFromHandle(WebCore::Range* currentRange, WKHandlePosition, WKSelectionFlags&);
void getAssistedNodeInformation(AssistedNodeInformation&);
-
+ void platformInitializeAccessibility();
RefPtr<WebCore::Range> m_currentBlockSelection;
#endif
#if !PLATFORM(COCOA)
#if PLATFORM(IOS)
#import "AssistedNodeInformation.h"
+#import "DataReference.h"
#import "EditorState.h"
#import "InteractionInformationAtPosition.h"
+#import "PluginView.h"
#import "LayerTreeHost.h"
#import "VisibleContentRectUpdateInfo.h"
#import "WebChromeClient.h"
#import "WebCoreArgumentCoders.h"
+#import "WebKitSystemInterfaceIOS.h"
#import "WebFrame.h"
#import "WebPageProxyMessages.h"
#import "WebProcess.h"
+#import "WKAccessibilityWebPageObjectIOS.h"
#import "WKGestureTypes.h"
#import <CoreText/CTFont.h>
#import <WebCore/Chrome.h>
void WebPage::platformInitialize()
{
- notImplemented();
+ platformInitializeAccessibility();
}
+void WebPage::platformInitializeAccessibility()
+{
+ m_mockAccessibilityElement = [[[WKAccessibilityWebPageObject alloc] init] autorelease];
+ [m_mockAccessibilityElement setWebPage:this];
+
+ RetainPtr<CFUUIDRef> uuid = CFUUIDCreate(kCFAllocatorDefault);
+ NSData *remoteToken = WKAXRemoteToken(uuid.get());
+
+ IPC::DataReference dataToken = IPC::DataReference(reinterpret_cast<const uint8_t*>([remoteToken bytes]), [remoteToken length]);
+ send(Messages::WebPageProxy::RegisterWebProcessAccessibilityToken(dataToken));
+}
+
void WebPage::platformPreferencesDidChange(const WebPreferencesStore&)
{
notImplemented();
return false;
}
-void WebPage::registerUIProcessAccessibilityTokens(const IPC::DataReference&, const IPC::DataReference&)
+NSObject *WebPage::accessibilityObjectForMainFramePlugin()
{
- notImplemented();
+ if (!m_page)
+ return 0;
+
+ if (PluginView* pluginView = pluginViewForFrame(&m_page->mainFrame()))
+ return pluginView->accessibilityObject();
+
+ return 0;
+}
+
+void WebPage::registerUIProcessAccessibilityTokens(const IPC::DataReference& elementToken, const IPC::DataReference&)
+{
+ NSData *elementTokenData = [NSData dataWithBytes:elementToken.data() length:elementToken.size()];
+ [m_mockAccessibilityElement setRemoteTokenData:elementTokenData];
}
void WebPage::readSelectionFromPasteboard(const String&, bool&)
--- /dev/null
+/*
+ * 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 WKAccessibilityWebPageObjectBase_h
+#define WKAccessibilityWebPageObjectBase_h
+
+namespace WebKit {
+class WebPage;
+}
+
+@interface WKAccessibilityWebPageObjectBase : NSObject {
+ WebKit::WebPage* m_page;
+ id m_parent;
+}
+
+- (void)setWebPage:(WebKit::WebPage*)page;
+- (void)setRemoteParent:(id)parent;
+
+- (id)accessibilityRootObjectWrapper;
+- (id)accessibilityFocusedUIElement;
+
+@end
+
+#endif // WKAccessibilityWebPageObjectBase_h
--- /dev/null
+/*
+ * 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 "WKAccessibilityWebPageObjectBase.h"
+
+#import "WebFrame.h"
+#import "WebPage.h"
+#import "WKArray.h"
+#import "WKNumber.h"
+#import "WKRetainPtr.h"
+#import "WKSharedAPICast.h"
+#import "WKString.h"
+#import "WKStringCF.h"
+#import <WebCore/AXObjectCache.h>
+#import <WebCore/FrameView.h>
+#import <WebCore/MainFrame.h>
+#import <WebCore/Page.h>
+#import <WebCore/ScrollView.h>
+#import <WebCore/Scrollbar.h>
+#import <WebKitSystemInterface.h>
+#import <wtf/ObjcRuntimeExtras.h>
+
+using namespace WebCore;
+using namespace WebKit;
+
+@implementation WKAccessibilityWebPageObjectBase
+
+- (id)accessibilityRootObjectWrapper
+{
+ if (!WebCore::AXObjectCache::accessibilityEnabled())
+ WebCore::AXObjectCache::enableAccessibility();
+
+ NSObject* mainFramePluginAccessibilityObjectWrapper = m_page->accessibilityObjectForMainFramePlugin();
+ if (mainFramePluginAccessibilityObjectWrapper)
+ return mainFramePluginAccessibilityObjectWrapper;
+
+ WebCore::Page* page = m_page->corePage();
+ if (!page)
+ return nil;
+
+ WebCore::Frame& core = page->mainFrame();
+ if (!core.document())
+ return nil;
+
+ AccessibilityObject* root = core.document()->axObjectCache()->rootObject();
+ if (!root)
+ return nil;
+
+ return root->wrapper();
+}
+
+- (void)setWebPage:(WebPage*)page
+{
+ m_page = page;
+}
+
+- (void)setRemoteParent:(id)parent
+{
+ if (parent != m_parent) {
+ [m_parent release];
+ m_parent = [parent retain];
+ }
+}
+
+- (id)accessibilityFocusedUIElement
+{
+ return [[self accessibilityRootObjectWrapper] accessibilityFocusedUIElement];
+}
+
+
+@end
--- /dev/null
+/*
+ * Copyright (C) 2014 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 WKAccessibilityWebPageObjectMac_h
+#define WKAccessibilityWebPageObjectMac_h
+
+#include "WKAccessibilityWebPageObjectBase.h"
+
+#if PLATFORM(MAC)
+
+@interface WKAccessibilityWebPageObject : WKAccessibilityWebPageObjectBase {
+ NSArray* m_attributeNames;
+ NSMutableArray* m_accessibilityChildren;
+}
+
+- (NSPoint)convertScreenPointToRootView:(NSPoint)point;
+
+@end
+
+#endif // PLATFORM(MAC)
+#endif // WKAccessibilityWebPageObjectMac_h
--- /dev/null
+/*
+ * 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 "WKAccessibilityWebPageObjectMac.h"
+
+#if PLATFORM(MAC)
+
+#import "WebFrame.h"
+#import "WebPage.h"
+#import "WKArray.h"
+#import "WKNumber.h"
+#import "WKRetainPtr.h"
+#import "WKSharedAPICast.h"
+#import "WKString.h"
+#import "WKStringCF.h"
+#import <WebCore/AXObjectCache.h>
+#import <WebCore/FrameView.h>
+#import <WebCore/MainFrame.h>
+#import <WebCore/Page.h>
+#import <WebCore/ScrollView.h>
+#import <WebCore/Scrollbar.h>
+#import <WebKitSystemInterface.h>
+#import <wtf/ObjcRuntimeExtras.h>
+
+using namespace WebCore;
+using namespace WebKit;
+
+@implementation WKAccessibilityWebPageObject
+
+- (void)dealloc
+{
+ WKUnregisterUniqueIdForElement(self);
+ [m_accessibilityChildren release];
+ [m_attributeNames release];
+ [m_parent release];
+ [super dealloc];
+}
+
+- (BOOL)accessibilityIsIgnored
+{
+ return NO;
+}
+
+- (NSArray *)accessibilityAttributeNames
+{
+ if (!m_attributeNames)
+ m_attributeNames = [[NSArray alloc] initWithObjects:
+ NSAccessibilityRoleAttribute, NSAccessibilityRoleDescriptionAttribute, NSAccessibilityFocusedAttribute,
+ NSAccessibilityParentAttribute, NSAccessibilityWindowAttribute, NSAccessibilityTopLevelUIElementAttribute,
+ NSAccessibilityPositionAttribute, NSAccessibilitySizeAttribute, NSAccessibilityChildrenAttribute, nil];
+
+ return m_attributeNames;
+}
+
+- (NSArray *)accessibilityParameterizedAttributeNames
+{
+ WKRetainPtr<WKArrayRef> result = adoptWK(m_page->pageOverlayCopyAccessibilityAttributesNames(true));
+ if (!result)
+ return nil;
+
+ NSMutableArray *names = [NSMutableArray array];
+ size_t count = WKArrayGetSize(result.get());
+ for (size_t k = 0; k < count; k++) {
+ WKTypeRef item = WKArrayGetItemAtIndex(result.get(), k);
+ if (toImpl(item)->type() == API::String::APIType) {
+ RetainPtr<CFStringRef> name = adoptCF(WKStringCopyCFString(kCFAllocatorDefault, (WKStringRef)item));
+ [names addObject:(NSString *)name.get()];
+ }
+ }
+
+ return names;
+}
+
+- (BOOL)accessibilityIsAttributeSettable:(NSString *)attribute
+{
+ return NO;
+}
+
+- (void)accessibilitySetValue:(id)value forAttribute:(NSString *)attribute
+{
+ return;
+}
+
+- (NSPoint)convertScreenPointToRootView:(NSPoint)point
+{
+ return m_page->screenToRootView(IntPoint(point.x, point.y));
+}
+
+- (NSArray *)accessibilityActionNames
+{
+ return [NSArray array];
+}
+
+- (NSArray *)accessibilityChildren
+{
+ id wrapper = [self accessibilityRootObjectWrapper];
+ if (!wrapper)
+ return [NSArray array];
+
+ return [NSArray arrayWithObject:wrapper];
+}
+
+- (id)accessibilityAttributeValue:(NSString *)attribute
+{
+ if (!WebCore::AXObjectCache::accessibilityEnabled())
+ WebCore::AXObjectCache::enableAccessibility();
+
+ if ([attribute isEqualToString:NSAccessibilityParentAttribute])
+ return m_parent;
+ if ([attribute isEqualToString:NSAccessibilityWindowAttribute])
+ return [m_parent accessibilityAttributeValue:NSAccessibilityWindowAttribute];
+ if ([attribute isEqualToString:NSAccessibilityTopLevelUIElementAttribute])
+ return [m_parent accessibilityAttributeValue:NSAccessibilityTopLevelUIElementAttribute];
+ if ([attribute isEqualToString:NSAccessibilityRoleAttribute])
+ return NSAccessibilityGroupRole;
+ if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute])
+ return NSAccessibilityRoleDescription(NSAccessibilityGroupRole, nil);
+ if ([attribute isEqualToString:NSAccessibilityFocusedAttribute])
+ return [NSNumber numberWithBool:NO];
+
+ if (!m_page)
+ return nil;
+
+ if ([attribute isEqualToString:NSAccessibilityPositionAttribute]) {
+ const WebCore::FloatPoint& point = m_page->accessibilityPosition();
+ return [NSValue valueWithPoint:NSMakePoint(point.x(), point.y())];
+ }
+ if ([attribute isEqualToString:NSAccessibilitySizeAttribute]) {
+ const IntSize& s = m_page->size();
+ return [NSValue valueWithSize:NSMakeSize(s.width(), s.height())];
+ }
+ if ([attribute isEqualToString:NSAccessibilityChildrenAttribute])
+ return [self accessibilityChildren];
+
+ return nil;
+}
+
+- (id)accessibilityAttributeValue:(NSString *)attribute forParameter:(id)parameter
+{
+ WKRetainPtr<WKTypeRef> pageOverlayParameter = 0;
+
+ if ([parameter isKindOfClass:[NSValue class]] && strcmp([(NSValue*)parameter objCType], @encode(NSPoint)) == 0) {
+ NSPoint point = [self convertScreenPointToRootView:[(NSValue *)parameter pointValue]];
+ pageOverlayParameter = WKPointCreate(WKPointMake(point.x, point.y));
+ }
+
+ WKRetainPtr<WKStringRef> attributeRef = adoptWK(WKStringCreateWithCFString((CFStringRef)attribute));
+ WKRetainPtr<WKTypeRef> result = adoptWK(m_page->pageOverlayCopyAccessibilityAttributeValue(attributeRef.get(), pageOverlayParameter.get()));
+ if (!result)
+ return nil;
+
+ if (toImpl(result.get())->type() == API::String::APIType)
+ return CFBridgingRelease(WKStringCopyCFString(kCFAllocatorDefault, (WKStringRef)result.get()));
+ else if (toImpl(result.get())->type() == API::Boolean::APIType)
+ return [NSNumber numberWithBool:WKBooleanGetValue(static_cast<WKBooleanRef>(result.get()))];
+
+ return nil;
+}
+
+- (BOOL)accessibilityShouldUseUniqueId
+{
+ return YES;
+}
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+- (id)accessibilityHitTest:(NSPoint)point
+{
+ // Hit-test point comes in as bottom-screen coordinates. Needs to be normalized to the frame of the web page.
+ NSPoint remotePosition = [[self accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue];
+ NSSize remoteSize = [[self accessibilityAttributeValue:NSAccessibilitySizeAttribute] sizeValue];
+
+ // Get the y position of the WKView (we have to screen-flip and go from bottom left to top left).
+ CGFloat screenHeight = [(NSScreen *)[[NSScreen screens] objectAtIndex:0] frame].size.height;
+ remotePosition.y = (screenHeight - remotePosition.y) - remoteSize.height;
+
+ point.y = screenHeight - point.y;
+
+ // Re-center point into the web page's frame.
+ point.y -= remotePosition.y;
+ point.x -= remotePosition.x;
+
+ WebCore::FrameView* frameView = m_page ? m_page->mainFrameView() : 0;
+ if (frameView) {
+ point.y += frameView->scrollPosition().y();
+ point.x += frameView->scrollPosition().x();
+ }
+
+ return [[self accessibilityRootObjectWrapper] accessibilityHitTest:point];
+}
+#pragma clang diagnostic pop
+
+@end
+
+#endif // PLATFORM(MAC)
+
#import "PageBanner.h"
#import "PluginView.h"
#import "PrintInfo.h"
-#import "WKAccessibilityWebPageObject.h"
+#import "WKAccessibilityWebPageObjectMac.h"
#import "WebCoreArgumentCoders.h"
#import "WebEvent.h"
#import "WebEventConversion.h"
void WebProcess::platformInitializeProcess(const ChildProcessInitializationParameters&)
{
-#if USE(APPKIT)
WKAXRegisterRemoteApp();
-#endif
#if ENABLE(SEC_ITEM_SHIM)
SecItemShim::shared().initialize(this);
BOOL WKIsPluginUpdateAvailable(NSString *bundleIdentifier);
// Remote Accessibility API.
+#if !TARGET_OS_IPHONE
void WKAXRegisterRemoteApp(void);
void WKAXInitializeElementWithPresenterPid(id, pid_t);
NSData *WKAXRemoteTokenForElement(id);
void WKAXSetWindowForRemoteElement(id remoteWindow, id remoteElement);
void WKAXRegisterRemoteProcess(bool registerProcess, pid_t);
pid_t WKAXRemoteProcessIdentifier(id remoteElement);
+#endif
void WKSetUpFontCache(void);