WK2: Support Accessibility
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Jan 2011 01:07:44 +0000 (01:07 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Jan 2011 01:07:44 +0000 (01:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=51859

Reviewed by Sam Weinig.

Tools:

Use rootObject() method to get top of accessibility tree.

* DumpRenderTree/mac/AccessibilityControllerMac.mm:
(AccessibilityController::focusedElement):
(AccessibilityController::rootElement):

WebCore:

WK2 doesn't use platform scroll views anymore. Accessibility code
needs to have its own scroll views.

Test: platform/mac/accessibility/webkit-scrollarea.html

* CMakeLists.txt:
* GNUmakefile.am:
* WebCore.exp.in:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::AXObjectCache):
(WebCore::AXObjectCache::get):
(WebCore::AXObjectCache::getOrCreate):
(WebCore::AXObjectCache::rootObject):
(WebCore::AXObjectCache::remove):
(WebCore::AXObjectCache::handleScrollbarUpdate):
* accessibility/AXObjectCache.h:
(WebCore::AXObjectCache::handleScrollbarUpdate):
* accessibility/AccessibilityARIAGrid.h:
* accessibility/AccessibilityAllInOne.cpp:
* accessibility/AccessibilityImageMapLink.cpp:
* accessibility/AccessibilityImageMapLink.h:
* accessibility/AccessibilityListBoxOption.cpp:
* accessibility/AccessibilityListBoxOption.h:
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::updateChildrenIfNecessary):
(WebCore::AccessibilityObject::elementAccessibilityHitTest):
(WebCore::AccessibilityObject::axObjectCache):
(WebCore::AccessibilityObject::focusedUIElement):
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::isAccessibilityScrollView):
(WebCore::AccessibilityObject::isScrollView):
(WebCore::AccessibilityObject::canSetNumericValue):
(WebCore::AccessibilityObject::scrollBar):
(WebCore::AccessibilityObject::size):
(WebCore::AccessibilityObject::setValue):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::parentObject):
(WebCore::AccessibilityRenderObject::accessibilityHitTest):
(WebCore::AccessibilityRenderObject::updateChildrenIfNecessary):
(WebCore::AccessibilityRenderObject::addChildren):
* accessibility/AccessibilityRenderObject.h:
* accessibility/AccessibilityScrollView.cpp: Added.
(WebCore::AccessibilityScrollView::AccessibilityScrollView):
(WebCore::AccessibilityScrollView::create):
(WebCore::AccessibilityScrollView::scrollBar):
(WebCore::AccessibilityScrollView::children):
(WebCore::AccessibilityScrollView::updateChildrenIfNecessary):
(WebCore::AccessibilityScrollView::removeChildScrollbar):
(WebCore::AccessibilityScrollView::addChildScrollbar):
(WebCore::AccessibilityScrollView::addChildren):
(WebCore::AccessibilityScrollView::webAreaObject):
(WebCore::AccessibilityScrollView::accessibilityHitTest):
(WebCore::AccessibilityScrollView::document):
(WebCore::AccessibilityScrollView::elementRect):
(WebCore::AccessibilityScrollView::parentObject):
* accessibility/AccessibilityScrollView.h: Added.
(WebCore::AccessibilityScrollView::roleValue):
(WebCore::AccessibilityScrollView::scrollView):
(WebCore::AccessibilityScrollView::accessibilityIsIgnored):
(WebCore::AccessibilityScrollView::isAccessibilityScrollView):
(WebCore::toAccessibilityScrollView):
* accessibility/AccessibilityScrollbar.cpp:
(WebCore::AccessibilityScrollbar::AccessibilityScrollbar):
(WebCore::AccessibilityScrollbar::create):
(WebCore::AccessibilityScrollbar::elementRect):
(WebCore::AccessibilityScrollbar::document):
(WebCore::AccessibilityScrollbar::orientation):
(WebCore::AccessibilityScrollbar::isEnabled):
(WebCore::AccessibilityScrollbar::valueForRange):
(WebCore::AccessibilityScrollbar::setValue):
* accessibility/AccessibilityScrollbar.h:
(WebCore::AccessibilityScrollbar::setParent):
(WebCore::AccessibilityScrollbar::canSetValueAttribute):
(WebCore::AccessibilityScrollbar::canSetNumericValue):
(WebCore::AccessibilityScrollbar::isAccessibilityScrollbar):
(WebCore::AccessibilityScrollbar::parentObject):
(WebCore::AccessibilityScrollbar::roleValue):
* accessibility/mac/AccessibilityObjectMac.mm:
(WebCore::AccessibilityObject::accessibilityIgnoreAttachment):
* accessibility/mac/AccessibilityObjectWrapper.mm:
(-[AccessibilityObjectWrapper accessibilityAttributeNames]):
(-[AccessibilityObjectWrapper remoteAccessibilityParentObject]):
(-[AccessibilityObjectWrapper position]):
(-[AccessibilityObjectWrapper scrollViewParent]):
(-[AccessibilityObjectWrapper accessibilityAttributeValue:]):
(-[AccessibilityObjectWrapper accessibilityHitTest:]):
(-[AccessibilityObjectWrapper accessibilitySetValue:forAttribute:]):
* dom/Document.cpp:
(WebCore::Document::axObjectCache):
* loader/EmptyClients.h:
(WebCore::EmptyFrameLoaderClient::accessibilityRemoteObject):
* loader/FrameLoaderClient.h:
* page/FrameView.cpp:
(WebCore::FrameView::~FrameView):
(WebCore::FrameView::axObjectCache):
* page/FrameView.h:
* platform/ScrollView.cpp:
(WebCore::ScrollView::setHasHorizontalScrollbar):
(WebCore::ScrollView::setHasVerticalScrollbar):
* platform/Scrollbar.cpp:
(WebCore::Scrollbar::~Scrollbar):
(WebCore::Scrollbar::scroll):
(WebCore::Scrollbar::axObjectCache):
* platform/Scrollbar.h:
* platform/Widget.h:
(WebCore::Widget::axObjectCache):

WebKit/gtk:

Use rootObject() method to get top of ax tree.

* WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
(DumpRenderTreeSupportGtk::getFocusedAccessibleElement):
* webkit/webkitwebview.cpp:
(webkit_web_view_get_accessible):

WebKit/mac:

Use rootObject() method to get top of AX tree.

* WebCoreSupport/WebFrameLoaderClient.h:
(WebFrameLoaderClient::accessibilityRemoteObject):
* WebView/WebFrame.mm:
(-[WebFrame setAccessibleName:]):
(-[WebFrame accessibilityRoot]):
* WebView/WebFrameInternal.h:
* WebView/WebFramePrivate.h:
* WebView/WebHTMLView.mm:
(-[WebHTMLView accessibilityAttributeValue:]):
(-[WebHTMLView accessibilityFocusedUIElement]):
(-[WebHTMLView accessibilityHitTest:]):
(-[WebHTMLView _accessibilityParentForSubview:]):

WebKit/win:

Use rootObject() method to get the top of the AX tree.

* AccessibleDocument.cpp:
(AccessibleDocument::AccessibleDocument):

WebKit2:

Implement remote accessibility API to support cross process accessibility
on the Mac platform.

* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/API/mac/PageClientImpl.h:
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::accessibilityChildTokenReceived):
* UIProcess/API/mac/WKView.mm:
(-[WKView initWithFrame:contextRef:pageGroupRef:]):
(-[WKView _updateWindowAndViewFrames]):
(-[WKView _setAccessibilityChildToken:]):
(-[WKView accessibilityIsIgnored]):
(-[WKView accessibilityHitTest:]):
(-[WKView accessibilityAttributeValue:]):
* UIProcess/API/mac/WKViewInternal.h:
* UIProcess/PageClient.h:
* UIProcess/WebContext.cpp:
(WebKit::WebContext::ensureWebProcess):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::windowAndViewFramesChanged):
(WebKit::WebPageProxy::didReceiveAccessibilityPageToken):
(WebKit::WebPageProxy::sendAccessibilityPresenterToken):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::accessibilityRemoteObject):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::windowAndViewFramesChanged):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::accessibilityPosition):
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/mac/AccessibilityWebPageObject.h: Added.
* WebProcess/WebPage/mac/AccessibilityWebPageObject.mm: Added.
(-[AccessibilityWebPageObject setWebPage:]):
(-[AccessibilityWebPageObject setRemoteParent:]):
(-[AccessibilityWebPageObject dealloc]):
(-[AccessibilityWebPageObject accessibilityIsIgnored]):
(-[AccessibilityWebPageObject accessibilityAttributeNames]):
(-[AccessibilityWebPageObject accessibilityIsAttributeSettable:]):
(-[AccessibilityWebPageObject accessibilitySetValue:forAttribute:]):
(-[AccessibilityWebPageObject accessibilityActionNames]):
(-[AccessibilityWebPageObject accessibilityChildren]):
(-[AccessibilityWebPageObject accessibilityAttributeValue:]):
(-[AccessibilityWebPageObject accessibilityShouldUseUniqueId]):
(-[AccessibilityWebPageObject accessibilityHitTest:]):
(-[AccessibilityWebPageObject accessibilityFocusedUIElement]):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::platformInitialize):
(WebKit::WebPage::sendAccessibilityPresenterToken):
(WebKit::WebPage::accessibilityRemoteObject):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
* WebProcess/WebProcess.h:
(WebKit::WebProcess::presenterApplicationPid):
* WebProcess/mac/WebProcessMainMac.mm:
(WebKit::WebProcessMain):

LayoutTests:

* platform/mac/accessibility/webkit-scrollarea-expected.txt: Added.
* platform/mac/accessibility/webkit-scrollarea.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@75031 268f45cc-cd09-0410-ab3c-d52691b4dbfc

75 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/accessibility/webkit-scrollarea-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/webkit-scrollarea.html [new file with mode: 0644]
Tools/ChangeLog
Tools/DumpRenderTree/mac/AccessibilityControllerMac.mm
WebCore/CMakeLists.txt
WebCore/ChangeLog
WebCore/GNUmakefile.am
WebCore/WebCore.exp.in
WebCore/WebCore.gypi
WebCore/WebCore.pro
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/accessibility/AXObjectCache.cpp
WebCore/accessibility/AXObjectCache.h
WebCore/accessibility/AccessibilityARIAGrid.h
WebCore/accessibility/AccessibilityAllInOne.cpp
WebCore/accessibility/AccessibilityImageMapLink.cpp
WebCore/accessibility/AccessibilityImageMapLink.h
WebCore/accessibility/AccessibilityListBoxOption.cpp
WebCore/accessibility/AccessibilityListBoxOption.h
WebCore/accessibility/AccessibilityObject.cpp
WebCore/accessibility/AccessibilityObject.h
WebCore/accessibility/AccessibilityRenderObject.cpp
WebCore/accessibility/AccessibilityRenderObject.h
WebCore/accessibility/AccessibilityScrollView.cpp [new file with mode: 0644]
WebCore/accessibility/AccessibilityScrollView.h [new file with mode: 0644]
WebCore/accessibility/AccessibilityScrollbar.cpp
WebCore/accessibility/AccessibilityScrollbar.h
WebCore/accessibility/mac/AccessibilityObjectMac.mm
WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
WebCore/dom/Document.cpp
WebCore/loader/EmptyClients.h
WebCore/loader/FrameLoaderClient.h
WebCore/page/FrameView.cpp
WebCore/page/FrameView.h
WebCore/platform/ScrollView.cpp
WebCore/platform/Scrollbar.cpp
WebCore/platform/Scrollbar.h
WebCore/platform/Widget.h
WebKit/gtk/ChangeLog
WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp
WebKit/gtk/webkit/webkitwebview.cpp
WebKit/mac/ChangeLog
WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
WebKit/mac/WebView/WebFrame.mm
WebKit/mac/WebView/WebFrameInternal.h
WebKit/mac/WebView/WebFramePrivate.h
WebKit/mac/WebView/WebHTMLView.mm
WebKit/win/AccessibleDocument.cpp
WebKit/win/ChangeLog
WebKit2/ChangeLog
WebKit2/Shared/WebProcessCreationParameters.cpp
WebKit2/Shared/WebProcessCreationParameters.h
WebKit2/UIProcess/API/mac/PageClientImpl.h
WebKit2/UIProcess/API/mac/PageClientImpl.mm
WebKit2/UIProcess/API/mac/WKView.mm
WebKit2/UIProcess/API/mac/WKViewInternal.h
WebKit2/UIProcess/PageClient.h
WebKit2/UIProcess/WebContext.cpp
WebKit2/UIProcess/WebPageProxy.cpp
WebKit2/UIProcess/WebPageProxy.h
WebKit2/UIProcess/WebPageProxy.messages.in
WebKit2/WebKit2.xcodeproj/project.pbxproj
WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
WebKit2/WebProcess/WebPage/WebPage.cpp
WebKit2/WebProcess/WebPage/WebPage.h
WebKit2/WebProcess/WebPage/WebPage.messages.in
WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.h [new file with mode: 0644]
WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm [new file with mode: 0644]
WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
WebKit2/WebProcess/WebProcess.cpp
WebKit2/WebProcess/WebProcess.h
WebKit2/WebProcess/mac/WebProcessMainMac.mm

index 5480d29..7b6007e 100644 (file)
@@ -1,3 +1,13 @@
+2011-01-04  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        WK2: Support Accessibility
+        https://bugs.webkit.org/show_bug.cgi?id=51859
+
+        * platform/mac/accessibility/webkit-scrollarea-expected.txt: Added.
+        * platform/mac/accessibility/webkit-scrollarea.html: Added.
+
 2011-01-04  Kent Tamura  <tkent@chromium.org>
 
         Unreviewed, test expectation update.
diff --git a/LayoutTests/platform/mac/accessibility/webkit-scrollarea-expected.txt b/LayoutTests/platform/mac/accessibility/webkit-scrollarea-expected.txt
new file mode 100644 (file)
index 0000000..e02e87c
--- /dev/null
@@ -0,0 +1,15 @@
+text
+
+text
+This tests that the WebKit generated scroll areas are correct.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS body.role is 'AXRole: AXWebArea'
+PASS body.parentElement().role is 'AXRole: AXScrollArea'
+PASS body.parentElement().childrenCount is 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/mac/accessibility/webkit-scrollarea.html b/LayoutTests/platform/mac/accessibility/webkit-scrollarea.html
new file mode 100644 (file)
index 0000000..f3ecc0d
--- /dev/null
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script>
+var successfullyParsed = false;
+</script>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+text<br>
+<img src='resources/cake.png' width=5000 height=5000>
+<br>
+text
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that the WebKit generated scroll areas are correct.");
+
+    if (window.accessibilityController) {
+
+        document.getElementById("body").focus();
+        var body = accessibilityController.focusedElement;
+        shouldBe("body.role", "'AXRole: AXWebArea'");
+        shouldBe("body.parentElement().role", "'AXRole: AXScrollArea'");
+        shouldBe("body.parentElement().childrenCount", "1");
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src="../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
index d43838e..276d342 100644 (file)
@@ -1,3 +1,16 @@
+2011-01-04  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        WK2: Support Accessibility
+        https://bugs.webkit.org/show_bug.cgi?id=51859
+
+        Use rootObject() method to get top of accessibility tree.
+
+        * DumpRenderTree/mac/AccessibilityControllerMac.mm:
+        (AccessibilityController::focusedElement):
+        (AccessibilityController::rootElement):
+
 2011-01-03  Martin Robinson  <mrobinson@igalia.com>
 
         Reviewed by Darin Adler.
index 9d7edef..1a9f9c9 100644 (file)
 #import "AccessibilityController.h"
 
 #import "AccessibilityUIElement.h"
+#import <AppKit/NSColor.h>
 #import <Foundation/Foundation.h>
 #import <WebKit/WebFrame.h>
+#import <WebKit/WebFramePrivate.h>
 #import <WebKit/WebHTMLView.h>
 
 AccessibilityController::AccessibilityController()
@@ -49,14 +51,14 @@ AccessibilityUIElement AccessibilityController::elementAtPoint(int x, int y)
 AccessibilityUIElement AccessibilityController::focusedElement()
 {
     // FIXME: we could do some caching here.
-    id accessibilityObject = [[[mainFrame frameView] documentView] accessibilityFocusedUIElement];
+    id accessibilityObject = [[mainFrame accessibilityRoot] accessibilityFocusedUIElement];
     return AccessibilityUIElement(accessibilityObject);
 }
 
 AccessibilityUIElement AccessibilityController::rootElement()
 {
     // FIXME: we could do some caching here.
-    id accessibilityObject = [[mainFrame frameView] documentView];
+    id accessibilityObject = [mainFrame accessibilityRoot];
     return AccessibilityUIElement(accessibilityObject);
 }
 
index 5f710db..b950e8f 100644 (file)
@@ -575,6 +575,7 @@ SET(WebCore_SOURCES
     accessibility/AccessibilityObject.cpp
     accessibility/AccessibilityRenderObject.cpp
     accessibility/AccessibilityScrollbar.cpp
+    accessibility/AccessibilityScrollView.cpp
     accessibility/AccessibilitySlider.cpp
     accessibility/AccessibilityTable.cpp
     accessibility/AccessibilityTableCell.cpp
index 117180a..5ece5a4 100644 (file)
@@ -1,3 +1,121 @@
+2011-01-04  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        WK2: Support Accessibility
+        https://bugs.webkit.org/show_bug.cgi?id=51859
+
+        WK2 doesn't use platform scroll views anymore. Accessibility code
+        needs to have its own scroll views. 
+
+        Test: platform/mac/accessibility/webkit-scrollarea.html
+
+        * CMakeLists.txt:
+        * GNUmakefile.am:
+        * WebCore.exp.in:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AXObjectCache::AXObjectCache):
+        (WebCore::AXObjectCache::get):
+        (WebCore::AXObjectCache::getOrCreate):
+        (WebCore::AXObjectCache::rootObject):
+        (WebCore::AXObjectCache::remove):
+        (WebCore::AXObjectCache::handleScrollbarUpdate):
+        * accessibility/AXObjectCache.h:
+        (WebCore::AXObjectCache::handleScrollbarUpdate):
+        * accessibility/AccessibilityARIAGrid.h:
+        * accessibility/AccessibilityAllInOne.cpp:
+        * accessibility/AccessibilityImageMapLink.cpp:
+        * accessibility/AccessibilityImageMapLink.h:
+        * accessibility/AccessibilityListBoxOption.cpp:
+        * accessibility/AccessibilityListBoxOption.h:
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::updateChildrenIfNecessary):
+        (WebCore::AccessibilityObject::elementAccessibilityHitTest):
+        (WebCore::AccessibilityObject::axObjectCache):
+        (WebCore::AccessibilityObject::focusedUIElement):
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::isAccessibilityScrollView):
+        (WebCore::AccessibilityObject::isScrollView):
+        (WebCore::AccessibilityObject::canSetNumericValue):
+        (WebCore::AccessibilityObject::scrollBar):
+        (WebCore::AccessibilityObject::size):
+        (WebCore::AccessibilityObject::setValue):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::parentObject):
+        (WebCore::AccessibilityRenderObject::accessibilityHitTest):
+        (WebCore::AccessibilityRenderObject::updateChildrenIfNecessary):
+        (WebCore::AccessibilityRenderObject::addChildren):
+        * accessibility/AccessibilityRenderObject.h:
+        * accessibility/AccessibilityScrollView.cpp: Added.
+        (WebCore::AccessibilityScrollView::AccessibilityScrollView):
+        (WebCore::AccessibilityScrollView::create):
+        (WebCore::AccessibilityScrollView::scrollBar):
+        (WebCore::AccessibilityScrollView::children):
+        (WebCore::AccessibilityScrollView::updateChildrenIfNecessary):
+        (WebCore::AccessibilityScrollView::removeChildScrollbar):
+        (WebCore::AccessibilityScrollView::addChildScrollbar):
+        (WebCore::AccessibilityScrollView::addChildren):
+        (WebCore::AccessibilityScrollView::webAreaObject):
+        (WebCore::AccessibilityScrollView::accessibilityHitTest):
+        (WebCore::AccessibilityScrollView::document):
+        (WebCore::AccessibilityScrollView::elementRect):
+        (WebCore::AccessibilityScrollView::parentObject):
+        * accessibility/AccessibilityScrollView.h: Added.
+        (WebCore::AccessibilityScrollView::roleValue):
+        (WebCore::AccessibilityScrollView::scrollView):
+        (WebCore::AccessibilityScrollView::accessibilityIsIgnored):
+        (WebCore::AccessibilityScrollView::isAccessibilityScrollView):
+        (WebCore::toAccessibilityScrollView):
+        * accessibility/AccessibilityScrollbar.cpp:
+        (WebCore::AccessibilityScrollbar::AccessibilityScrollbar):
+        (WebCore::AccessibilityScrollbar::create):
+        (WebCore::AccessibilityScrollbar::elementRect):
+        (WebCore::AccessibilityScrollbar::document):
+        (WebCore::AccessibilityScrollbar::orientation):
+        (WebCore::AccessibilityScrollbar::isEnabled):
+        (WebCore::AccessibilityScrollbar::valueForRange):
+        (WebCore::AccessibilityScrollbar::setValue):
+        * accessibility/AccessibilityScrollbar.h:
+        (WebCore::AccessibilityScrollbar::setParent):
+        (WebCore::AccessibilityScrollbar::canSetValueAttribute):
+        (WebCore::AccessibilityScrollbar::canSetNumericValue):
+        (WebCore::AccessibilityScrollbar::isAccessibilityScrollbar):
+        (WebCore::AccessibilityScrollbar::parentObject):
+        (WebCore::AccessibilityScrollbar::roleValue):
+        * accessibility/mac/AccessibilityObjectMac.mm:
+        (WebCore::AccessibilityObject::accessibilityIgnoreAttachment):
+        * accessibility/mac/AccessibilityObjectWrapper.mm:
+        (-[AccessibilityObjectWrapper accessibilityAttributeNames]):
+        (-[AccessibilityObjectWrapper remoteAccessibilityParentObject]):
+        (-[AccessibilityObjectWrapper position]):
+        (-[AccessibilityObjectWrapper scrollViewParent]):
+        (-[AccessibilityObjectWrapper accessibilityAttributeValue:]):
+        (-[AccessibilityObjectWrapper accessibilityHitTest:]):
+        (-[AccessibilityObjectWrapper accessibilitySetValue:forAttribute:]):
+        * dom/Document.cpp:
+        (WebCore::Document::axObjectCache):
+        * loader/EmptyClients.h:
+        (WebCore::EmptyFrameLoaderClient::accessibilityRemoteObject):
+        * loader/FrameLoaderClient.h:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::~FrameView):
+        (WebCore::FrameView::axObjectCache):
+        * page/FrameView.h:
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::setHasHorizontalScrollbar):
+        (WebCore::ScrollView::setHasVerticalScrollbar):
+        * platform/Scrollbar.cpp:
+        (WebCore::Scrollbar::~Scrollbar):
+        (WebCore::Scrollbar::scroll):
+        (WebCore::Scrollbar::axObjectCache):
+        * platform/Scrollbar.h:
+        * platform/Widget.h:
+        (WebCore::Widget::axObjectCache):
+
 2011-01-04  W. James MacLean  <wjmaclean@chromium.org>
 
         Reviewed by Kenneth Russell.
index 4063054..11eb9c5 100644 (file)
@@ -662,6 +662,8 @@ webcore_sources += \
        WebCore/accessibility/AccessibilityRenderObject.h \
        WebCore/accessibility/AccessibilityScrollbar.cpp \
        WebCore/accessibility/AccessibilityScrollbar.h \
+       WebCore/accessibility/AccessibilityScrollView.cpp \
+       WebCore/accessibility/AccessibilityScrollView.h \
        WebCore/accessibility/AccessibilitySlider.cpp \
        WebCore/accessibility/AccessibilitySlider.h \
        WebCore/accessibility/AccessibilityTableCell.cpp \
index d3abe88..b37b289 100644 (file)
@@ -290,7 +290,7 @@ __ZN7WebCore12createMarkupEPKNS_4NodeENS_13EChildrenOnlyEPN3WTF6VectorIPS0_Lm0EE
 __ZN7WebCore12createMarkupEPKNS_5RangeEPN3WTF6VectorIPNS_4NodeELm0EEENS_23EAnnotateForInterchangeEbNS_13EAbsoluteURLsE
 __ZN7WebCore12gcControllerEv
 __ZN7WebCore12iconDatabaseEv
-__ZN7WebCore13AXObjectCache11getOrCreateEPNS_12RenderObjectE
+__ZN7WebCore13AXObjectCache10rootObjectEv
 __ZN7WebCore13AXObjectCache21gAccessibilityEnabledE
 __ZN7WebCore13AXObjectCache42gAccessibilityEnhancedUserInterfaceEnabledE
 __ZN7WebCore13HTTPHeaderMapC1Ev
index b9a8ef2..dfbf86e 100644 (file)
             'accessibility/AccessibilityRenderObject.h',
             'accessibility/AccessibilityScrollbar.cpp',
             'accessibility/AccessibilityScrollbar.h',
+            'accessibility/AccessibilityScrollView.cpp',
+            'accessibility/AccessibilityScrollView.h',
             'accessibility/AccessibilitySlider.cpp',
             'accessibility/AccessibilitySlider.h',
             'accessibility/AccessibilityTable.cpp',
index 3052011..8a15fec 100644 (file)
@@ -321,6 +321,7 @@ SOURCES += \
     accessibility/AccessibilityProgressIndicator.cpp \    
     accessibility/AccessibilityRenderObject.cpp \    
     accessibility/AccessibilityScrollbar.cpp \
+    accessibility/AccessibilityScrollView.cpp \
     accessibility/AccessibilitySlider.cpp \    
     accessibility/AccessibilityARIAGrid.cpp \    
     accessibility/AccessibilityARIAGridCell.cpp \    
@@ -1398,6 +1399,7 @@ HEADERS += \
     accessibility/AccessibilityProgressIndicator.h \
     accessibility/AccessibilityRenderObject.h \
     accessibility/AccessibilityScrollbar.h \
+    accessibility/AccessibilityScrollView.h \
     accessibility/AccessibilitySlider.h \
     accessibility/AccessibilityTableCell.h \
     accessibility/AccessibilityTableColumn.h \
index b7bc883..f756683 100755 (executable)
                                >
                        </File>
                        <File
+                               RelativePath="..\accessibility\AccessibilityScrollView.cpp"
+                               >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug_Cairo_CFLite|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release_Cairo_CFLite|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug_All|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release_LTCG|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\accessibility\AccessibilityScrollView.h"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\accessibility\AccessibilitySlider.cpp"
                                >
                                <FileConfiguration
index 3e20f18..5519043 100644 (file)
                24F54EAD101FE914000AE741 /* ApplicationCacheHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 24F54EAB101FE914000AE741 /* ApplicationCacheHost.h */; settings = {ATTRIBUTES = (); }; };
                2542F4DA1166C25A00E89A86 /* UserGestureIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2542F4D81166C25A00E89A86 /* UserGestureIndicator.cpp */; };
                2542F4DB1166C25A00E89A86 /* UserGestureIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 2542F4D91166C25A00E89A86 /* UserGestureIndicator.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               29489FC712C00F0300D83F0F /* AccessibilityScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 29489FC512C00F0300D83F0F /* AccessibilityScrollView.h */; };
+               29489FC812C00F0300D83F0F /* AccessibilityScrollView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29489FC612C00F0300D83F0F /* AccessibilityScrollView.cpp */; };
                29A812260FBB9C1D00510293 /* AccessibilityRenderObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29A812080FBB9C1D00510293 /* AccessibilityRenderObject.cpp */; };
                29A812270FBB9C1D00510293 /* AccessibilityTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29A812090FBB9C1D00510293 /* AccessibilityTable.cpp */; };
                29A812280FBB9C1D00510293 /* AccessibilityARIAGrid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29A8120A0FBB9C1D00510293 /* AccessibilityARIAGrid.cpp */; };
                24F54EAB101FE914000AE741 /* ApplicationCacheHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationCacheHost.h; sourceTree = "<group>"; };
                2542F4D81166C25A00E89A86 /* UserGestureIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserGestureIndicator.cpp; sourceTree = "<group>"; };
                2542F4D91166C25A00E89A86 /* UserGestureIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserGestureIndicator.h; sourceTree = "<group>"; };
+               29489FC512C00F0300D83F0F /* AccessibilityScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityScrollView.h; sourceTree = "<group>"; };
+               29489FC612C00F0300D83F0F /* AccessibilityScrollView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityScrollView.cpp; sourceTree = "<group>"; };
                29A812080FBB9C1D00510293 /* AccessibilityRenderObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityRenderObject.cpp; sourceTree = "<group>"; };
                29A812090FBB9C1D00510293 /* AccessibilityTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityTable.cpp; sourceTree = "<group>"; };
                29A8120A0FBB9C1D00510293 /* AccessibilityARIAGrid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityARIAGrid.cpp; sourceTree = "<group>"; };
                                A409C983116D0DDD007197BD /* AccessibilityProgressIndicator.h */,
                                29A812080FBB9C1D00510293 /* AccessibilityRenderObject.cpp */,
                                29A8121B0FBB9C1D00510293 /* AccessibilityRenderObject.h */,
+                               29489FC612C00F0300D83F0F /* AccessibilityScrollView.cpp */,
+                               29489FC512C00F0300D83F0F /* AccessibilityScrollView.h */,
                                93C4F6E81108F9A50099D0DB /* AccessibilityScrollbar.cpp */,
                                93C4F6E91108F9A50099D0DB /* AccessibilityScrollbar.h */,
                                0709FC4B1025DED80059CDBA /* AccessibilitySlider.cpp */,
                                93F199ED08245E59001E9ABC /* XSLTProcessor.h in Headers */,
                                E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */,
                                97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */,
+                               29489FC712C00F0300D83F0F /* AccessibilityScrollView.h in Headers */,
                                7EE6846012D26E3800E79415 /* AuthenticationCF.h in Headers */,
                                7EE6846112D26E3800E79415 /* AuthenticationChallenge.h in Headers */,
                                7EE6846412D26E3800E79415 /* CookieStorageCFNet.h in Headers */,
                                93F19B0508245E59001E9ABC /* XSLTProcessorLibxslt.cpp in Sources */,
                                E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
                                97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */,
+                               29489FC812C00F0300D83F0F /* AccessibilityScrollView.cpp in Sources */,
                                7EE6845F12D26E3800E79415 /* AuthenticationCF.cpp in Sources */,
                                7EE6846212D26E3800E79415 /* CookieJarCFNet.cpp in Sources */,
                                7EE6846312D26E3800E79415 /* CookieStorageCFNet.cpp in Sources */,
index 5f969cd..d0d19f7 100644 (file)
@@ -42,6 +42,7 @@
 #include "AccessibilityMenuListPopup.h"
 #include "AccessibilityProgressIndicator.h"
 #include "AccessibilityRenderObject.h"
+#include "AccessibilityScrollView.h"
 #include "AccessibilityScrollbar.h"
 #include "AccessibilitySlider.h"
 #include "AccessibilityTable.h"
@@ -49,6 +50,7 @@
 #include "AccessibilityTableColumn.h"
 #include "AccessibilityTableHeaderContainer.h"
 #include "AccessibilityTableRow.h"
+#include "Document.h"
 #include "FocusController.h"
 #include "Frame.h"
 #include "HTMLAreaElement.h"
 #include "Page.h"
 #include "RenderListBox.h"
 #include "RenderMenuList.h"
+#include "RenderProgress.h"
+#include "RenderSlider.h"
 #include "RenderTable.h"
 #include "RenderTableCell.h"
 #include "RenderTableRow.h"
-#include "RenderProgress.h"
-#include "RenderSlider.h"
 #include "RenderView.h"
+#include "ScrollView.h"
 
 #include <wtf/PassRefPtr.h>
 
@@ -77,9 +80,10 @@ using namespace HTMLNames;
 bool AXObjectCache::gAccessibilityEnabled = false;
 bool AXObjectCache::gAccessibilityEnhancedUserInterfaceEnabled = false;
 
-AXObjectCache::AXObjectCache()
+AXObjectCache::AXObjectCache(const Document* doc)
     : m_notificationPostTimer(this, &AXObjectCache::notificationPostTimerFired)
 {
+    m_document = const_cast<Document*>(doc);
 }
 
 AXObjectCache::~AXObjectCache()
@@ -151,19 +155,30 @@ AccessibilityObject* AXObjectCache::focusedUIElementForPage(const Page* page)
     return obj;
 }
 
+AccessibilityObject* AXObjectCache::get(Widget* widget)
+{
+    if (!widget)
+        return 0;
+        
+    AXID axID = m_widgetObjectMapping.get(widget);
+    ASSERT(!HashTraits<AXID>::isDeletedValue(axID));
+    if (!axID)
+        return 0;
+    
+    return m_objects.get(axID).get();    
+}
+    
 AccessibilityObject* AXObjectCache::get(RenderObject* renderer)
 {
     if (!renderer)
         return 0;
     
-    AccessibilityObject* obj = 0;
     AXID axID = m_renderObjectMapping.get(renderer);
     ASSERT(!HashTraits<AXID>::isDeletedValue(axID));
-
-    if (axID)
-        obj = m_objects.get(axID).get();
+    if (!axID)
+        return 0;
     
-    return obj;
+    return m_objects.get(axID).get();    
 }
 
 // FIXME: This probably belongs on Node.
@@ -230,6 +245,28 @@ static PassRefPtr<AccessibilityObject> createFromRenderer(RenderObject* renderer
     return AccessibilityRenderObject::create(renderer);
 }
 
+AccessibilityObject* AXObjectCache::getOrCreate(Widget* widget)
+{
+    if (!widget)
+        return 0;
+
+    if (AccessibilityObject* obj = get(widget))
+        return obj;
+    
+    RefPtr<AccessibilityObject> newObj = 0;
+    if (widget->isFrameView())
+        newObj = AccessibilityScrollView::create(static_cast<ScrollView*>(widget));
+    else if (widget->isScrollbar())
+        newObj = AccessibilityScrollbar::create(static_cast<Scrollbar*>(widget));
+        
+    getAXID(newObj.get());
+    
+    m_widgetObjectMapping.set(widget, newObj->axObjectID());
+    m_objects.set(newObj->axObjectID(), newObj);    
+    attachWrapper(newObj.get());
+    return newObj.get();
+}
+    
 AccessibilityObject* AXObjectCache::getOrCreate(RenderObject* renderer)
 {
     if (!renderer)
@@ -247,6 +284,11 @@ AccessibilityObject* AXObjectCache::getOrCreate(RenderObject* renderer)
     attachWrapper(newObj.get());
     return newObj.get();
 }
+    
+AccessibilityObject* AXObjectCache::rootObject()
+{
+    return getOrCreate(m_document->view());
+}
 
 AccessibilityObject* AXObjectCache::getOrCreate(AccessibilityRole role)
 {
@@ -275,9 +317,6 @@ AccessibilityObject* AXObjectCache::getOrCreate(AccessibilityRole role)
     case MenuListOptionRole:
         obj = AccessibilityMenuListOption::create();
         break;
-    case ScrollBarRole:
-        obj = AccessibilityScrollbar::create();
-        break;
     default:
         obj = 0;
     }
@@ -323,6 +362,17 @@ void AXObjectCache::remove(RenderObject* renderer)
     m_renderObjectMapping.remove(renderer);
 }
 
+void AXObjectCache::remove(Widget* view)
+{
+    if (!view)
+        return;
+        
+    AXID axID = m_widgetObjectMapping.get(view);
+    remove(axID);
+    m_widgetObjectMapping.remove(view);
+}
+    
+    
 #if !PLATFORM(WIN) || OS(WINCE)
 AXID AXObjectCache::platformGenerateAXID() const
 {
@@ -478,6 +528,18 @@ void AXObjectCache::nodeTextChangeNotification(RenderObject* renderer, AXTextCha
 #endif
 
 #if HAVE(ACCESSIBILITY)
+
+void AXObjectCache::handleScrollbarUpdate(ScrollView* view)
+{
+    if (!view)
+        return;
+    
+    // We don't want to create a scroll view from this method, only update an existing one.
+    AccessibilityObject* scrollViewObject = get(view);
+    if (scrollViewObject)
+        scrollViewObject->updateChildrenIfNecessary();
+}
+    
 void AXObjectCache::handleAriaExpandedChange(RenderObject *renderer)
 {
     if (!renderer)
index fc6dbb5..670d6e0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010, 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
@@ -42,11 +42,14 @@ class WebCoreTextMarker;
 
 namespace WebCore {
 
+class Document;
 class HTMLAreaElement;
 class Node;
 class Page;
 class RenderObject;
+class ScrollView;
 class VisiblePosition;
+class Widget;
 
 struct TextMarkerData {
     AXID axID;
@@ -59,14 +62,17 @@ enum PostType { PostSynchronously, PostAsynchronously };
 
 class AXObjectCache : public Noncopyable {
 public:
-    AXObjectCache();
+    AXObjectCache(const Document*);
     ~AXObjectCache();
 
     static AccessibilityObject* focusedUIElementForPage(const Page*);
 
-    // to be used with render objects
-    AccessibilityObject* getOrCreate(RenderObject*);
+    AccessibilityObject* rootObject();
     
+    // For AX objects with elements that back them.
+    AccessibilityObject* getOrCreate(RenderObject*);
+    AccessibilityObject* getOrCreate(Widget*);
+
     // used for objects without backing elements
     AccessibilityObject* getOrCreate(AccessibilityRole);
     
@@ -74,6 +80,7 @@ public:
     AccessibilityObject* get(RenderObject*);
     
     void remove(RenderObject*);
+    void remove(Widget*);
     void remove(AXID);
 
     void detachWrapper(AccessibilityObject*);
@@ -88,6 +95,7 @@ public:
     void handleFocusedUIElementChanged(RenderObject* oldFocusedRenderer, RenderObject* newFocusedRenderer);
     void handleScrolledToAnchor(const Node* anchorNode);
     void handleAriaExpandedChange(RenderObject*);
+    void handleScrollbarUpdate(ScrollView*);
     
     static void enableAccessibility() { gAccessibilityEnabled = true; }
     static void enableEnhancedUserInterfaceAccessibility() { gAccessibilityEnhancedUserInterfaceEnabled = true; }
@@ -145,8 +153,10 @@ protected:
     void nodeTextChangePlatformNotification(AccessibilityObject*, AXTextChange, unsigned offset, unsigned count);
 
 private:
+    Document* m_document;
     HashMap<AXID, RefPtr<AccessibilityObject> > m_objects;
     HashMap<RenderObject*, AXID> m_renderObjectMapping;
+    HashMap<Widget*, AXID> m_widgetObjectMapping;
     HashSet<Node*> m_textMarkerNodes;
     static bool gAccessibilityEnabled;
     static bool gAccessibilityEnhancedUserInterfaceEnabled;
@@ -160,6 +170,7 @@ private:
     static AccessibilityObject* focusedImageMapUIElement(HTMLAreaElement*);
     
     AXID getAXID(AccessibilityObject*);
+    AccessibilityObject* get(Widget*);
 };
 
 bool nodeHasRole(Node*, const String& role);
@@ -179,6 +190,7 @@ inline void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderOb
 inline void AXObjectCache::handleScrolledToAnchor(const Node*) { }
 inline void AXObjectCache::contentChanged(RenderObject*) { }
 inline void AXObjectCache::handleAriaExpandedChange(RenderObject*) { }
+inline void AXObjectCache::handleScrollbarUpdate(ScrollView*) { }
 #endif
 
 }
index dc3c3ee..02ff4d0 100644 (file)
@@ -55,7 +55,7 @@ private:
     // ARIA treegrids and grids support selected rows.
     virtual bool supportsSelectedRows() { return true; }    
 
-    void addChild(AccessibilityObject* object, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount);
+    void addChild(AccessibilityObject*, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount);
 };
 
 } // namespace WebCore 
index 9cf2068..1c2836e 100644 (file)
@@ -36,6 +36,7 @@
 #include <AccessibilityMediaControls.cpp>
 #include <AccessibilityObject.cpp>
 #include <AccessibilityRenderObject.cpp>
+#include <AccessibilityScrollView.cpp>
 #include <AccessibilityScrollbar.cpp>
 #include <AccessibilitySlider.cpp>
 #include <AccessibilityTable.cpp>
index 870efe3..5676206 100644 (file)
@@ -136,11 +136,6 @@ IntRect AccessibilityImageMapLink::elementRect() const
     return m_areaElement->getRect(renderer);
 }
     
-IntSize AccessibilityImageMapLink::size() const
-{
-    return elementRect().size();
-}
-
 String AccessibilityImageMapLink::stringValueForMSAA() const
 {
     return url();
index 011d5de..4b02b2b 100644 (file)
@@ -68,7 +68,6 @@ public:
     virtual String stringValueForMSAA() const;
     virtual String nameForMSAA() const;
 
-    virtual IntSize size() const;
     virtual IntRect elementRect() const;
 
 private:    
index 81a5978..01420c5 100644 (file)
@@ -152,11 +152,6 @@ String AccessibilityListBoxOption::stringValue() const
     return String();
 }
 
-IntSize AccessibilityListBoxOption::size() const
-{
-    return elementRect().size();
-}
-
 Element* AccessibilityListBoxOption::actionElement() const
 {
     return m_optionElement;
index c500283..597c731 100644 (file)
@@ -61,7 +61,6 @@ public:
     virtual bool canSetSelectedAttribute() const;
 
     virtual IntRect elementRect() const;
-    virtual IntSize size() const;
     virtual AccessibilityObject* parentObject() const;
     bool isListBoxOption() const { return true; }
     
@@ -72,7 +71,7 @@ private:
     HTMLSelectElement* listBoxOptionParentNode() const;
     int listBoxOptionIndex() const;
     IntRect listBoxOptionRect() const;
-    AccessibilityObject* listBoxOptionAccessibilityObject(HTMLElement* element) const;
+    AccessibilityObject* listBoxOptionAccessibilityObject(HTMLElement*) const;
 };
     
 } // namespace WebCore 
index e6c991f..cf49245 100644 (file)
@@ -730,6 +730,12 @@ FrameView* AccessibilityObject::documentFrameView() const
 
     return object->documentFrameView();
 }
+    
+void AccessibilityObject::updateChildrenIfNecessary()
+{
+    if (!hasChildren())
+        addChildren();    
+}
 
 void AccessibilityObject::clearChildren()
 {
@@ -1001,6 +1007,39 @@ bool AccessibilityObject::supportsARIALiveRegion() const
     const AtomicString& liveRegion = ariaLiveRegionStatus();
     return equalIgnoringCase(liveRegion, "polite") || equalIgnoringCase(liveRegion, "assertive");
 }
+
+AccessibilityObject* AccessibilityObject::elementAccessibilityHitTest(const IntPoint& point) const
+{ 
+    // Send the hit test back into the sub-frame if necessary.
+    if (isAttachment()) {
+        Widget* widget = widgetForAttachmentView();
+        if (widget && widget->isFrameView())
+            return axObjectCache()->getOrCreate(static_cast<ScrollView*>(widget))->accessibilityHitTest(point);
+    }
+
+    return const_cast<AccessibilityObject*>(this); 
+}
+    
+AXObjectCache* AccessibilityObject::axObjectCache() const
+{
+    Document* doc = document();
+    if (doc)
+        return doc->axObjectCache();
+    return 0;
+}
+    
+AccessibilityObject* AccessibilityObject::focusedUIElement() const
+{
+    Document* doc = document();
+    if (!doc)
+        return 0;
+    
+    Page* page = doc->page();
+    if (!page)
+        return 0;
+    
+    return AXObjectCache::focusedUIElementForPage(page);
+}
     
 AccessibilityButtonState AccessibilityObject::checkboxOrRadioValue() const
 {
index 5fd41af..a1f2417 100644 (file)
@@ -260,6 +260,8 @@ public:
     
     virtual bool isAccessibilityRenderObject() const { return false; }
     virtual bool isAccessibilityScrollbar() const { return false; }
+    virtual bool isAccessibilityScrollView() const { return false; }
+    
     virtual bool isAnchor() const { return false; }
     virtual bool isAttachment() const { return false; }
     virtual bool isHeading() const { return false; }
@@ -309,6 +311,7 @@ public:
     bool isButton() const { return roleValue() == ButtonRole; }
     bool isListItem() const { return roleValue() == ListItemRole; }
     bool isCheckboxOrRadio() const { return isCheckbox() || isRadioButton(); }
+    bool isScrollView() const { return roleValue() == ScrollAreaRole; }
     
     virtual bool isChecked() const { return false; }
     virtual bool isEnabled() const { return false; }
@@ -332,6 +335,7 @@ public:
     virtual bool canSetFocusAttribute() const { return false; }
     virtual bool canSetTextRangeAttributes() const { return false; }
     virtual bool canSetValueAttribute() const { return false; }
+    virtual bool canSetNumericValue() const { return false; }
     virtual bool canSetSelectedAttribute() const { return false; }
     virtual bool canSetSelectedChildrenAttribute() const { return false; }
     virtual bool canSetExpandedAttribute() const { return false; }
@@ -373,9 +377,9 @@ public:
     // Called on the root AX object to return the deepest available element.
     virtual AccessibilityObject* accessibilityHitTest(const IntPoint&) const { return 0; }
     // Called on the AX object after the render tree determines which is the right AccessibilityRenderObject.
-    virtual AccessibilityObject* elementAccessibilityHitTest(const IntPoint&) const { return const_cast<AccessibilityObject*>(this); }
+    virtual AccessibilityObject* elementAccessibilityHitTest(const IntPoint&) const;
 
-    virtual AccessibilityObject* focusedUIElement() const { return 0; }
+    virtual AccessibilityObject* focusedUIElement() const;
 
     virtual AccessibilityObject* firstChild() const { return 0; }
     virtual AccessibilityObject* lastChild() const { return 0; }
@@ -391,7 +395,8 @@ public:
     virtual AccessibilityObject* titleUIElement() const { return 0; }
     virtual bool exposesTitleUIElement() const { return true; }
     virtual AccessibilityObject* correspondingControlForLabelElement() const { return 0; }
-
+    virtual AccessibilityObject* scrollBar(AccessibilityOrientation) const { return 0; }
+    
     virtual AccessibilityRole ariaRoleAttribute() const { return UnknownRole; }
     virtual bool isPresentationalChildOfAriaRole() const { return false; }
     virtual bool ariaRoleHasPresentationalChildren() const { return false; }
@@ -402,7 +407,7 @@ public:
     virtual String ariaDescribedByAttribute() const { return String(); }
     virtual String accessibilityDescription() const { return String(); }
 
-    virtual AXObjectCache* axObjectCache() const { return 0; }
+    virtual AXObjectCache* axObjectCache() const;
     AXID axObjectID() const { return m_id; }
     void setAXObjectID(AXID axObjectID) { m_id = axObjectID; }
     
@@ -411,7 +416,7 @@ public:
     virtual Element* actionElement() const { return 0; }
     virtual IntRect boundingBoxRect() const { return IntRect(); }
     virtual IntRect elementRect() const = 0;
-    virtual IntSize size() const = 0;
+    virtual IntSize size() const { return elementRect().size(); }
     virtual IntPoint clickPoint() const;
 
     virtual PlainTextRange selectedTextRange() const { return PlainTextRange(); }
@@ -442,6 +447,7 @@ public:
     virtual void setSelectedText(const String&) { }
     virtual void setSelectedTextRange(const PlainTextRange&) { }
     virtual void setValue(const String&) { }
+    virtual void setValue(float) { }
     virtual void setSelected(bool) { }
     virtual void setSelectedRows(AccessibilityChildrenVector&) { }
     
@@ -459,7 +465,7 @@ public:
     virtual void addChildren() { }
     virtual bool canHaveChildren() const { return true; }
     virtual bool hasChildren() const { return m_haveChildren; }
-    virtual void updateChildrenIfNecessary() { }
+    virtual void updateChildrenIfNecessary();
     virtual void selectedChildren(AccessibilityChildrenVector&) { }
     virtual void visibleChildren(AccessibilityChildrenVector&) { }
     virtual void tabChildren(AccessibilityChildrenVector&) { }
index 003acda..b81a83f 100644 (file)
@@ -434,7 +434,15 @@ AccessibilityObject* AccessibilityRenderObject::parentObject() const
             return parent;
     }
     
-    return axObjectCache()->getOrCreate(renderParentObject());
+    RenderObject* parentObj = renderParentObject();
+    if (parentObj)
+        return axObjectCache()->getOrCreate(parentObj);
+    
+    // WebArea's parent should be the scroll view containing it.
+    if (isWebArea())
+        return axObjectCache()->getOrCreate(m_renderer->frame()->view());
+    
+    return 0;
 }
 
 bool AccessibilityRenderObject::isWebArea() const
@@ -2316,12 +2324,6 @@ Widget* AccessibilityRenderObject::widget() const
     return toRenderWidget(m_renderer)->widget();
 }
 
-AXObjectCache* AccessibilityRenderObject::axObjectCache() const
-{
-    ASSERT(m_renderer);
-    return m_renderer->document()->axObjectCache();
-}
-
 AccessibilityObject* AccessibilityRenderObject::accessibilityParentForImageMap(HTMLMapElement* map) const
 {
     // find an image that is using this map
@@ -2739,8 +2741,7 @@ AccessibilityObject* AccessibilityRenderObject::accessibilityHitTest(const IntPo
     
     RenderLayer* layer = toRenderBox(m_renderer)->layer();
      
-    HitTestRequest request(HitTestRequest::ReadOnly |
-                           HitTestRequest::Active);
+    HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active);
     HitTestResult hitTestResult = HitTestResult(point);
     layer->hitTest(request, hitTestResult);
     if (!hitTestResult.innerNode())
@@ -2775,15 +2776,6 @@ AccessibilityObject* AccessibilityRenderObject::accessibilityHitTest(const IntPo
     return result;
 }
 
-AccessibilityObject* AccessibilityRenderObject::focusedUIElement() const
-{
-    Page* page = m_renderer->document()->page();
-    if (!page)
-        return 0;
-
-    return AXObjectCache::focusedUIElementForPage(page);
-}
-
 bool AccessibilityRenderObject::shouldFocusActiveDescendant() const
 {
     switch (ariaRoleAttribute()) {
@@ -3315,8 +3307,7 @@ void AccessibilityRenderObject::updateChildrenIfNecessary()
     if (needsToUpdateChildren())
         clearChildren();        
     
-    if (!hasChildren())
-        addChildren();    
+    AccessibilityObject::updateChildrenIfNecessary();
 }
     
 const AccessibilityObject::AccessibilityChildrenVector& AccessibilityRenderObject::children()
@@ -3355,6 +3346,13 @@ void AccessibilityRenderObject::addChildren()
         }
     }
     
+    // FrameView's need to be inserted into the AX hierarchy when encountered.
+    if (isAttachment()) {
+        Widget* widget = widgetForAttachmentView();
+        if (widget && widget->isFrameView())
+            m_children.append(axObjectCache()->getOrCreate(widget));
+    }
+    
     // for a RenderImage, add the <area> elements as individual accessibility objects
     RenderBoxModelObject* cssBox = renderBoxModelObject();
     if (cssBox && cssBox->isRenderImage()) {
index a83ac35..ff7dbfc 100644 (file)
@@ -126,7 +126,6 @@ public:
     virtual int layoutCount() const;
     virtual double estimatedLoadingProgress() const;
     
-    virtual AccessibilityObject* focusedUIElement() const;
     virtual AccessibilityObject* firstChild() const;
     virtual AccessibilityObject* lastChild() const;
     virtual AccessibilityObject* previousSibling() const;
@@ -147,8 +146,6 @@ public:
     virtual bool ariaRoleHasPresentationalChildren() const;
     void updateAccessibilityRole();
     
-    virtual AXObjectCache* axObjectCache() const;
-
     // Should be called on the root accessibility object to kick off a hit test.
     virtual AccessibilityObject* accessibilityHitTest(const IntPoint&) const;
 
@@ -290,7 +287,7 @@ private:
     void addRadioButtonGroupMembers(AccessibilityChildrenVector& linkedUIElements) const;
     AccessibilityObject* internalLinkElement() const;
     AccessibilityObject* accessibilityImageMapHitTest(HTMLAreaElement*, const IntPoint&) const;
-    AccessibilityObject* accessibilityParentForImageMap(HTMLMapElement* map) const;
+    AccessibilityObject* accessibilityParentForImageMap(HTMLMapElement*) const;
     bool renderObjectIsObservable(RenderObject*) const;
     RenderObject* renderParentObject() const;
     
@@ -300,7 +297,7 @@ private:
     void setElementAttributeValue(const QualifiedName&, bool);
     
     String accessibilityDescriptionForElements(Vector<Element*> &elements) const;
-    void elementsFromAttribute(Vector<Element*>& elements, const QualifiedName& name) const;
+    void elementsFromAttribute(Vector<Element*>& elements, const QualifiedName&) const;
     String ariaAccessibilityDescription() const;
     
     virtual ESpeak speakProperty() const;
diff --git a/WebCore/accessibility/AccessibilityScrollView.cpp b/WebCore/accessibility/AccessibilityScrollView.cpp
new file mode 100644 (file)
index 0000000..c9dcbb6
--- /dev/null
@@ -0,0 +1,165 @@
+/*
+ * 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 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 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.
+ */
+
+#include "config.h"
+#include "AccessibilityScrollView.h"
+
+#include "AXObjectCache.h"
+#include "AccessibilityScrollbar.h"
+#include "FrameView.h"
+#include "HTMLFrameOwnerElement.h"
+#include "RenderPart.h"
+#include "ScrollView.h"
+
+namespace WebCore {
+    
+AccessibilityScrollView::AccessibilityScrollView(ScrollView* view)
+    : m_scrollView(view)
+{
+}
+
+PassRefPtr<AccessibilityScrollView> AccessibilityScrollView::create(ScrollView* view)
+{
+    return adoptRef(new AccessibilityScrollView(view));
+}
+    
+AccessibilityObject* AccessibilityScrollView::scrollBar(AccessibilityOrientation orientation) const
+{
+    switch (orientation) {
+    case AccessibilityOrientationVertical:
+        return m_verticalScrollbar ? m_verticalScrollbar.get() : 0;
+    case AccessibilityOrientationHorizontal:
+        return m_horizontalScrollbar ? m_horizontalScrollbar.get() : 0;
+    }
+    
+    return 0;
+}
+
+const AccessibilityObject::AccessibilityChildrenVector& AccessibilityScrollView::children()
+{
+    if (!m_haveChildren)
+        addChildren();
+    return m_children;
+}
+    
+void AccessibilityScrollView::updateChildrenIfNecessary()
+{
+    if (m_scrollView->horizontalScrollbar() && !m_horizontalScrollbar)
+        m_horizontalScrollbar = addChildScrollbar(m_scrollView->horizontalScrollbar());
+    else if (!m_scrollView->horizontalScrollbar() && m_horizontalScrollbar) {
+        removeChildScrollbar(m_horizontalScrollbar.get());
+        m_horizontalScrollbar = 0;
+    }
+
+    if (m_scrollView->verticalScrollbar() && !m_verticalScrollbar)
+        m_verticalScrollbar = addChildScrollbar(m_scrollView->verticalScrollbar());
+    else if (!m_scrollView->verticalScrollbar() && m_verticalScrollbar) {
+        removeChildScrollbar(m_verticalScrollbar.get());
+        m_verticalScrollbar = 0;
+    }
+}
+    
+void AccessibilityScrollView::removeChildScrollbar(AccessibilityObject* scrollbar)
+{
+    size_t pos = m_children.find(scrollbar);
+    if (pos != WTF::notFound)
+        m_children.remove(pos);
+}
+    
+AccessibilityScrollbar* AccessibilityScrollView::addChildScrollbar(Scrollbar* scrollbar)
+{
+    if (!scrollbar)
+        return 0;
+    
+    AccessibilityScrollbar* scrollBarObject = static_cast<AccessibilityScrollbar*>(axObjectCache()->getOrCreate(scrollbar));
+    scrollBarObject->setParent(this);
+    m_children.append(scrollBarObject);
+    return scrollBarObject;
+}
+        
+void AccessibilityScrollView::addChildren()
+{
+    ASSERT(!m_haveChildren);
+    m_haveChildren = true;
+    
+    AccessibilityObject* webArea = webAreaObject();
+    if (webArea)
+        m_children.append(webArea);
+    
+    updateChildrenIfNecessary();
+}
+
+AccessibilityObject* AccessibilityScrollView::webAreaObject() const
+{
+    if (!m_scrollView->isFrameView())
+        return 0;
+    
+    Document* doc = static_cast<FrameView*>(m_scrollView.get())->frame()->document();
+    if (!doc || !doc->renderer())
+        return 0;
+
+    return axObjectCache()->getOrCreate(doc->renderer());
+}
+
+AccessibilityObject* AccessibilityScrollView::accessibilityHitTest(const IntPoint& point) const
+{
+    AccessibilityObject* webArea = webAreaObject();
+    if (!webArea)
+        return 0;
+    
+    if (m_horizontalScrollbar && m_horizontalScrollbar->elementRect().contains(point))
+        return m_horizontalScrollbar.get();
+    if (m_verticalScrollbar && m_verticalScrollbar->elementRect().contains(point))
+        return m_verticalScrollbar.get();
+    
+    return webArea->accessibilityHitTest(point);
+}
+    
+Document* AccessibilityScrollView::document() const
+{
+    if (!m_scrollView->isFrameView())
+        return 0;
+    
+    return static_cast<FrameView*>(m_scrollView.get())->frame()->document();
+}
+
+IntRect AccessibilityScrollView::elementRect() const
+{
+    return m_scrollView->frameRect();
+}
+
+AccessibilityObject* AccessibilityScrollView::parentObject() const
+{
+    if (!m_scrollView->isFrameView())
+        return 0;
+    
+    HTMLFrameOwnerElement* owner = static_cast<FrameView*>(m_scrollView.get())->frame()->ownerElement();
+    if (owner && owner->renderPart())
+        return axObjectCache()->getOrCreate(owner->renderPart()->parent());
+    
+    return 0;
+}
+    
+} // namespace WebCore    
diff --git a/WebCore/accessibility/AccessibilityScrollView.h b/WebCore/accessibility/AccessibilityScrollView.h
new file mode 100644 (file)
index 0000000..e32cd1c
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * 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 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 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 AccessibilityScrollView_h
+#define AccessibilityScrollView_h
+
+#include "AccessibilityObject.h"
+
+namespace WebCore {
+    
+class AccessibilityScrollbar;
+class Scrollbar;
+class ScrollView;
+    
+class AccessibilityScrollView : public AccessibilityObject {
+public:
+    static PassRefPtr<AccessibilityScrollView> create(ScrollView*);    
+    virtual AccessibilityRole roleValue() const { return ScrollAreaRole; }
+    ScrollView* scrollView() const { return m_scrollView.get(); }
+    
+private:
+    AccessibilityScrollView(ScrollView*);
+    
+    virtual bool accessibilityIsIgnored() const { return false; }
+    virtual bool isAccessibilityScrollView() const { return true; }
+    virtual AccessibilityObject* scrollBar(AccessibilityOrientation) const;
+    virtual void addChildren();
+    virtual Document* document() const;
+    virtual AccessibilityObject* accessibilityHitTest(const IntPoint&) const;
+    virtual const AccessibilityChildrenVector& children();
+    virtual void updateChildrenIfNecessary();
+    
+    virtual IntRect elementRect() const;
+    virtual AccessibilityObject* parentObject() const;
+    
+    AccessibilityObject* webAreaObject() const;
+    AccessibilityScrollbar* addChildScrollbar(Scrollbar*);
+    void removeChildScrollbar(AccessibilityObject*);
+    
+    RefPtr<ScrollView> m_scrollView;
+    RefPtr<AccessibilityObject> m_horizontalScrollbar;
+    RefPtr<AccessibilityObject> m_verticalScrollbar;
+};
+
+inline AccessibilityScrollView* toAccessibilityScrollView(AccessibilityObject* object)
+{
+    ASSERT(!object || object->isAccessibilityScrollView());
+    if (!object->isAccessibilityScrollView())
+        return 0;
+    
+    return static_cast<AccessibilityScrollView*>(object);
+}
+    
+} // namespace WebCore
+
+#endif // AccessibilityScrollView_h
+
index 717d0da..865797a 100644 (file)
 #include "config.h"
 #include "AccessibilityScrollbar.h"
 
+#include "AXObjectCache.h"
+#include "FrameView.h"
+#include "ScrollView.h"
 #include "Scrollbar.h"
 
 namespace WebCore {
 
-AccessibilityScrollbar::AccessibilityScrollbar()
-    : m_scrollbar(0)
+AccessibilityScrollbar::AccessibilityScrollbar(Scrollbar* scrollbar)
+    : m_scrollbar(scrollbar)
+    , m_parent(0)
 {
+    ASSERT(scrollbar);
 }
 
-PassRefPtr<AccessibilityScrollbar> AccessibilityScrollbar::create()
+PassRefPtr<AccessibilityScrollbar> AccessibilityScrollbar::create(Scrollbar* scrollbar)
 {
-    return adoptRef(new AccessibilityScrollbar);
+    return adoptRef(new AccessibilityScrollbar(scrollbar));
 }
+    
+IntRect AccessibilityScrollbar::elementRect() const
+{
+    if (!m_scrollbar)
+        return IntRect();
+    
+    return m_scrollbar->frameRect();
+}
+    
+Document* AccessibilityScrollbar::document() const
+{
+    AccessibilityObject* parent = parentObject();
+    if (!parent)
+        return 0;
+    return parent->document();
+}
+
+AccessibilityOrientation AccessibilityScrollbar::orientation() const
+{
+    if (!m_scrollbar)
+        return AccessibilityOrientationHorizontal;
+
+    if (m_scrollbar->orientation() == HorizontalScrollbar)
+        return AccessibilityOrientationHorizontal;
+    if (m_scrollbar->orientation() == VerticalScrollbar)
+        return AccessibilityOrientationVertical;
 
+    return AccessibilityOrientationHorizontal;
+}
+
+bool AccessibilityScrollbar::isEnabled() const
+{
+    if (!m_scrollbar)
+        return false;
+    return m_scrollbar->enabled();
+}
+    
 float AccessibilityScrollbar::valueForRange() const
 {
     if (!m_scrollbar)
         return 0;
-    return m_scrollbar->currentPos();
+
+    return m_scrollbar->currentPos() / m_scrollbar->maximum();
 }
 
+void AccessibilityScrollbar::setValue(float value)
+{
+    if (!m_scrollbar)
+        return;
+    
+    float newValue = value * m_scrollbar->maximum();
+    
+    m_scrollbar->setValue(newValue, Scrollbar::NotFromScrollAnimator);    
+}
+    
 } // namespace WebCore
index 7d78b52..3268347 100644 (file)
@@ -37,30 +37,34 @@ class Scrollbar;
 
 class AccessibilityScrollbar : public AccessibilityObject {
 public:
-    static PassRefPtr<AccessibilityScrollbar> create();
-
-    void setScrollbar(Scrollbar* scrollbar) { m_scrollbar = scrollbar; }
+    static PassRefPtr<AccessibilityScrollbar> create(Scrollbar*);
 
     Scrollbar* scrollbar() const { return m_scrollbar.get(); }
-
-    virtual bool isAccessibilityScrollbar() const { return true; }
-
-    virtual AccessibilityRole roleValue() const { return ScrollBarRole; }
-
-    virtual float valueForRange() const;
-
+    void setParent(AccessibilityObject* parent) { m_parent = parent; }
+    
 private:
-    AccessibilityScrollbar();
+    AccessibilityScrollbar(Scrollbar*);
 
     virtual bool accessibilityIsIgnored() const { return false; }
+    virtual bool canSetValueAttribute() const { return true; }
+    virtual bool canSetNumericValue() const { return true; }
 
-    // These should never be reached since the AccessibilityScrollbar is not part of
-    // the accessibility tree.
-    virtual IntSize size() const { ASSERT_NOT_REACHED(); return IntSize(); }
-    virtual IntRect elementRect() const { ASSERT_NOT_REACHED(); return IntRect(); }
-    virtual AccessibilityObject* parentObject() const { ASSERT_NOT_REACHED(); return 0; }
+    virtual bool isAccessibilityScrollbar() const { return true; }
+    virtual AccessibilityObject* parentObject() const { return m_parent; }
+    virtual IntRect elementRect() const;
+    
+    virtual AccessibilityRole roleValue() const { return ScrollBarRole; }
+    virtual AccessibilityOrientation orientation() const;
+    virtual Document* document() const;
+    virtual bool isEnabled() const;
+    
+    // Assumes float [0..1]
+    virtual void setValue(float);
+    virtual float valueForRange() const;
 
     RefPtr<Scrollbar> m_scrollbar;
+    AccessibilityOrientation m_orientation;
+    AccessibilityObject* m_parent;
 };
 
 } // namespace WebCore
index 1076972..5c3ee39 100644 (file)
 #if HAVE(ACCESSIBILITY)
 
 #import "AccessibilityObjectWrapper.h"
+#import "Widget.h"
 
 namespace WebCore {
 
 bool AccessibilityObject::accessibilityIgnoreAttachment() const
 {
-    NSView* attachment = [wrapper() attachmentView];
-    if (!attachment)
+    // FrameView attachments are now handled by AccessibilityScrollView, 
+    // so if this is the attachment, it should be ignored.
+    Widget* widget = 0;
+    if (isAttachment() && (widget = widgetForAttachmentView()) && widget->isFrameView())
         return true;
+
+    if ([wrapper() attachmentView])
+        return [[wrapper() attachmentView] accessibilityIsIgnored];
     
-    return [attachment accessibilityIsIgnored];
+    // Attachments are ignored by default (unless we determine that we should expose them).
+    return true;
 }
 
 AccessibilityObjectInclusion AccessibilityObject::accessibilityPlatformIncludesObject() const
index d1d613c..fa9cb86 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -36,6 +36,7 @@
 #import "AccessibilityListBox.h"
 #import "AccessibilityList.h"
 #import "AccessibilityRenderObject.h"
+#import "AccessibilityScrollView.h"
 #import "AccessibilityTable.h"
 #import "AccessibilityTableCell.h"
 #import "AccessibilityTableRow.h"
@@ -43,6 +44,7 @@
 #import "ColorMac.h"
 #import "EditorClient.h"
 #import "Frame.h"
+#import "FrameLoaderClient.h"
 #import "HTMLAnchorElement.h"
 #import "HTMLAreaElement.h"
 #import "HTMLFrameOwnerElement.h"
@@ -53,6 +55,7 @@
 #import "RenderTextControl.h"
 #import "RenderView.h"
 #import "RenderWidget.h"
+#import "ScrollView.h"
 #import "SelectionController.h"
 #import "SimpleFontData.h"
 #import "TextIterator.h"
@@ -704,6 +707,7 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(AXObjectCache
     static NSArray* outlineAttrs = nil;
     static NSArray* outlineRowAttrs = nil;
     static NSArray* buttonAttrs = nil;
+    static NSArray* scrollViewAttrs = nil;
     NSMutableArray* tempArray;
     if (attributes == nil) {
         attributes = [[NSArray alloc] initWithObjects: NSAccessibilityRoleAttribute,
@@ -944,6 +948,14 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(AXObjectCache
         outlineRowAttrs = [[NSArray alloc] initWithArray:tempArray];
         [tempArray release];
     }
+    if (scrollViewAttrs == nil) {
+        tempArray = [[NSMutableArray alloc] initWithArray:attributes];
+        [tempArray addObject:NSAccessibilityContentsAttribute];
+        [tempArray addObject:NSAccessibilityHorizontalScrollBarAttribute];
+        [tempArray addObject:NSAccessibilityVerticalScrollBarAttribute];
+        scrollViewAttrs = [[NSArray alloc] initWithArray:tempArray];
+        [tempArray release];
+    }
     
     NSArray *objectAttributes = attributes;
     
@@ -1001,6 +1013,8 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(AXObjectCache
         objectAttributes = groupAttrs;
     else if (m_object->isTabList())
         objectAttributes = tabListAttrs;
+    else if (m_object->isScrollView())
+        objectAttributes = scrollViewAttrs;
     
     else if (m_object->isMenu())
         objectAttributes = menuAttrs;
@@ -1010,7 +1024,7 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(AXObjectCache
         objectAttributes = menuButtonAttrs;
     else if (m_object->isMenuItem())
         objectAttributes = menuItemAttrs;
-
+    
     NSArray *additionalAttributes = [self additionalAccessibilityAttributeNames];
     if ([additionalAttributes count])
         objectAttributes = [objectAttributes arrayByAddingObjectsFromArray:additionalAttributes];
@@ -1034,6 +1048,14 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(AXObjectCache
     return [(widget->platformWidget()) accessibilityAttributeValue: NSAccessibilityChildrenAttribute];
 }
 
+- (id)remoteAccessibilityParentObject
+{
+    if (!m_object || !m_object->document())
+        return nil;
+    
+    return m_object->document()->frame()->loader()->client()->accessibilityRemoteObject();
+}
+
 static void convertToVector(NSArray* array, AccessibilityObject::AccessibilityChildrenVector& vector)
 {
     unsigned length = [array count];
@@ -1075,16 +1097,40 @@ static NSMutableArray* convertToNSArray(const AccessibilityObject::Accessibility
 - (NSValue*)position
 {
     IntRect rect = m_object->elementRect();
+    NSPoint point;
     
-    // The Cocoa accessibility API wants the lower-left corner.
-    NSPoint point = NSMakePoint(rect.x(), rect.bottom());
     FrameView* frameView = m_object->documentFrameView();
-    if (frameView) {
-        NSView* view = frameView->documentView();
-        point = [[view window] convertBaseToScreen: [view convertPoint: point toView:nil]];
+    id remoteParent = [self remoteAccessibilityParentObject];
+    if (remoteParent) {
+        point = NSMakePoint(rect.x(), rect.y());
+        
+        NSPoint remotePosition = [[remoteParent accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue];
+        NSSize remoteSize = [[remoteParent 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 screens] objectAtIndex:0] frame].size.height;
+        remotePosition.y = (screenHeight - remotePosition.y) - remoteSize.height;
+        
+        NSPoint scrollPosition = NSMakePoint(0, 0);
+        if (frameView && !m_object->isScrollbar() && !m_object->isScrollView()) {
+            IntPoint frameScrollPos = frameView->scrollPosition();
+            scrollPosition = NSMakePoint(frameScrollPos.x(), frameScrollPos.y());
+        }
+        
+        point.x += remotePosition.x - scrollPosition.x;
+        // Set the new position, which means getting bottom y, and then flipping to screen coordinates.
+        point.y = screenHeight - (point.y + remotePosition.y + rect.height() - scrollPosition.y);
+    } else {
+        // The Cocoa accessibility API wants the lower-left corner.
+        point = NSMakePoint(rect.x(), rect.bottom());
+        
+        if (frameView) {
+            NSView* view = frameView->documentView();
+            point = [[view window] convertBaseToScreen:[view convertPoint: point toView:nil]];
+        }
     }
 
-    return [NSValue valueWithPoint: point];
+    return [NSValue valueWithPoint:point];
 }
 
 typedef HashMap<int, NSString*> AccessibilityRoleMap;
@@ -1390,6 +1436,27 @@ static NSString* roleValueToNSString(AccessibilityRole value)
     return NSAccessibilityRoleDescription(NSAccessibilityUnknownRole, nil);
 }
 
+- (id)scrollViewParent
+{
+    if (!m_object || !m_object->isAccessibilityScrollView())
+        return nil;
+    
+    // If this scroll view provides it's parent object (because it's a sub-frame), then
+    // we should not find the remoteAccessibilityParent.
+    if (m_object->parentObject())
+        return nil;
+    
+    AccessibilityScrollView* scrollView = toAccessibilityScrollView(m_object);
+    ScrollView* scroll = scrollView->scrollView();
+    if (!scroll)
+        return nil;
+    
+    if (scroll->platformWidget())
+        return scroll->platformWidget();
+
+    return [self remoteAccessibilityParentObject];
+}
+
 // FIXME: split up this function in a better way.  
 // suggestions: Use a hash table that maps attribute names to function calls,
 // or maybe pointers to member functions
@@ -1408,11 +1475,11 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         return [self roleDescription];
 
     if ([attributeName isEqualToString: NSAccessibilityParentAttribute]) {
-        if (m_object->isAccessibilityRenderObject()) {
-            FrameView* fv = static_cast<AccessibilityRenderObject*>(m_object)->frameViewIfRenderView();
-            if (fv)
-                return fv->platformWidget();
-        }
+
+        // This will return the parent of the AXWebArea, if this is a web area.
+        id scrollViewParent = [self scrollViewParent];
+        if (scrollViewParent)
+            return scrollViewParent;
         
         // Tree item (changed to AXRows) can only report the tree (AXOutline) as its parent.
         if (m_object->isTreeItem()) {
@@ -1424,7 +1491,10 @@ static NSString* roleValueToNSString(AccessibilityRole value)
             }
         }
         
-        return m_object->parentObjectUnignored()->wrapper();
+        AccessibilityObject* parent = m_object->parentObjectUnignored();
+        if (parent)
+            return parent->wrapper();
+        return nil;
     }
 
     if ([attributeName isEqualToString: NSAccessibilityChildrenAttribute]) {
@@ -1613,6 +1683,11 @@ static NSString* roleValueToNSString(AccessibilityRole value)
 
     if ([attributeName isEqualToString: NSAccessibilityWindowAttribute] ||
         [attributeName isEqualToString: NSAccessibilityTopLevelUIElementAttribute]) {
+        
+        id remoteParent = [self remoteAccessibilityParentObject];
+        if (remoteParent)
+            return [remoteParent accessibilityAttributeValue:attributeName];
+        
         FrameView* fv = m_object->documentFrameView();
         if (fv)
             return [fv->platformWidget() window];
@@ -1648,6 +1723,17 @@ static NSString* roleValueToNSString(AccessibilityRole value)
                     contents.append(children[k]);
             }
             return convertToNSArray(contents);
+        } else if (m_object->isScrollView()) {
+            AccessibilityObject::AccessibilityChildrenVector children = m_object->children();
+            
+            // A scrollView's contents are everything except the scroll bars.
+            AccessibilityObject::AccessibilityChildrenVector contents;
+            unsigned childrenSize = children.size();
+            for (unsigned k = 0; k < childrenSize; ++k) {
+                if (!children[k]->isScrollbar())
+                    contents.append(children[k]);
+            }
+            return convertToNSArray(contents);            
         }
     }    
     
@@ -1874,6 +1960,19 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         return nil;
     }
     
+    if ([attributeName isEqualToString:NSAccessibilityHorizontalScrollBarAttribute]) {
+        AccessibilityObject* scrollBar = m_object->scrollBar(AccessibilityOrientationHorizontal);
+        if (scrollBar)
+            return scrollBar->wrapper();
+        return nil;
+    }
+    if ([attributeName isEqualToString:NSAccessibilityVerticalScrollBarAttribute]) {
+        AccessibilityObject* scrollBar = m_object->scrollBar(AccessibilityOrientationVertical);
+        if (scrollBar)
+            return scrollBar->wrapper();
+        return nil;
+    }
+    
     if ([attributeName isEqualToString:NSAccessibilityLanguageAttribute]) 
         return m_object->language();
     
@@ -1967,6 +2066,7 @@ static NSString* roleValueToNSString(AccessibilityRole value)
     if (![self updateObjectBackingStore])
         return nil;
 
+    m_object->updateChildrenIfNecessary();
     RefPtr<AccessibilityObject> axObject = m_object->accessibilityHitTest(IntPoint(point));
     if (axObject)
         return NSAccessibilityUnignoredAncestor(axObject->wrapper());
@@ -2239,9 +2339,10 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         ASSERT(number);
         m_object->setFocused([number intValue] != 0);
     } else if ([attributeName isEqualToString: NSAccessibilityValueAttribute]) {
-        if (!string)
-            return;
-        m_object->setValue(string);
+        if (number && m_object->canSetNumericValue())
+            m_object->setValue([number floatValue]);
+        else if (string)
+            m_object->setValue(string);
     } else if ([attributeName isEqualToString: NSAccessibilitySelectedAttribute]) {
         if (!number)
             return;
index 76b0a4f..0182fe5 100644 (file)
@@ -1915,7 +1915,7 @@ AXObjectCache* Document::axObjectCache() const
         return doc->axObjectCache();
     
     // this is the top-level document, so install a new cache
-    m_axObjectCache = new AXObjectCache;
+    m_axObjectCache = new AXObjectCache(this);
     return m_axObjectCache;
 }
 
index 560ea91..5c4810e 100644 (file)
@@ -377,6 +377,7 @@ public:
 #endif
 
 #if PLATFORM(MAC)
+    virtual RemoteAXObjectRef accessibilityRemoteObject() { return 0; }
     virtual NSCachedURLResponse* willCacheResponse(DocumentLoader*, unsigned long, NSCachedURLResponse* response) const { return response; }
 #endif
 #if USE(CFNETWORK)
index cfec872..a422c7d 100644 (file)
 #include <wtf/Forward.h>
 #include <wtf/Vector.h>
 
+#if PLATFORM(MAC)
+#ifdef __OBJC__ 
+#import <Foundation/Foundation.h>
+typedef id RemoteAXObjectRef;
+#else
+typedef void* RemoteAXObjectRef;
+#endif
+#endif
+
 typedef class _jobject* jobject;
 
 #if PLATFORM(MAC) && !defined(__OBJC__)
@@ -265,6 +274,8 @@ namespace WebCore {
         virtual void registerForIconNotification(bool listen = true) = 0;
         
 #if PLATFORM(MAC)
+        // Allow an accessibility object to retrieve a Frame parent if there's no PlatformWidget.
+        virtual RemoteAXObjectRef accessibilityRemoteObject() = 0;
 #if ENABLE(JAVA_BRIDGE)
         virtual jobject javaApplet(NSView*) { return 0; }
 #endif
index 66ea9c7..e3e222e 100644 (file)
@@ -161,7 +161,10 @@ FrameView::~FrameView()
         m_scheduledEvents.clear();
         m_enqueueEvents = 0;
     }
-
+    
+    if (AXObjectCache::accessibilityEnabled() && axObjectCache())
+        axObjectCache()->remove(this);
+    
     resetScrollbars();
 
     // Custom scrollbars should already be destroyed at this point
@@ -2482,4 +2485,9 @@ void FrameView::notifyWidgetsInAllFrames(WidgetNotification notification)
     }
 }
     
+AXObjectCache* FrameView::axObjectCache() const
+{
+    return frame()->document()->axObjectCacheExists() ? frame()->document()->axObjectCache() : 0;
+}
+    
 } // namespace WebCore
index 1712a3e..a2f5815 100644 (file)
@@ -308,6 +308,7 @@ private:
     virtual void updateScrollCorner();
     virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect);
 
+    virtual AXObjectCache* axObjectCache() const;
     void notifyWidgetsInAllFrames(WidgetNotification);
     
     static double sCurrentPaintTimeStamp; // used for detecting decoded resource thrash in the cache
index 57a5918..6cf13a4 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "ScrollView.h"
 
+#include "AXObjectCache.h"
 #include "GraphicsContext.h"
 #include "HostWindow.h"
 #include "PlatformMouseEvent.h"
@@ -96,6 +97,9 @@ void ScrollView::setHasHorizontalScrollbar(bool hasBar)
         removeChild(m_horizontalScrollbar.get());
         m_horizontalScrollbar = 0;
     }
+    
+    if (AXObjectCache::accessibilityEnabled() && axObjectCache())
+        axObjectCache()->handleScrollbarUpdate(this);
 }
 
 void ScrollView::setHasVerticalScrollbar(bool hasBar)
@@ -111,6 +115,9 @@ void ScrollView::setHasVerticalScrollbar(bool hasBar)
         removeChild(m_verticalScrollbar.get());
         m_verticalScrollbar = 0;
     }
+    
+    if (AXObjectCache::accessibilityEnabled() && axObjectCache())
+        axObjectCache()->handleScrollbarUpdate(this);
 }
 
 #if !PLATFORM(GTK)
index 72f0639..7fd2651 100644 (file)
@@ -96,6 +96,9 @@ Scrollbar::Scrollbar(ScrollbarClient* client, ScrollbarOrientation orientation,
 
 Scrollbar::~Scrollbar()
 {
+    if (AXObjectCache::accessibilityEnabled() && axObjectCache())
+        axObjectCache()->remove(this);
+    
     stopTimerIfNeeded();
     
     m_theme->unregisterScrollbar(this);
@@ -131,15 +134,8 @@ void Scrollbar::setSteps(int lineStep, int pageStep, int pixelsPerStep)
 bool Scrollbar::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier)
 {
 #if HAVE(ACCESSIBILITY)
-    if (AXObjectCache::accessibilityEnabled()) {
-        if (parent() && parent()->isFrameView()) {
-            Document* document = static_cast<FrameView*>(parent())->frame()->document();
-            AXObjectCache* cache = document->axObjectCache();
-            AccessibilityScrollbar* axObject = static_cast<AccessibilityScrollbar*>(cache->getOrCreate(ScrollBarRole));
-            axObject->setScrollbar(this);
-            cache->postNotification(axObject, document, AXObjectCache::AXValueChanged, true);
-        }
-    }
+    if (AXObjectCache::accessibilityEnabled() && axObjectCache())
+        axObjectCache()->postNotification(axObjectCache()->getOrCreate(this), 0, AXObjectCache::AXValueChanged, true);
 #endif
 
     // Ignore perpendicular scrolls.
@@ -475,7 +471,16 @@ bool Scrollbar::isWindowActive() const
 {
     return m_client && m_client->isActive();
 }
+    
+AXObjectCache* Scrollbar::axObjectCache() const
+{
+    if (!parent() || !parent()->isFrameView())
+        return 0;
+    
+    Document* document = static_cast<FrameView*>(parent())->frame()->document();
+    return document->axObjectCache();
+}
+
 void Scrollbar::invalidateRect(const IntRect& rect)
 {
     if (suppressInvalidation())
index 276bf60..69e94a1 100644 (file)
@@ -171,6 +171,7 @@ protected:
 
 private:
     virtual bool isScrollbar() const { return true; }
+    virtual AXObjectCache* axObjectCache() const;
 
     bool setCurrentPos(float pos, ScrollSource source);
 };
index b18330b..b13ed2b 100644 (file)
@@ -103,6 +103,7 @@ typedef PlatformWidget PlatformPageClient;
 
 namespace WebCore {
 
+class AXObjectCache;
 class Cursor;
 class Event;
 class Font;
@@ -246,6 +247,9 @@ public:
     virtual IntPoint convertToContainingView(const IntPoint&) const;
     virtual IntPoint convertFromContainingView(const IntPoint&) const;
 
+    // A means to access the AX cache when this object can get a pointer to it.
+    virtual AXObjectCache* axObjectCache() const { return 0; }
+    
 private:
     void init(PlatformWidget); // Must be called by all Widget constructors to initialize cross-platform data.
 
index ce79fda..42bd698 100644 (file)
@@ -1,3 +1,17 @@
+2011-01-04  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        WK2: Support Accessibility
+        https://bugs.webkit.org/show_bug.cgi?id=51859
+
+        Use rootObject() method to get top of ax tree.
+
+        * WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
+        (DumpRenderTreeSupportGtk::getFocusedAccessibleElement):
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_get_accessible):
+
 2011-01-03  Martin Robinson  <mrobinson@igalia.com>
 
         Reviewed by Darin Adler.
index 5d8e400..d72d834 100644 (file)
@@ -425,11 +425,7 @@ AtkObject* DumpRenderTreeSupportGtk::getFocusedAccessibleElement(WebKitWebFrame*
     if (!priv->coreFrame || !priv->coreFrame->document())
         return 0;
 
-    RenderView* root = toRenderView(priv->coreFrame->document()->renderer());
-    if (!root)
-        return 0;
-
-    AtkObject* wrapper =  priv->coreFrame->document()->axObjectCache()->getOrCreate(root)->wrapper();
+    AtkObject* wrapper =  priv->coreFrame->document()->axObjectCache()->rootObject()->wrapper();
     if (!wrapper)
         return 0;
 
index cd7eed3..def41cd 100644 (file)
@@ -1452,7 +1452,7 @@ static AtkObject* webkit_web_view_get_accessible(GtkWidget* widget)
     if (!doc)
         return NULL;
 
-    AccessibilityObject* coreAccessible = doc->axObjectCache()->getOrCreate(doc->renderer());
+    AccessibilityObject* coreAccessible = doc->axObjectCache()->rootObject();
     if (!coreAccessible || !coreAccessible->wrapper())
         return NULL;
 
index ba5025d..5b212aa 100644 (file)
@@ -1,3 +1,25 @@
+2011-01-04  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        WK2: Support Accessibility
+        https://bugs.webkit.org/show_bug.cgi?id=51859
+
+        Use rootObject() method to get top of AX tree.
+
+        * WebCoreSupport/WebFrameLoaderClient.h:
+        (WebFrameLoaderClient::accessibilityRemoteObject):
+        * WebView/WebFrame.mm:
+        (-[WebFrame setAccessibleName:]):
+        (-[WebFrame accessibilityRoot]):
+        * WebView/WebFrameInternal.h:
+        * WebView/WebFramePrivate.h:
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView accessibilityAttributeValue:]):
+        (-[WebHTMLView accessibilityFocusedUIElement]):
+        (-[WebHTMLView accessibilityHitTest:]):
+        (-[WebHTMLView _accessibilityParentForSubview:]):
+
 2011-01-04  David Kilzer  <ddkilzer@apple.com>
 
         <http://webkit.org/b/51889> WebFrameLoaderClient::createMediaPlayerProxyPlugin() should use WebCore::PluginInfo.name
index b9980a4..9de4246 100644 (file)
@@ -227,6 +227,10 @@ private:
     virtual jobject javaApplet(NSView*);
 #endif
 
+#if PLATFORM(MAC)
+    virtual RemoteAXObjectRef accessibilityRemoteObject() { return 0; }
+#endif
+    
     void setOriginalURLForDownload(WebDownload *, const WebCore::ResourceRequest&) const;
 
     RetainPtr<WebFramePolicyListener> setUpPolicyListener(WebCore::FramePolicyFunction);
index 0156bab..5c2f256 100644 (file)
@@ -689,26 +689,6 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     return _private->coreFrame->view() ? _private->coreFrame->view()->needsLayout() : false;
 }
 
-- (id)_accessibilityTree
-{
-#if HAVE(ACCESSIBILITY)
-    if (!AXObjectCache::accessibilityEnabled()) {
-        AXObjectCache::enableAccessibility();
-        if ([[NSApp accessibilityAttributeValue:NSAccessibilityEnhancedUserInterfaceAttribute] boolValue])
-            AXObjectCache::enableEnhancedUserInterfaceAccessibility();
-    }
-
-    if (!_private->coreFrame || !_private->coreFrame->document())
-        return nil;
-    RenderView* root = toRenderView(_private->coreFrame->document()->renderer());
-    if (!root)
-        return nil;
-    return _private->coreFrame->document()->axObjectCache()->getOrCreate(root)->wrapper();
-#else
-    return nil;
-#endif
-}
-
 - (DOMRange *)_rangeByAlteringCurrentSelection:(SelectionController::EAlteration)alteration direction:(SelectionDirection)direction granularity:(TextGranularity)granularity
 {
     if (_private->coreFrame->selection()->isNone())
@@ -1339,13 +1319,14 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     if (!AXObjectCache::accessibilityEnabled())
         return;
     
-    RenderView* root = toRenderView(_private->coreFrame->document()->renderer());
-    if (!root)
+    if (!_private->coreFrame || !_private->coreFrame->document())
         return;
     
-    AccessibilityObject* rootObject = _private->coreFrame->document()->axObjectCache()->getOrCreate(root);
-    String strName(name);
-    rootObject->setAccessibleName(strName);
+    AccessibilityObject* rootObject = _private->coreFrame->document()->axObjectCache()->rootObject();
+    if (rootObject) {
+        String strName(name);
+        rootObject->setAccessibleName(strName);
+    }
 #endif
 }
 
@@ -1366,6 +1347,27 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     return coreFrame->editor()->selectionStartHasSpellingMarkerFor(from, length);
 }
 
+- (id)accessibilityRoot
+{
+#if HAVE(ACCESSIBILITY)
+    if (!AXObjectCache::accessibilityEnabled()) {
+        AXObjectCache::enableAccessibility();
+        if ([[NSApp accessibilityAttributeValue:NSAccessibilityEnhancedUserInterfaceAttribute] boolValue])
+            AXObjectCache::enableEnhancedUserInterfaceAccessibility();
+    }
+    
+    if (!_private->coreFrame || !_private->coreFrame->document())
+        return nil;
+    
+    AccessibilityObject* rootObject = _private->coreFrame->document()->axObjectCache()->rootObject();
+    if (rootObject)
+        return rootObject->wrapper();
+    return nil;
+#else
+    return nil;
+#endif
+}
+
 @end
 
 @implementation WebFrame
index 28e3d07..7ff5e75 100644 (file)
@@ -138,8 +138,6 @@ WebView *getWebView(WebFrame *webFrame);
 - (NSRect)_firstRectForDOMRange:(DOMRange *)range;
 - (void)_scrollDOMRangeToVisible:(DOMRange *)range;
 
-- (id)_accessibilityTree;
-
 - (DOMRange *)_rangeByAlteringCurrentSelection:(WebCore::SelectionController::EAlteration)alteration direction:(WebCore::SelectionDirection)direction granularity:(WebCore::TextGranularity)granularity;
 - (NSRange)_convertToNSRange:(WebCore::Range*)range;
 - (DOMRange *)_convertNSRangeToDOMRange:(NSRange)range;
index b0cb0f3..ddfa5cc 100644 (file)
@@ -142,4 +142,7 @@ typedef enum {
 // Returns whether there is a spelling marker in the specified range of the focused node.
 - (BOOL)hasSpellingMarker:(int)location length:(int)length;
 
+// The top of the accessibility tree.
+- (id)accessibilityRoot;
+
 @end
index 54f0a45..093f3db 100644 (file)
@@ -4274,7 +4274,7 @@ static BOOL isInPasswordField(Frame* coreFrame)
 - (id)accessibilityAttributeValue:(NSString*)attributeName
 {
     if ([attributeName isEqualToString: NSAccessibilityChildrenAttribute]) {
-        id accTree = [[self _frame] _accessibilityTree];
+        id accTree = [[self _frame] accessibilityRoot];
         if (accTree)
             return [NSArray arrayWithObject:accTree];
         return nil;
@@ -4284,7 +4284,7 @@ static BOOL isInPasswordField(Frame* coreFrame)
 
 - (id)accessibilityFocusedUIElement
 {
-    id accTree = [[self _frame] _accessibilityTree];
+    id accTree = [[self _frame] accessibilityRoot];
     if (accTree)
         return [accTree accessibilityFocusedUIElement];
     return self;
@@ -4292,7 +4292,7 @@ static BOOL isInPasswordField(Frame* coreFrame)
 
 - (id)accessibilityHitTest:(NSPoint)point
 {
-    id accTree = [[self _frame] _accessibilityTree];
+    id accTree = [[self _frame] accessibilityRoot];
     if (accTree) {
         NSPoint windowCoord = [[self window] convertScreenToBase:point];
         return [accTree accessibilityHitTest:[self convertPoint:windowCoord fromView:nil]];
@@ -4302,7 +4302,7 @@ static BOOL isInPasswordField(Frame* coreFrame)
 
 - (id)_accessibilityParentForSubview:(NSView *)subview
 {
-    id accTree = [[self _frame] _accessibilityTree];
+    id accTree = [[self _frame] accessibilityRoot];
     if (!accTree)
         return self;
     id parent = [accTree _accessibilityParentForSubview:subview];
index 3b53323..e98acc1 100644 (file)
@@ -34,7 +34,7 @@ using namespace WebCore;
 
 // AccessibleDocument
 AccessibleDocument::AccessibleDocument(Document* doc)
-    : AccessibleBase(doc->axObjectCache()->getOrCreate(doc->renderer()))
+    : AccessibleBase(doc->axObjectCache()->rootObject())
 {
 }
 
index 87ee972..e04b39e 100644 (file)
@@ -1,3 +1,15 @@
+2011-01-04  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        WK2: Support Accessibility
+        https://bugs.webkit.org/show_bug.cgi?id=51859
+
+        Use rootObject() method to get the top of the AX tree.
+
+        * AccessibleDocument.cpp:
+        (AccessibleDocument::AccessibleDocument):
+
 2011-01-01  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Eric Seidel.
index ebc63ed..a51e7e3 100644 (file)
@@ -1,3 +1,72 @@
+2011-01-04  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        WK2: Support Accessibility
+        https://bugs.webkit.org/show_bug.cgi?id=51859
+
+        Implement remote accessibility API to support cross process accessibility
+        on the Mac platform.
+
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::encode):
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.h:
+        * UIProcess/API/mac/PageClientImpl.h:
+        * UIProcess/API/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::accessibilityChildTokenReceived):
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView initWithFrame:contextRef:pageGroupRef:]):
+        (-[WKView _updateWindowAndViewFrames]):
+        (-[WKView _setAccessibilityChildToken:]):
+        (-[WKView accessibilityIsIgnored]):
+        (-[WKView accessibilityHitTest:]):
+        (-[WKView accessibilityAttributeValue:]):
+        * UIProcess/API/mac/WKViewInternal.h:
+        * UIProcess/PageClient.h:
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::ensureWebProcess):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::windowAndViewFramesChanged):
+        (WebKit::WebPageProxy::didReceiveAccessibilityPageToken):
+        (WebKit::WebPageProxy::sendAccessibilityPresenterToken):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::accessibilityRemoteObject):
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::windowAndViewFramesChanged):
+        * WebProcess/WebPage/WebPage.h:
+        (WebKit::WebPage::accessibilityPosition):
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebPage/mac/AccessibilityWebPageObject.h: Added.
+        * WebProcess/WebPage/mac/AccessibilityWebPageObject.mm: Added.
+        (-[AccessibilityWebPageObject setWebPage:]):
+        (-[AccessibilityWebPageObject setRemoteParent:]):
+        (-[AccessibilityWebPageObject dealloc]):
+        (-[AccessibilityWebPageObject accessibilityIsIgnored]):
+        (-[AccessibilityWebPageObject accessibilityAttributeNames]):
+        (-[AccessibilityWebPageObject accessibilityIsAttributeSettable:]):
+        (-[AccessibilityWebPageObject accessibilitySetValue:forAttribute:]):
+        (-[AccessibilityWebPageObject accessibilityActionNames]):
+        (-[AccessibilityWebPageObject accessibilityChildren]):
+        (-[AccessibilityWebPageObject accessibilityAttributeValue:]):
+        (-[AccessibilityWebPageObject accessibilityShouldUseUniqueId]):
+        (-[AccessibilityWebPageObject accessibilityHitTest:]):
+        (-[AccessibilityWebPageObject accessibilityFocusedUIElement]):
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::platformInitialize):
+        (WebKit::WebPage::sendAccessibilityPresenterToken):
+        (WebKit::WebPage::accessibilityRemoteObject):
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::initializeWebProcess):
+        * WebProcess/WebProcess.h:
+        (WebKit::WebProcess::presenterApplicationPid):
+        * WebProcess/mac/WebProcessMainMac.mm:
+        (WebKit::WebProcessMain):
+
 2011-01-04  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Darin Adler.
index 3c770ed..d583e15 100644 (file)
@@ -56,6 +56,7 @@ void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) con
     encoder->encode(languageCode);
     encoder->encode(textCheckerState);
 #if PLATFORM(MAC)
+    encoder->encode(presenterApplicationPid);
     encoder->encode(nsURLCachePath);
     encoder->encode(nsURLCacheMemoryCapacity);
     encoder->encode(nsURLCacheDiskCapacity);
@@ -93,6 +94,8 @@ bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, Web
         return false;
 
 #if PLATFORM(MAC)
+    if (!decoder->decode(parameters.presenterApplicationPid))
+        return false;
     if (!decoder->decode(parameters.nsURLCachePath))
         return false;
     if (!decoder->decode(parameters.nsURLCacheMemoryCapacity))
index 194db75..754aaa6 100644 (file)
@@ -73,6 +73,7 @@ struct WebProcessCreationParameters {
     TextCheckerState textCheckerState;
 
 #if PLATFORM(MAC)
+    pid_t presenterApplicationPid;
     String nsURLCachePath;
     uint64_t nsURLCacheMemoryCapacity;
     uint64_t nsURLCacheDiskCapacity;
index 78a9016..e26f591 100644 (file)
@@ -75,6 +75,7 @@ private:
     virtual void pageDidLeaveAcceleratedCompositing();
 #endif
 
+    virtual void accessibilityChildTokenReceived(const CoreIPC::DataReference&);    
     virtual void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled);
 
     virtual void didCommitLoadForMainFrame(bool useCustomRepresentation);
index 715ed7e..dac6e47 100644 (file)
@@ -26,6 +26,7 @@
 #import "NativeWebKeyboardEvent.h"
 #import "PageClientImpl.h"
 
+#import "DataReference.h"
 #import "FindIndicator.h"
 #import "WKAPICast.h"
 #import "WKStringCF.h"
@@ -257,6 +258,12 @@ void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, b
     [m_wkView _setFindIndicator:findIndicator fadeOut:fadeOut];
 }
 
+void PageClientImpl::accessibilityChildTokenReceived(const CoreIPC::DataReference& data)
+{
+    NSData* remoteToken = [NSData dataWithBytes:data.data() length:data.size()];
+    [m_wkView _setAccessibilityChildToken:remoteToken];
+}
+    
 #if USE(ACCELERATED_COMPOSITING)
 void PageClientImpl::pageDidEnterAcceleratedCompositing()
 {
index 7fd2609..56c6670 100644 (file)
@@ -26,6 +26,7 @@
 #import "WKView.h"
 
 #import "ChunkedUpdateDrawingAreaProxy.h"
+#import "DataReference.h"
 #import "FindIndicator.h"
 #import "FindIndicatorWindow.h"
 #import "LayerBackedDrawingAreaProxy.h"
@@ -52,6 +53,7 @@
 #import <WebCore/IntRect.h>
 #import <WebCore/KeyboardEvent.h>
 #import <WebCore/PlatformScreen.h>
+#import <WebKitSystemInterface.h>
 #import <wtf/RefPtr.h>
 #import <wtf/RetainPtr.h>
 
@@ -98,6 +100,8 @@ typedef HashMap<String, ValidationVector> ValidationMap;
     NSView *_layerHostingView;
 #endif
 
+    RetainPtr<id> _remoteAccessibilityChild;
+    
     // For asynchronous validation.
     ValidationMap _validationMap;
 
@@ -166,6 +170,12 @@ typedef HashMap<String, ValidationVector> ValidationMap;
 
     WebContext::statistics().wkViewCount++;
 
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+    NSData *remoteToken = (NSData *)WKAXRemoteTokenForElement(self);
+    CoreIPC::DataReference dataToken = CoreIPC::DataReference(reinterpret_cast<const uint8_t*>([remoteToken bytes]), [remoteToken length]);
+    _data->_page->sendAccessibilityPresenterToken(dataToken);
+#endif
+    
     return self;
 }
 
@@ -247,8 +257,9 @@ typedef HashMap<String, ValidationVector> ValidationMap;
     
     NSRect windowFrameInScreenCoordinates = [window frame];
     NSRect viewFrameInWindowCoordinates = [self convertRect:[self frame] toView:nil];
+    NSPoint accessibilityPosition = [[self accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue];
     
-    _data->_page->windowAndViewFramesChanged(enclosingIntRect(windowFrameInScreenCoordinates), enclosingIntRect(viewFrameInWindowCoordinates));
+    _data->_page->windowAndViewFramesChanged(enclosingIntRect(windowFrameInScreenCoordinates), enclosingIntRect(viewFrameInWindowCoordinates), IntPoint(accessibilityPosition));
 }
 
 - (void)renewGState
@@ -954,6 +965,43 @@ static bool isViewVisible(NSView *view)
     [self _updateVisibility];
 }
 
+- (void)_setAccessibilityChildToken:(NSData *)data
+{
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+    _data->_remoteAccessibilityChild = WKAXRemoteElementForToken((CFDataRef)data);
+    WKAXInitializeRemoteElementWithWindow(_data->_remoteAccessibilityChild.get(), [self window]);
+#endif
+}
+
+- (BOOL)accessibilityIsIgnored
+{
+    return NO;
+}
+
+- (id)accessibilityHitTest:(NSPoint)point
+{
+    return _data->_remoteAccessibilityChild.get();
+}
+
+- (id)accessibilityAttributeValue:(NSString*)attribute
+{
+    if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) {
+        if (!_data->_remoteAccessibilityChild)
+            return nil;
+        return [NSArray arrayWithObject:_data->_remoteAccessibilityChild.get()];
+    }
+    if ([attribute isEqualToString:NSAccessibilityRoleAttribute])
+        return NSAccessibilityGroupRole;
+    if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute])
+        return NSAccessibilityRoleDescription(NSAccessibilityGroupRole, nil);
+    if ([attribute isEqualToString:NSAccessibilityParentAttribute])
+        return NSAccessibilityUnignoredAncestor([self superview]);
+    if ([attribute isEqualToString:NSAccessibilityEnabledAttribute])
+        return [NSNumber numberWithBool:YES];
+    
+    return [super accessibilityAttributeValue:attribute];
+}
+
 - (NSView *)hitTest:(NSPoint)point
 {
     NSView *hitView = [super hitTest:point];
index 56c5b31..544573c 100644 (file)
@@ -52,6 +52,7 @@ namespace WebKit {
 - (void)_pageDidLeaveAcceleratedCompositing;
 #endif
 
+- (void)_setAccessibilityChildToken:(NSData *)data;
 - (void)_setComplexTextInputEnabled:(BOOL)complexTextInputEnabled pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier;
 
 - (void)_setPageHasCustomRepresentation:(BOOL)pageHasCustomRepresentation;
index 553ea0f..e197d71 100644 (file)
@@ -69,6 +69,7 @@ public:
     virtual void clearAllEditCommands() = 0;
     virtual void setEditCommandState(const String& commandName, bool isEnabled, int state) = 0;
 #if PLATFORM(MAC)
+    virtual void accessibilityChildTokenReceived(const CoreIPC::DataReference&) = 0;
     virtual void interceptKeyEvent(const NativeWebKeyboardEvent&, Vector<WebCore::KeypressCommand>&, uint32_t, uint32_t, Vector<WebCore::CompositionUnderline>&) = 0;
 #endif
 #if PLATFORM(WIN)
index c7e049d..405f118 100644 (file)
@@ -165,7 +165,10 @@ void WebContext::ensureWebProcess()
     parameters.applicationCacheDirectory = applicationCacheDirectory();
     parameters.clearResourceCaches = m_clearResourceCachesForNewWebProcess;
     parameters.clearApplicationCache = m_clearApplicationCacheForNewWebProcess;
-    
+#if PLATFORM(MAC)
+    parameters.presenterApplicationPid = getpid();
+#endif
+
     m_clearResourceCachesForNewWebProcess = false;
     m_clearApplicationCacheForNewWebProcess = false;
     
index fee8129..52337f9 100644 (file)
@@ -494,12 +494,12 @@ void WebPageProxy::updateWindowIsVisible(bool windowIsVisible)
     process()->send(Messages::WebPage::SetWindowIsVisible(windowIsVisible), m_pageID);
 }
 
-void WebPageProxy::windowAndViewFramesChanged(const IntRect& windowFrameInScreenCoordinates, const IntRect& viewFrameInWindowCoordinates)
+void WebPageProxy::windowAndViewFramesChanged(const IntRect& windowFrameInScreenCoordinates, const IntRect& viewFrameInWindowCoordinates, const IntPoint& accessibilityViewCoordinates)
 {
     if (!isValid())
         return;
 
-    process()->send(Messages::WebPage::WindowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates), m_pageID);
+    process()->send(Messages::WebPage::WindowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates, accessibilityViewCoordinates), m_pageID);
 }
 
 void WebPageProxy::getMarkedRange(uint64_t& location, uint64_t& length)
@@ -1197,6 +1197,13 @@ void WebPageProxy::didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::Argu
     m_loaderClient.didRunInsecureContentForFrame(this, frame, userData.get());
 }
 
+void WebPageProxy::didReceiveAccessibilityPageToken(const CoreIPC::DataReference& data)
+{
+#if PLATFORM(MAC)
+    m_pageClient->accessibilityChildTokenReceived(data);
+#endif
+}
+    
 void WebPageProxy::frameDidBecomeFrameSet(uint64_t frameID, bool value)
 {
     WebFrameProxy* frame = process()->webFrame(frameID);
@@ -1850,6 +1857,16 @@ void WebPageProxy::stringCallback(const String& resultString, uint64_t callbackI
     callback->performCallbackWithReturnValue(resultString.impl());
 }
 
+#if PLATFORM(MAC)
+void WebPageProxy::sendAccessibilityPresenterToken(const CoreIPC::DataReference& token)
+{
+    if (!isValid())
+        return;
+
+    process()->send(Messages::WebPage::SendAccessibilityPresenterToken(token), m_pageID);
+}
+#endif
+
 void WebPageProxy::focusedFrameChanged(uint64_t frameID)
 {
     if (!frameID) {
index 3338000..e7db489 100644 (file)
@@ -176,7 +176,7 @@ public:
 
 #if PLATFORM(MAC)
     void updateWindowIsVisible(bool windowIsVisible);
-    void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates);
+    void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates, const WebCore::IntPoint& accessibilityViewCoordinates);
     void getMarkedRange(uint64_t& location, uint64_t& length);
     uint64_t characterIndexForPoint(const WebCore::IntPoint);
     WebCore::IntRect firstRectForCharacterRange(uint64_t, uint64_t);
@@ -230,6 +230,9 @@ public:
 
     void scaleWebView(double scale, const WebCore::IntPoint& origin);
     double viewScaleFactor() const { return m_viewScaleFactor; }
+#if PLATFORM(MAC)
+    void sendAccessibilityPresenterToken(const CoreIPC::DataReference&);
+#endif
 
     // Find.
     void findString(const String&, FindOptions, unsigned maxMatchCount);
@@ -333,6 +336,7 @@ private:
     void didStartProgress();
     void didChangeProgress(double);
     void didFinishProgress();
+    void didReceiveAccessibilityPageToken(const CoreIPC::DataReference&);
     
     void decidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const String& url, uint64_t listenerID);
     void decidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const String& url, uint64_t listenerID);
index e6bfee8..cf6f52a 100644 (file)
@@ -113,6 +113,8 @@ messages -> WebPageProxy {
     DataCallback(CoreIPC::DataReference resultData, uint64_t callbackID)
     StringCallback(WTF::String resultString, uint64_t callbackID)
 
+    DidReceiveAccessibilityPageToken(CoreIPC::DataReference data)
+
 #if PLATFORM(MAC)
     # Keyboard support messages.
     InterpretKeyEvent(uint32_t type) -> (Vector<WebCore::KeypressCommand> commandName, uint32_t selectionStart, uint32_t selectionEnd, Vector<WebCore::CompositionUnderline> underlines)
index 7418f9c..9c5ee2e 100644 (file)
                1CA8B945127C882A00576C2B /* WebInspectorProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CA8B943127C882A00576C2B /* WebInspectorProxyMessageReceiver.cpp */; };
                1CA8B946127C882A00576C2B /* WebInspectorProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CA8B944127C882A00576C2B /* WebInspectorProxyMessages.h */; };
                1CA8B954127C891500576C2B /* WebInspectorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C8E2DAD1278C5B200BC7BD0 /* WebInspectorMac.mm */; };
+               29CD55AA128E294F00133C85 /* AccessibilityWebPageObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CD55A8128E294F00133C85 /* AccessibilityWebPageObject.h */; };
+               29CD55AB128E294F00133C85 /* AccessibilityWebPageObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29CD55A9128E294F00133C85 /* AccessibilityWebPageObject.mm */; };
                37F623B812A57B6200E3FDF6 /* WKFindOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 37F623B712A57B6200E3FDF6 /* WKFindOptions.h */; settings = {ATTRIBUTES = (Public, ); }; };
                51021E9C12B16788005C033C /* WebContextMenuClientMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51021E9B12B16788005C033C /* WebContextMenuClientMac.mm */; };
                510FBB9A1288C95E00AFFDF4 /* WebContextMenuItemData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510FBB981288C95E00AFFDF4 /* WebContextMenuItemData.cpp */; };
                1CA8B935127C774E00576C2B /* WebInspectorProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebInspectorProxyMac.mm; sourceTree = "<group>"; };
                1CA8B943127C882A00576C2B /* WebInspectorProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebInspectorProxyMessageReceiver.cpp; sourceTree = "<group>"; };
                1CA8B944127C882A00576C2B /* WebInspectorProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebInspectorProxyMessages.h; sourceTree = "<group>"; };
+               29CD55A8128E294F00133C85 /* AccessibilityWebPageObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityWebPageObject.h; sourceTree = "<group>"; };
+               29CD55A9128E294F00133C85 /* AccessibilityWebPageObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AccessibilityWebPageObject.mm; sourceTree = "<group>"; };
                32DBCF5E0370ADEE00C91783 /* WebKit2Prefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKit2Prefix.h; sourceTree = "<group>"; };
                37F623B712A57B6200E3FDF6 /* WKFindOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFindOptions.h; sourceTree = "<group>"; };
                51021E9B12B16788005C033C /* WebContextMenuClientMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebContextMenuClientMac.mm; sourceTree = "<group>"; };
                BC963D6C113DD19500574BE2 /* mac */ = {
                        isa = PBXGroup;
                        children = (
+                               29CD55A9128E294F00133C85 /* AccessibilityWebPageObject.mm */,
+                               29CD55A8128E294F00133C85 /* AccessibilityWebPageObject.h */,
                                BC5F7BB8118237990052C02C /* ChunkedUpdateDrawingAreaMac.cpp */,
                                0F5265B511DD37700006D33C /* LayerBackedDrawingAreaMac.mm */,
                                1C8E2DAD1278C5B200BC7BD0 /* WebInspectorMac.mm */,
                                BCEE7DC5128B645D009827DA /* InjectedBundleClient.h in Headers */,
                                ED82A7F2128C6FAF004477B3 /* WKBundlePageOverlay.h in Headers */,
                                1CA8B946127C882A00576C2B /* WebInspectorProxyMessages.h in Headers */,
+                               29CD55AA128E294F00133C85 /* AccessibilityWebPageObject.h in Headers */,
                                5153569D1291B1D2000749DC /* WebPageContextMenuClient.h in Headers */,
                                1AAB4A8D1296F0A20023952F /* SandboxExtension.h in Headers */,
                                BC7B6206129A0A6700D174A4 /* WebPageGroup.h in Headers */,
                                1CA8B945127C882A00576C2B /* WebInspectorProxyMessageReceiver.cpp in Sources */,
                                1CA8B954127C891500576C2B /* WebInspectorMac.mm in Sources */,
                                EDCA71B7128DDA8C00201B26 /* WKBundlePageOverlay.cpp in Sources */,
+                               29CD55AB128E294F00133C85 /* AccessibilityWebPageObject.mm in Sources */,
                                5153569C1291B1D2000749DC /* WebPageContextMenuClient.cpp in Sources */,
                                1AAB4AAA1296F1540023952F /* SandboxExtensionMac.mm in Sources */,
                                BC7B6207129A0A6700D174A4 /* WebPageGroup.cpp in Sources */,
index be10517..3adbe24 100644 (file)
@@ -1257,6 +1257,12 @@ void WebFrameLoaderClient::registerForIconNotification(bool listen)
 }
 
 #if PLATFORM(MAC)
+    
+RemoteAXObjectRef WebFrameLoaderClient::accessibilityRemoteObject() 
+{
+    return m_frame->page()->accessibilityRemoteObject();
+}
+    
 #if ENABLE(MAC_JAVA_BRIDGE)
 jobject WebFrameLoaderClient::javaApplet(NSView*) { return 0; }
 #endif
index 07d15d3..29c8bdd 100644 (file)
@@ -201,6 +201,8 @@ private:
     virtual void registerForIconNotification(bool listen = true);
     
 #if PLATFORM(MAC)
+    virtual RemoteAXObjectRef accessibilityRemoteObject();
+    
 #if ENABLE(MAC_JAVA_BRIDGE)
     virtual jobject javaApplet(NSView*);
 #endif
index 5990cb3..649171b 100644 (file)
@@ -1312,11 +1312,12 @@ void WebPage::setWindowIsVisible(bool windowIsVisible)
         (*it)->setWindowIsVisible(windowIsVisible);
 }
 
-void WebPage::windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates)
+void WebPage::windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates, const WebCore::IntPoint& accessibilityViewCoordinates)
 {
     m_windowFrameInScreenCoordinates = windowFrameInScreenCoordinates;
     m_viewFrameInWindowCoordinates = viewFrameInWindowCoordinates;
-
+    m_accessibilityPosition = accessibilityViewCoordinates;
+    
     // Tell all our plug-in views that the window and view frames have changed.
     for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it)
         (*it)->windowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates);
index 797478e..8769976 100644 (file)
 #include <WebCore/PlatformTouchEvent.h>
 #endif
 
+#if PLATFORM(MAC)
+#include <wtf/RetainPtr.h>
+#ifdef __OBJC__
+@class AccessibilityWebPageObject;
+#else
+class AccessibilityWebPageObject;
+#endif
+#endif
+
 namespace CoreIPC {
     class ArgumentDecoder;
     class Connection;
@@ -253,6 +262,10 @@ public:
     static void getLocationAndLengthFromRange(WebCore::Range*, uint64_t& location, uint64_t& length);
 
 #if PLATFORM(MAC)
+    void sendAccessibilityPresenterToken(const CoreIPC::DataReference&);
+    AccessibilityWebPageObject* accessibilityRemoteObject();
+    WebCore::IntPoint accessibilityPosition() const { return m_accessibilityPosition; }    
+    
     void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
 
     void getMarkedRange(uint64_t& location, uint64_t& length);
@@ -340,7 +353,7 @@ private:
 
 #if PLATFORM(MAC)
     void setWindowIsVisible(bool windowIsVisible);
-    void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates);
+    void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates, const WebCore::IntPoint& accessibilityViewCoordinates);
 #endif
 
     void unapplyEditCommand(uint64_t commandID);
@@ -397,8 +410,13 @@ private:
     // The frame of the view in window coordinates.
     WebCore::IntRect m_viewFrameInWindowCoordinates;
 
+    // The accessibility position of the view.
+    WebCore::IntPoint m_accessibilityPosition;
+    
     // All plug-in views on this web page.
     HashSet<PluginView*> m_pluginViews;
+    
+    RetainPtr<AccessibilityWebPageObject> m_mockAccessibilityElement;
 #elif PLATFORM(WIN)
     // Our view's window (in the UI process).
     HWND m_nativeWindow;
index f973a1b..3b57185 100644 (file)
@@ -115,10 +115,11 @@ messages -> WebPage {
     SendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, String textInput)
 
     SetWindowIsVisible(bool windowIsVisible)
-    WindowAndViewFramesChanged(WebCore::IntRect windowFrameInScreenCoordinates, WebCore::IntRect viewFrameInWindowCoordinates)
+    WindowAndViewFramesChanged(WebCore::IntRect windowFrameInScreenCoordinates, WebCore::IntRect viewFrameInWindowCoordinates, WebCore::IntPoint accessibilityViewCoordinates)
     GetMarkedRange() -> (uint64_t location, uint64_t length)
     CharacterIndexForPoint(WebCore::IntPoint point) -> (uint64_t result)
     FirstRectForCharacterRange(uint64_t location, uint64_t length) -> (WebCore::IntRect resultRect)
+    SendAccessibilityPresenterToken(CoreIPC::DataReference token)
 #endif
 #if PLATFORM(WIN)
     ConfirmComposition(WTF::String compositionString)
diff --git a/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.h b/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.h
new file mode 100644 (file)
index 0000000..3b331b9
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * 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 AccessibilityWebPageObject_h
+#define AccessibilityWebPageObject_h
+
+namespace WebKit {
+class WebPage;
+}
+
+@interface AccessibilityWebPageObject : NSObject {
+    WebKit::WebPage* m_page;
+    
+    id m_parent;
+    NSArray* m_attributeNames;
+    NSMutableArray* m_accessibilityChildren;
+}
+
+- (void)setWebPage:(WebKit::WebPage*)page;
+
+- (void)setRemoteParent:(id)parent;
+
+@end
+
+#endif // AccessibilityWebPageObject_h
diff --git a/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm b/WebKit2/WebProcess/WebPage/mac/AccessibilityWebPageObject.mm
new file mode 100644 (file)
index 0000000..41d3b5b
--- /dev/null
@@ -0,0 +1,191 @@
+/*
+ * 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 "AccessibilityWebPageObject.h"
+
+#import "WebFrame.h"
+#import "WebPage.h"
+#import <AppKit/NSAccessibilityRemoteUIElement.h>
+#import <WebCore/AXObjectCache.h>
+#import <WebCore/Frame.h>
+#import <WebCore/FrameView.h>
+#import <WebCore/ScrollView.h>
+#import <WebCore/Scrollbar.h>
+
+using namespace WebCore;
+using namespace WebKit;
+
+@implementation AccessibilityWebPageObject
+
+- (id)accessibilityRootObjectWrapper
+{
+    WebCore::Page* page = m_page->corePage();
+    if (!page)
+        return nil;
+    
+    WebCore::Frame* core = page->mainFrame();
+    if (!core || !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];
+    }
+}
+
+- (void)dealloc
+{
+    [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;
+}
+
+- (BOOL)accessibilityIsAttributeSettable:(NSString *)attribute
+{
+    return NO;
+}
+
+- (void)accessibilitySetValue:(id)value forAttribute:(NSString *)attribute 
+{
+    return;
+}
+
+- (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 windowUIElement];
+    if ([attribute isEqualToString:NSAccessibilityTopLevelUIElementAttribute])
+        return [m_parent topLevelUIElement];
+    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]) {
+        WebCore::IntPoint 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 [super accessibilityAttributeValue:attribute];
+}
+
+- (BOOL)accessibilityShouldUseUniqueId
+{
+    return YES;
+}
+
+- (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 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* fv = m_page->mainFrame()->coreFrame()->view();
+    if (fv) {
+        point.y += fv->scrollPosition().y();
+        point.x += fv->scrollPosition().x();
+    }
+    
+    return [[self accessibilityRootObjectWrapper] accessibilityHitTest:point];
+}
+
+- (id)accessibilityFocusedUIElement 
+{
+    return NSAccessibilityUnignoredDescendant(self);
+}
+
+
+@end
index 25b0326..f3211f2 100644 (file)
 
 #include "WebPage.h"
 
+#include "AccessibilityWebPageObject.h"
+#include "DataReference.h"
 #include "PluginView.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebEvent.h"
+#include "WebFrame.h"
 #include "WebPageProxyMessages.h"
 #include "WebProcess.h"
+#include <WebCore/AXObjectCache.h>
 #include <WebCore/FocusController.h>
 #include <WebCore/Frame.h>
 #include <WebCore/FrameView.h>
@@ -40,6 +44,7 @@
 #include <WebCore/ScrollView.h>
 #include <WebCore/TextIterator.h>
 #include <WebCore/WindowsKeyboardCodes.h>
+#include <WebKitSystemInterface.h>
 
 using namespace WebCore;
 
@@ -48,6 +53,21 @@ namespace WebKit {
 void WebPage::platformInitialize()
 {
     m_page->addSchedulePair(SchedulePair::create([NSRunLoop currentRunLoop], kCFRunLoopCommonModes));
+
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+    AccessibilityWebPageObject* mockAccessibilityElement = [[[AccessibilityWebPageObject alloc] init] autorelease];
+
+    // Get the pid for the starting process.
+    pid_t pid = WebProcess::shared().presenterApplicationPid();    
+    WKAXInitializeElementWithPresenterPid(mockAccessibilityElement, pid);
+    [mockAccessibilityElement setWebPage:this];
+    
+    // send data back over
+    NSData* remoteToken = (NSData *)WKAXRemoteTokenForElement(mockAccessibilityElement); 
+    CoreIPC::DataReference dataToken = CoreIPC::DataReference(reinterpret_cast<const uint8_t*>([remoteToken bytes]), [remoteToken length]);
+    send(Messages::WebPageProxy::DidReceiveAccessibilityPageToken(dataToken));
+    m_mockAccessibilityElement = mockAccessibilityElement;
+#endif
 }
 
 void WebPage::platformPreferencesDidChange(const WebPreferencesStore&)
@@ -314,6 +334,19 @@ bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent& keyboard
     return true;
 }
 
+void WebPage::sendAccessibilityPresenterToken(const CoreIPC::DataReference& data)
+{
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+    NSData* tokenData = [NSData dataWithBytes:data.data() length:data.size()];
+    [m_mockAccessibilityElement.get() setRemoteParent:WKAXRemoteElementForToken((CFDataRef)tokenData)];
+#endif
+}
+
+AccessibilityWebPageObject* WebPage::accessibilityRemoteObject()
+{
+    return m_mockAccessibilityElement.get();
+}
+         
 bool WebPage::platformHasLocalDataForURL(const WebCore::KURL& url)
 {
     NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url];
index b4e3d85..4c802f4 100644 (file)
@@ -178,6 +178,10 @@ void WebProcess::initializeWebProcess(const WebProcessCreationParameters& parame
         clearResourceCaches();
     if (parameters.clearApplicationCache)
         clearApplicationCache();
+    
+#if PLATFORM(MAC)
+    m_presenterApplicationPid = parameters.presenterApplicationPid;
+#endif
 
     if (parameters.shouldAlwaysUseComplexTextCodePath)
         setAlwaysUsesComplexTextCodePath(true);
index cfab98c..19d0fb7 100644 (file)
@@ -92,7 +92,10 @@ public:
     WebPageGroupProxy* webPageGroup(uint64_t pageGroupID);
     WebPageGroupProxy* webPageGroup(const WebPageGroupData&);
     static WebCore::PageGroup* sharedPageGroup();
-
+#if PLATFORM(MAC)
+    pid_t presenterApplicationPid() const { return m_presenterApplicationPid; }
+#endif 
+    
 #if PLATFORM(QT)
     QNetworkAccessManager* networkAccessManager() { return m_networkAccessManager; }
 #endif
@@ -164,6 +167,9 @@ private:
 #if USE(ACCELERATED_COMPOSITING) && PLATFORM(MAC)
     mach_port_t m_compositingRenderServerPort;
 #endif
+#if PLATFORM(MAC)
+    pid_t m_presenterApplicationPid;
+#endif
 
 #if PLATFORM(QT)
     QNetworkAccessManager* m_networkAccessManager;
index 2f455f4..c44e1ef 100644 (file)
@@ -133,6 +133,10 @@ int WebProcessMain(const CommandLine& commandLine)
      // Initialize AppKit.
     [NSApplication sharedApplication];
 
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+    WKAXRegisterRemoteApp();
+#endif
+    
     RunLoop::run();
 
     // FIXME: Do more cleanup here.