AX: Support methods for web apps to interact with the native accessibility APIs
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Aug 2010 17:14:47 +0000 (17:14 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Aug 2010 17:14:47 +0000 (17:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=43005

Reviewed by David Kilzer.

.:

* GNUmakefile.am:

WebCore:

Adds a new "accessibility" object that hangs off of "window.navigator".
This accessibility object will allow web apps to interact with native accessibility APIs
to provide a richer experience (for screen reader users primarily).

Test: platform/mac/accessibility/js-accessibility.html

* Android.derived.v8bindings.mk:
* Android.jscbindings.mk:
* DerivedSources.cpp:
* DerivedSources.make:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pri:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/AXObjectCache.h:
(WebCore::AXObjectCache::):
* accessibility/Accessibility.cpp: Added.
(WebCore::Accessibility::Accessibility):
(WebCore::Accessibility::~Accessibility):
(WebCore::Accessibility::disconnectFrame):
(WebCore::Accessibility::screenChanged):
(WebCore::Accessibility::elementsChanged):
(WebCore::Accessibility::screenReader):
* accessibility/Accessibility.h: Added.
(WebCore::Accessibility::create):
* accessibility/Accessibility.idl: Added.
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::isScreenReaderRunning):
(WebCore::AccessibilityObject::screenReaderFocusedElement):
(WebCore::AccessibilityObject::screenReaderVersion):
* accessibility/ScreenReader.cpp: Added.
(WebCore::ScreenReader::ScreenReader):
(WebCore::ScreenReader::~ScreenReader):
(WebCore::ScreenReader::disconnectFrame):
(WebCore::ScreenReader::active):
(WebCore::ScreenReader::activeElement):
(WebCore::ScreenReader::version):
* accessibility/ScreenReader.h: Added.
(WebCore::ScreenReader::create):
* accessibility/ScreenReader.idl: Added.
* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::postPlatformNotification):
* accessibility/mac/AccessibilityObjectMac.mm:
(WebCore::AccessibilityObject::isScreenReaderRunning):
(WebCore::AccessibilityObject::screenReaderFocusedElement):
(WebCore::AccessibilityObject::screenReaderVersion):
* page/Navigator.cpp:
(WebCore::Navigator::disconnectFrame):
(WebCore::Navigator::accessibility):
* page/Navigator.h:
* page/Navigator.idl:

LayoutTests:

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

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

29 files changed:
ChangeLog
GNUmakefile.am
LayoutTests/ChangeLog
LayoutTests/platform/mac/accessibility/js-accessibility-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/js-accessibility.html [new file with mode: 0644]
WebCore/Android.derived.v8bindings.mk
WebCore/Android.jscbindings.mk
WebCore/ChangeLog
WebCore/DerivedSources.cpp
WebCore/DerivedSources.make
WebCore/GNUmakefile.am
WebCore/WebCore.gypi
WebCore/WebCore.pri
WebCore/WebCore.pro
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/accessibility/AXObjectCache.h
WebCore/accessibility/Accessibility.cpp [new file with mode: 0644]
WebCore/accessibility/Accessibility.h [new file with mode: 0644]
WebCore/accessibility/Accessibility.idl [new file with mode: 0644]
WebCore/accessibility/AccessibilityObject.h
WebCore/accessibility/ScreenReader.cpp [new file with mode: 0644]
WebCore/accessibility/ScreenReader.h [new file with mode: 0644]
WebCore/accessibility/ScreenReader.idl [new file with mode: 0644]
WebCore/accessibility/mac/AXObjectCacheMac.mm
WebCore/accessibility/mac/AccessibilityObjectMac.mm
WebCore/page/Navigator.cpp
WebCore/page/Navigator.h
WebCore/page/Navigator.idl

index 3a24572..0bf4ed6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-08-02  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by David Kilzer.
+
+        AX: Support methods for web apps to interact with the native accessibility APIs
+        https://bugs.webkit.org/show_bug.cgi?id=43005
+
+        * GNUmakefile.am:
+
 2010-08-02  Balazs Kelemen  <kb@inf.u-szeged.hu>
 
         Reviewed by Simon Hausmann.
index 1910d1b..ff24a0b 100644 (file)
@@ -336,6 +336,7 @@ webkitgtk_static_h_api += \
        $(srcdir)/WebKit/gtk/webkit/webkitsecurityorigin.h
 
 webkitgtk_built_h_api += \
+       DerivedSources/webkit/WebKitDOMAccessibility.h \
        DerivedSources/webkit/WebKitDOMCSSRule.h \
        DerivedSources/webkit/WebKitDOMCSSRuleList.h \
        DerivedSources/webkit/WebKitDOMCSSStyleDeclaration.h \
@@ -444,6 +445,7 @@ webkitgtk_built_h_api += \
        DerivedSources/webkit/WebKitDOMObject.h \
        DerivedSources/webkit/WebKitDOMNavigator.h \
        DerivedSources/webkit/WebKitDOMScreen.h \
+       DerivedSources/webkit/WebKitDOMScreenReader.h \
        DerivedSources/webkit/WebKitDOMWebKitPoint.h \
        DerivedSources/webkit/WebKitDOMDOMMimeType.h \
        DerivedSources/webkit/WebKitDOMDOMMimeTypeArray.h \
@@ -463,6 +465,7 @@ webkitgtk_h_api += \
        $(webkitgtk_static_h_api)
 
 webkitgtk_gdom_built_sources += \
+       DerivedSources/webkit/WebKitDOMAccessibility.cpp \
        DerivedSources/webkit/WebKitDOMAttr.cpp \
        DerivedSources/webkit/WebKitDOMAttrPrivate.h \
        DerivedSources/webkit/WebKitDOMBarInfo.cpp \
@@ -673,6 +676,7 @@ webkitgtk_gdom_built_sources += \
        DerivedSources/webkit/WebKitDOMRangePrivate.h \
        DerivedSources/webkit/WebKitDOMScreen.cpp \
        DerivedSources/webkit/WebKitDOMScreenPrivate.h \
+       DerivedSources/webkit/WebKitDOMScreenReader.cpp \
        DerivedSources/webkit/WebKitDOMStorage.cpp \
        DerivedSources/webkit/WebKitDOMStoragePrivate.h \
        DerivedSources/webkit/WebKitDOMStyleMedia.cpp \
index 80d085e..fdb7ae4 100644 (file)
@@ -1,3 +1,13 @@
+2010-08-02  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by David Kilzer.
+
+        AX: Support methods for web apps to interact with the native accessibility APIs
+        https://bugs.webkit.org/show_bug.cgi?id=43005
+
+        * platform/mac/accessibility/js-accessibility-expected.txt: Added.
+        * platform/mac/accessibility/js-accessibility.html: Added.
+
 2010-08-02  Martin Robinson  <mrobinson@igalia.com>
 
         Reviewed by Xan Lopez.
diff --git a/LayoutTests/platform/mac/accessibility/js-accessibility-expected.txt b/LayoutTests/platform/mac/accessibility/js-accessibility-expected.txt
new file mode 100644 (file)
index 0000000..5e81a29
--- /dev/null
@@ -0,0 +1,13 @@
+This tests the javascript interface to accessibility
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS ax.screenReader.active is false
+PASS addedNotification is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS name is 'AXScreenChanged'
+PASS name is 'AXElementsChanged'
+
diff --git a/LayoutTests/platform/mac/accessibility/js-accessibility.html b/LayoutTests/platform/mac/accessibility/js-accessibility.html
new file mode 100644 (file)
index 0000000..b9b73fe
--- /dev/null
@@ -0,0 +1,68 @@
+<!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">
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests the javascript interface to accessibility");
+
+    var body = 0;
+    var name = 0;
+    function notifyCallback(notification) {  
+        name = notification;
+        if (name == "AXScreenChanged") {
+            shouldBe("name", "'AXScreenChanged'");
+        }
+        else if (name == "AXElementsChanged") {
+            shouldBe("name", "'AXElementsChanged'");
+            body.removeNotificationListener();
+            window.layoutTestController.notifyDone();
+        }
+    }
+</script>
+
+<script>
+    var ax = window.navigator.accessibility;
+
+    // screen reader should not be running within layout tests.
+    shouldBe("ax.screenReader.active", "false");
+
+    // should not cause an error.
+    var version = ax.screenReader.version;
+
+    // should not cause an error
+    var activeElement = ax.screenReader.activeElement;
+
+    if (window.accessibilityController) {
+        window.layoutTestController.waitUntilDone();
+
+        document.getElementById("body").focus();
+
+        body = window.accessibilityController.focusedElement;
+
+        var addedNotification = body.addNotificationListener(notifyCallback);
+        shouldBe("addedNotification", "true");
+
+        // should cause a AXScreenChanged to be sent out.
+        ax.screenChanged();
+
+        // should cause a AXElementsChanged to be sent out.
+        ax.elementsChanged();
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src="../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
index 216cde9..63be0a8 100644 (file)
@@ -263,6 +263,21 @@ LOCAL_GENERATED_SOURCES += $(GEN)
 # above rules.  Specifying this explicitly makes -j2 work.
 $(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/bindings/%.cpp : $(intermediates)/bindings/%.h
 
+# Accessibility
+GEN := \
+    $(intermediates)/bindings/V8Accessibility.h
+    $(intermediates)/bindings/V8ScreenReader.h
+
+$(GEN): PRIVATE_PATH := $(LOCAL_PATH)
+$(GEN): PRIVATE_CUSTOM_TOOL = SOURCE_ROOT=$(PRIVATE_PATH) perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator V8 --include dom --include html --outputdir $(dir $@) $<
+$(GEN): $(intermediates)/bindings/V8%.h : $(LOCAL_PATH)/accessibility/%.idl $(js_binding_scripts)
+       $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+# We also need the .cpp files, which are generated as side effects of the
+# above rules.  Specifying this explicitly makes -j2 work.
+$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/bindings/%.cpp : $(intermediates)/bindings/%.h
+
 # Page
 GEN := \
     $(intermediates)/bindings/V8BarInfo.h \
index 2ee4276..f67d54d 100644 (file)
@@ -45,6 +45,7 @@ BINDING_C_INCLUDES := \
        $(JAVASCRIPTCORE_PATH)/wrec \
        $(JAVASCRIPTCORE_PATH)/ForwardingHeaders \
        \
+       $(base_intermediates)/WebCore/accessibility \
        $(base_intermediates)/WebCore/bindings/js \
        $(base_intermediates)/WebCore/dom \
        $(base_intermediates)/WebCore/html/canvas \
index 459b9ae..b550fd2 100644 (file)
@@ -1,3 +1,64 @@
+2010-08-02  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by David Kilzer.
+
+        AX: Support methods for web apps to interact with the native accessibility APIs
+        https://bugs.webkit.org/show_bug.cgi?id=43005
+
+        Adds a new "accessibility" object that hangs off of "window.navigator".
+        This accessibility object will allow web apps to interact with native accessibility APIs
+        to provide a richer experience (for screen reader users primarily).
+
+        Test: platform/mac/accessibility/js-accessibility.html
+
+        * Android.derived.v8bindings.mk:
+        * Android.jscbindings.mk:
+        * DerivedSources.cpp:
+        * DerivedSources.make:
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * WebCore.pri:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * accessibility/AXObjectCache.h:
+        (WebCore::AXObjectCache::):
+        * accessibility/Accessibility.cpp: Added.
+        (WebCore::Accessibility::Accessibility):
+        (WebCore::Accessibility::~Accessibility):
+        (WebCore::Accessibility::disconnectFrame):
+        (WebCore::Accessibility::screenChanged):
+        (WebCore::Accessibility::elementsChanged):
+        (WebCore::Accessibility::screenReader):
+        * accessibility/Accessibility.h: Added.
+        (WebCore::Accessibility::create):
+        * accessibility/Accessibility.idl: Added.
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::isScreenReaderRunning):
+        (WebCore::AccessibilityObject::screenReaderFocusedElement):
+        (WebCore::AccessibilityObject::screenReaderVersion):
+        * accessibility/ScreenReader.cpp: Added.
+        (WebCore::ScreenReader::ScreenReader):
+        (WebCore::ScreenReader::~ScreenReader):
+        (WebCore::ScreenReader::disconnectFrame):
+        (WebCore::ScreenReader::active):
+        (WebCore::ScreenReader::activeElement):
+        (WebCore::ScreenReader::version):
+        * accessibility/ScreenReader.h: Added.
+        (WebCore::ScreenReader::create):
+        * accessibility/ScreenReader.idl: Added.
+        * accessibility/mac/AXObjectCacheMac.mm:
+        (WebCore::AXObjectCache::postPlatformNotification):
+        * accessibility/mac/AccessibilityObjectMac.mm:
+        (WebCore::AccessibilityObject::isScreenReaderRunning):
+        (WebCore::AccessibilityObject::screenReaderFocusedElement):
+        (WebCore::AccessibilityObject::screenReaderVersion):
+        * page/Navigator.cpp:
+        (WebCore::Navigator::disconnectFrame):
+        (WebCore::Navigator::accessibility):
+        * page/Navigator.h:
+        * page/Navigator.idl:
+
 2010-08-02  Martin Robinson  <mrobinson@igalia.com>
 
         Reviewed by Xan Lopez.
index 3e5fb60..a59e832 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "HTMLElementFactory.cpp"
 #include "JSAbstractWorker.cpp"
+#include "JSAccessibility.cpp"
 #include "JSAttr.cpp"
 #include "JSBarInfo.cpp"
 #include "JSBeforeLoadEvent.cpp"
 #include "JSRect.cpp"
 #include "JSRGBColor.cpp"
 #include "JSScreen.cpp"
+#include "JSScreenReader.cpp"
 #include "JSScriptProfile.cpp"
 #include "JSScriptProfileNode.cpp"
 #include "JSSharedWorker.cpp"
index 3f2f0f4..e053350 100644 (file)
@@ -28,6 +28,7 @@
 
 VPATH = \
     $(WebCore) \
+    $(WebCore)/accessibility \
     $(WebCore)/bindings/js \
     $(WebCore)/bindings/objc \
     $(WebCore)/css \
@@ -50,6 +51,7 @@ VPATH = \
 DOM_CLASSES = \
     AbstractView \
     AbstractWorker \
+    Accessibility \
     Attr \
     BarInfo \
     BeforeLoadEvent \
@@ -438,6 +440,7 @@ DOM_CLASSES = \
     SVGZoomAndPan \
     SVGZoomEvent \
     Screen \
+    ScreenReader \
     StyleMedia \
     StyleSheet \
     StyleSheetList \
index d35b74a..4f7ca6c 100644 (file)
@@ -99,6 +99,8 @@ webcore_built_sources += \
        DerivedSources/WebCore/InspectorBackendDispatcher.h \
        DerivedSources/WebCore/JSAbstractWorker.cpp \
        DerivedSources/WebCore/JSAbstractWorker.h \
+       DerivedSources/WebCore/JSAccessibility.cpp \
+       DerivedSources/WebCore/JSAccessibility.h \
        DerivedSources/WebCore/JSArrayBuffer.cpp \
        DerivedSources/WebCore/JSArrayBuffer.h \
        DerivedSources/WebCore/JSArrayBufferView.cpp \
@@ -466,6 +468,8 @@ webcore_built_sources += \
        DerivedSources/WebCore/JSRGBColor.h \
        DerivedSources/WebCore/JSScreen.cpp \
        DerivedSources/WebCore/JSScreen.h \
+       DerivedSources/WebCore/JSScreenReader.cpp \
+       DerivedSources/WebCore/JSScreenReader.h \
        DerivedSources/WebCore/JSScriptProfile.cpp \
        DerivedSources/WebCore/JSScriptProfile.h \
        DerivedSources/WebCore/JSScriptProfileNode.cpp \
@@ -575,6 +579,8 @@ webcore_sources += \
        WebCore/WebCorePrefix.h \
        WebCore/accessibility/AXObjectCache.cpp \
        WebCore/accessibility/AXObjectCache.h \
+       WebCore/accessibility/Accessibility.cpp \
+       WebCore/accessibility/Accessibility.h \
        WebCore/accessibility/AccessibilityARIAGrid.cpp \
        WebCore/accessibility/AccessibilityARIAGrid.h \
        WebCore/accessibility/AccessibilityARIAGridCell.cpp \
@@ -617,6 +623,8 @@ webcore_sources += \
        WebCore/accessibility/AccessibilityTableHeaderContainer.h \
        WebCore/accessibility/AccessibilityTableRow.cpp \
        WebCore/accessibility/AccessibilityTableRow.h \
+       WebCore/accessibility/ScreenReader.cpp \
+       WebCore/accessibility/ScreenReader.h \
        WebCore/bindings/generic/RuntimeEnabledFeatures.cpp \
        WebCore/bindings/generic/RuntimeEnabledFeatures.h \
        WebCore/bindings/js/CachedScriptSourceProvider.h \
@@ -4416,6 +4424,7 @@ DerivedSources/WebCore/RemoteInspectorFrontend.cpp DerivedSources/WebCore/Remote
        $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts -I$(WebCore)/inspector $(WebCore)/bindings/scripts/generate-bindings.pl $(IDL_PATH:%=--include "%") --outputDir "$(GENSOURCES_WEBCORE)" --defines "LANGUAGE_JAVASCRIPT=1 $(FEATURE_DEFINES)" --generator Inspector $<
 
 IDL_PATH := \
+    $(WebCore)/accessibility \
     $(WebCore)/bindings/js \
     $(WebCore)/css \
     $(WebCore)/dom \
index f502cb4..84bbda6 100644 (file)
@@ -1,6 +1,8 @@
 {
     'variables': {
         'webcore_bindings_idl_files': [
+            'accessibility/Accessibility.idl',
+            'accessibility/ScreenReader.idl',
             'css/CSSCharsetRule.idl',
             'css/CSSFontFaceRule.idl',
             'css/CSSImportRule.idl',
             # Source/Header Files
             'accessibility/AXObjectCache.cpp',
             'accessibility/AXObjectCache.h',
+            'accessibility/Accessibility.cpp',
+            'accessibility/Accessibility.h',
             'accessibility/AccessibilityARIAGrid.cpp',
             'accessibility/AccessibilityARIAGrid.h',
             'accessibility/AccessibilityARIAGridCell.cpp',
             'accessibility/AccessibilityTableHeaderContainer.h',
             'accessibility/AccessibilityTableRow.cpp',
             'accessibility/AccessibilityTableRow.h',
+            'accessibility/ScreenReader.cpp',
+            'accessibility/ScreenReader.h',
             'accessibility/chromium/AXObjectCacheChromium.cpp',
             'accessibility/chromium/AccessibilityObjectChromium.cpp',
             'accessibility/chromium/AccessibilityObjectWrapper.h',
index ff65cae..19f4916 100644 (file)
@@ -256,6 +256,8 @@ STYLESHEETS_EMBED = \
     $$PWD/css/themeQtMaemo5.css
 
 IDL_BINDINGS += \
+    accessibility/Accessibility.idl \
+    accessibility/ScreenReader.idl \
     css/Counter.idl \
     css/CSSCharsetRule.idl \
     css/CSSFontFaceRule.idl \
index c841f0e..97f3679 100644 (file)
@@ -254,6 +254,7 @@ contains(DEFINES, ENABLE_WCSS=1) {
 }
 
 SOURCES += \
+    accessibility/Accessibility.cpp \
     accessibility/AccessibilityImageMapLink.cpp \
     accessibility/AccessibilityMediaControls.cpp \    
     accessibility/AccessibilityMenuList.cpp \
@@ -276,6 +277,7 @@ SOURCES += \
     accessibility/AccessibilityTableHeaderContainer.cpp \    
     accessibility/AccessibilityTableRow.cpp \    
     accessibility/AXObjectCache.cpp \
+    accessibility/ScreenReader.cpp \
     bindings/generic/RuntimeEnabledFeatures.cpp \
     bindings/js/GCController.cpp \
     bindings/js/DOMObjectHashTableMap.cpp \
index 7fe8705..b8cfded 100644 (file)
                                >\r
                        </File>\r
                        <File\r
+                               RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSAccessibility.cpp"\r
+                               >\r
+                               <FileConfiguration\r
+                                       Name="Debug|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Release|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Debug_Internal|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Debug_Cairo|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Release_Cairo|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Debug_All|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                       </File>\r
+                       <File\r
+                               RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSAccessibility.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSAttr.cpp"\r
                                >\r
                                <FileConfiguration\r
                                >\r
                        </File>\r
                        <File\r
+                               RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSScreenReader.cpp"\r
+                               >\r
+                               <FileConfiguration\r
+                                       Name="Debug|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Release|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Debug_Internal|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Debug_Cairo|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Release_Cairo|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Debug_All|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                       </File>\r
+                       <File\r
+                               RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSScreenReader.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath="$(WebKitOutputDir)\obj\WebCore\DerivedSources\JSSharedWorker.cpp"\r
                                >\r
                                <FileConfiguration\r
                                >\r
                        </File>\r
                        <File\r
+                               RelativePath="..\accessibility\Accessibility.cpp"\r
+                               >\r
+                       <File\r
+                               RelativePath="..\accessibility\Accessibility.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath="..\accessibility\AccessibilityARIAGrid.cpp"\r
                                >\r
                                <FileConfiguration\r
                                RelativePath="..\accessibility\AXObjectCache.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\accessibility\ScreenReader.cpp"\r
+                               >\r
+                       <File\r
+                               RelativePath="..\accessibility\ScreenReader.h"\r
+                               >\r
+                       </File>\r
                        <Filter\r
                                Name="win"\r
                                >\r
index 20de97a..e4c5e17 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 */; };
+               2974463D11FE257A004523F8 /* Accessibility.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2974463711FE257A004523F8 /* Accessibility.cpp */; };
+               2974463E11FE257A004523F8 /* Accessibility.h in Headers */ = {isa = PBXBuildFile; fileRef = 2974463811FE257A004523F8 /* Accessibility.h */; };
+               2974464011FE257A004523F8 /* ScreenReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2974463A11FE257A004523F8 /* ScreenReader.cpp */; };
+               2974464111FE257A004523F8 /* ScreenReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 2974463B11FE257A004523F8 /* ScreenReader.h */; };
+               2974466F11FE2B32004523F8 /* JSAccessibility.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2974466D11FE2B32004523F8 /* JSAccessibility.cpp */; };
+               2974467011FE2B32004523F8 /* JSAccessibility.h in Headers */ = {isa = PBXBuildFile; fileRef = 2974466E11FE2B32004523F8 /* JSAccessibility.h */; };
+               2974468E11FE2BE1004523F8 /* JSScreenReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2974468C11FE2BE1004523F8 /* JSScreenReader.cpp */; };
+               2974468F11FE2BE1004523F8 /* JSScreenReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 2974468D11FE2BE1004523F8 /* JSScreenReader.h */; };
                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>"; };
+               2974463711FE257A004523F8 /* Accessibility.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Accessibility.cpp; sourceTree = "<group>"; };
+               2974463811FE257A004523F8 /* Accessibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Accessibility.h; sourceTree = "<group>"; };
+               2974463911FE257A004523F8 /* Accessibility.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Accessibility.idl; sourceTree = "<group>"; };
+               2974463A11FE257A004523F8 /* ScreenReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScreenReader.cpp; sourceTree = "<group>"; };
+               2974463B11FE257A004523F8 /* ScreenReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScreenReader.h; sourceTree = "<group>"; };
+               2974463C11FE257A004523F8 /* ScreenReader.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ScreenReader.idl; sourceTree = "<group>"; };
+               2974466D11FE2B32004523F8 /* JSAccessibility.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAccessibility.cpp; sourceTree = "<group>"; };
+               2974466E11FE2B32004523F8 /* JSAccessibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAccessibility.h; sourceTree = "<group>"; };
+               2974468C11FE2BE1004523F8 /* JSScreenReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScreenReader.cpp; sourceTree = "<group>"; };
+               2974468D11FE2BE1004523F8 /* JSScreenReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScreenReader.h; 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>"; };
                        isa = PBXGroup;
                        children = (
                                29A812050FBB9B5200510293 /* mac */,
+                               2974463711FE257A004523F8 /* Accessibility.cpp */,
+                               2974463811FE257A004523F8 /* Accessibility.h */,
+                               2974463911FE257A004523F8 /* Accessibility.idl */,
                                29A8120A0FBB9C1D00510293 /* AccessibilityARIAGrid.cpp */,
                                29A812160FBB9C1D00510293 /* AccessibilityARIAGrid.h */,
                                29A812120FBB9C1D00510293 /* AccessibilityARIAGridCell.cpp */,
                                29A812130FBB9C1D00510293 /* AccessibilityTableRow.h */,
                                29A812190FBB9C1D00510293 /* AXObjectCache.cpp */,
                                29A8121A0FBB9C1D00510293 /* AXObjectCache.h */,
+                               2974463A11FE257A004523F8 /* ScreenReader.cpp */,
+                               2974463B11FE257A004523F8 /* ScreenReader.h */,
+                               2974463C11FE257A004523F8 /* ScreenReader.idl */,
                        );
                        path = accessibility;
                        sourceTree = "<group>";
                A83B79100CCB001B000B0825 /* Core */ = {
                        isa = PBXGroup;
                        children = (
+                               2974466D11FE2B32004523F8 /* JSAccessibility.cpp */,
+                               2974466E11FE2B32004523F8 /* JSAccessibility.h */,
                                65DF31D809D1C122000BE325 /* JSAttr.cpp */,
                                65DF31D909D1C123000BE325 /* JSAttr.h */,
                                93F9B79E0BA6032600854064 /* JSCDATASection.cpp */,
                                65DF31EC09D1CC60000BE325 /* JSProcessingInstruction.h */,
                                E4B423850CBFB73C00AF2ECE /* JSProgressEvent.cpp */,
                                E4B423860CBFB73C00AF2ECE /* JSProgressEvent.h */,
+                               2974468C11FE2BE1004523F8 /* JSScreenReader.cpp */,
+                               2974468D11FE2BE1004523F8 /* JSScreenReader.h */,
                                65DF31EF09D1CC60000BE325 /* JSText.cpp */,
                                65DF31F009D1CC60000BE325 /* JSText.h */,
                        );
                        files = (
                                B5B5DC6A119BB3D5002A8790 /* AbstractDatabase.h in Headers */,
                                41E1B1D10FF5986900576B3B /* AbstractWorker.h in Headers */,
+                               2974463E11FE257A004523F8 /* Accessibility.h in Headers */,
                                29A8122E0FBB9C1D00510293 /* AccessibilityARIAGridCell.h in Headers */,
                                29A812330FBB9C1D00510293 /* AccessibilityARIAGridRow.h in Headers */,
                                29A8123B0FBB9C1D00510293 /* AccessibilityImageMapLink.h in Headers */,
                                59EE122E1106080F00885116 /* JNIUtilityPrivate.h in Headers */,
                                93309DF4099E64920056E581 /* JoinTextNodesCommand.h in Headers */,
                                418F88050FF957AF0080F045 /* JSAbstractWorker.h in Headers */,
+                               2974467011FE2B32004523F8 /* JSAccessibility.h in Headers */,
                                49EECF01105070C400099FAB /* JSArrayBuffer.h in Headers */,
                                49EECF1C105072F300099FAB /* JSArrayBufferView.h in Headers */,
                                86243D0111BC31F700CC006A /* JSArrayBufferViewHelper.h in Headers */,
                                BCFE2F120C1B58380020235F /* JSRect.h in Headers */,
                                BC74DA491013F468007987AD /* JSRGBColor.h in Headers */,
                                BCEC01C30C274DDD009F4EC9 /* JSScreen.h in Headers */,
+                               2974468F11FE2BE1004523F8 /* JSScreenReader.h in Headers */,
                                9FA37EFB1172FDA600C4CD55 /* JSScriptProfile.h in Headers */,
                                9FA37EFD1172FDA600C4CD55 /* JSScriptProfileNode.h in Headers */,
                                41D07A7F0FF935CA0095EDCE /* JSSharedWorker.h in Headers */,
                                1CEFC9B90D78DC8C007D2579 /* SchedulePair.h in Headers */,
                                5162C7F511F77EFB00612EFE /* SchemeRegistry.h in Headers */,
                                BCEC01BE0C274DAC009F4EC9 /* Screen.h in Headers */,
+                               2974464111FE257A004523F8 /* ScreenReader.h in Headers */,
                                A84D82C111D3474800972990 /* ScriptableDocumentParser.h in Headers */,
                                7A1E88F6101CC384000C4DF5 /* ScriptArray.h in Headers */,
                                7AFD4A8B1131C2760035B883 /* ScriptBreakpoint.h in Headers */,
                        files = (
                                B5B5DC69119BB3D5002A8790 /* AbstractDatabase.cpp in Sources */,
                                41E1B1D00FF5986900576B3B /* AbstractWorker.cpp in Sources */,
+                               2974463D11FE257A004523F8 /* Accessibility.cpp in Sources */,
                                29A812280FBB9C1D00510293 /* AccessibilityARIAGrid.cpp in Sources */,
                                29A812300FBB9C1D00510293 /* AccessibilityARIAGridCell.cpp in Sources */,
                                29A8122D0FBB9C1D00510293 /* AccessibilityARIAGridRow.cpp in Sources */,
                                59EE122C1106080500885116 /* JNIUtilityPrivate.cpp in Sources */,
                                93309DF3099E64920056E581 /* JoinTextNodesCommand.cpp in Sources */,
                                418F88040FF957AE0080F045 /* JSAbstractWorker.cpp in Sources */,
+                               2974466F11FE2B32004523F8 /* JSAccessibility.cpp in Sources */,
                                49EECF00105070C400099FAB /* JSArrayBuffer.cpp in Sources */,
                                BC275CB311C5E85C00C9206C /* JSArrayBufferCustom.cpp in Sources */,
                                49EECF1B105072F300099FAB /* JSArrayBufferView.cpp in Sources */,
                                BCFE2F110C1B58370020235F /* JSRect.cpp in Sources */,
                                BC74DA481013F468007987AD /* JSRGBColor.cpp in Sources */,
                                BCEC01C20C274DDD009F4EC9 /* JSScreen.cpp in Sources */,
+                               2974468E11FE2BE1004523F8 /* JSScreenReader.cpp in Sources */,
                                9FA37EFA1172FDA600C4CD55 /* JSScriptProfile.cpp in Sources */,
                                9FA37EFC1172FDA600C4CD55 /* JSScriptProfileNode.cpp in Sources */,
                                9FA37EE71172FCF000C4CD55 /* JSScriptProfileNodeCustom.cpp in Sources */,
                                1CE24F970D7CAF0E007E04C2 /* SchedulePairMac.mm in Sources */,
                                5162C7F411F77EFB00612EFE /* SchemeRegistry.cpp in Sources */,
                                BCEC01BD0C274DAC009F4EC9 /* Screen.cpp in Sources */,
+                               2974464011FE257A004523F8 /* ScreenReader.cpp in Sources */,
                                A84D82C211D3474800972990 /* ScriptableDocumentParser.cpp in Sources */,
                                7A1E88F5101CC384000C4DF5 /* ScriptArray.cpp in Sources */,
                                200B190911C277D900DCCD3A /* ScriptBreakpoint.cpp in Sources */,
index f18d08a..b9b5639 100644 (file)
@@ -119,6 +119,8 @@ public:
         AXRowCountChanged,
         AXRowCollapsed,
         AXRowExpanded,
+        AXScreenChanged,
+        AXElementsChanged
     };
 
     void postNotification(RenderObject*, AXNotification, bool postToElement, PostType = PostAsynchronously);
diff --git a/WebCore/accessibility/Accessibility.cpp b/WebCore/accessibility/Accessibility.cpp
new file mode 100644 (file)
index 0000000..abfaf30
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 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
+ * 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.
+ */
+
+#include "config.h"
+#include "Accessibility.h"
+
+#include "AXObjectCache.h"
+#include "AccessibilityObject.h"
+#include "Frame.h"
+#include "ScreenReader.h"
+
+namespace WebCore {
+
+Accessibility::Accessibility(Frame* frame)
+    : m_frame(frame) 
+{
+}
+
+Accessibility::~Accessibility()
+{
+    disconnectFrame();
+}
+
+void Accessibility::disconnectFrame()
+{
+    if (m_screenReader) {
+        m_screenReader->disconnectFrame();
+        m_screenReader = 0;
+    }
+    m_frame = 0;
+}
+    
+void Accessibility::screenChanged()
+{
+    if (!m_frame)
+        return;
+    
+    Document* doc = m_frame->document();
+    if (!doc)
+        return;
+    
+    AccessibilityObject* root = doc->axObjectCache()->getOrCreate(doc->renderer());
+    doc->axObjectCache()->postNotification(root, doc, AXObjectCache::AXScreenChanged, false);
+}
+
+void Accessibility::elementsChanged()
+{
+    if (!m_frame)
+        return;
+    
+    Document* doc = m_frame->document();
+    if (!doc)
+        return;
+    
+    AccessibilityObject* root = doc->axObjectCache()->getOrCreate(doc->renderer());
+    doc->axObjectCache()->postNotification(root, doc, AXObjectCache::AXElementsChanged, false);
+}
+    
+ScreenReader* Accessibility::screenReader() const
+{
+    if (!m_screenReader)
+        m_screenReader = ScreenReader::create(m_frame);
+    
+    return m_screenReader.get();
+}
+    
+} // namespace WebCore
+
diff --git a/WebCore/accessibility/Accessibility.h b/WebCore/accessibility/Accessibility.h
new file mode 100644 (file)
index 0000000..de4e526
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 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
+ * 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 Accessibility_h
+#define Accessibility_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+    
+class Frame;
+class ScreenReader;
+    
+class Accessibility : public RefCounted<Accessibility> {
+public:
+    static PassRefPtr<Accessibility> create(Frame* frame) { return adoptRef(new Accessibility(frame)); }
+    ~Accessibility();
+    
+    ScreenReader* screenReader() const;
+    void screenChanged();
+    void elementsChanged();
+    
+    void disconnectFrame();
+    
+private:
+    Accessibility(Frame*);
+    Frame* m_frame;
+    mutable RefPtr<ScreenReader> m_screenReader;
+};
+    
+} // namespace WebCore
+
+#endif // Accessibility_h
diff --git a/WebCore/accessibility/Accessibility.idl b/WebCore/accessibility/Accessibility.idl
new file mode 100644 (file)
index 0000000..5979020
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 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
+ * 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.
+ */
+
+module window {
+
+    interface [OmitConstructor] Accessibility {
+        readonly attribute ScreenReader screenReader;
+
+        void screenChanged();
+        void elementsChanged();
+
+    };
+}
index b8b0875..f6edfec 100644 (file)
 #include "AccessibilityObjectWrapper.h"
 #endif
 
+#if PLATFORM(MAC)
+#define SUPPORTS_JSACCESSIBILITY 1
+#else
+#define SUPPORTS_JSACCESSIBILITY 0
+#endif
+
 typedef struct _NSRange NSRange;
 
 #ifdef __OBJC__
@@ -548,6 +554,16 @@ public:
 #endif
 #endif
 
+#if SUPPORTS_JSACCESSIBILITY
+    bool isScreenReaderRunning() const;
+    Element* screenReaderFocusedElement() const;
+    String screenReaderVersion() const;
+#else
+    bool isScreenReaderRunning() const { return false; }
+    Element* screenReaderFocusedElement() const { return 0; }
+    String screenReaderVersion() const { return nullAtom; }
+#endif
+    
 #if HAVE(ACCESSIBILITY)
     // a platform-specific method for determining if an attachment is ignored
     bool accessibilityIgnoreAttachment() const;
diff --git a/WebCore/accessibility/ScreenReader.cpp b/WebCore/accessibility/ScreenReader.cpp
new file mode 100644 (file)
index 0000000..b098e31
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 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
+ * 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.
+ */
+
+#include "config.h"
+#include "ScreenReader.h"
+
+#include "AXObjectCache.h"
+#include "AccessibilityObject.h"
+#include "Document.h"
+#include "Element.h"
+#include "Frame.h"
+
+namespace WebCore {
+
+ScreenReader::ScreenReader(Frame* frame)
+    : m_frame(frame)
+{
+}
+
+ScreenReader::~ScreenReader()
+{
+    disconnectFrame();
+}
+    
+void ScreenReader::disconnectFrame()
+{
+    m_frame = 0;
+}
+
+bool ScreenReader::active() const
+{
+    if (!m_frame)
+        return false;
+    
+    Document* doc = m_frame->document();
+    if (!doc)
+        return false;
+    
+    AccessibilityObject* obj = doc->axObjectCache()->getOrCreate(doc->renderer());
+    return obj->isScreenReaderRunning();
+}
+    
+Element* ScreenReader::activeElement() const
+{
+    Document* doc = m_frame->document();
+    if (!doc)
+        return false;
+    
+    AccessibilityObject* obj = doc->axObjectCache()->getOrCreate(doc->renderer());
+    return obj->screenReaderFocusedElement();    
+}
+    
+String ScreenReader::version() const
+{
+    Document* doc = m_frame->document();
+    if (!doc)
+        return nullAtom;
+    
+    AccessibilityObject* obj = doc->axObjectCache()->getOrCreate(doc->renderer());
+    return obj->screenReaderVersion();
+}
+    
+} // namespace WebCore;
diff --git a/WebCore/accessibility/ScreenReader.h b/WebCore/accessibility/ScreenReader.h
new file mode 100644 (file)
index 0000000..98ffd05
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 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
+ * 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 ScreenReader_h
+#define ScreenReader_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+    
+class Element;
+class Frame;
+class String;
+    
+class ScreenReader : public RefCounted<ScreenReader> {
+public:
+    static PassRefPtr<ScreenReader> create(Frame* frame) { return adoptRef(new ScreenReader(frame)); }
+    ~ScreenReader();
+    
+    String version() const;
+    bool active() const;
+    Element* activeElement() const;
+    
+    void disconnectFrame();
+private:
+    ScreenReader(Frame*);
+    Frame* m_frame;
+};
+    
+} // namespace WebCore
+
+#endif // ScreenReader_h
diff --git a/WebCore/accessibility/ScreenReader.idl b/WebCore/accessibility/ScreenReader.idl
new file mode 100644 (file)
index 0000000..a821c92
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 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
+ * 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.
+ */
+
+module window {
+
+    interface  [OmitConstructor] ScreenReader {
+        readonly attribute DOMString version;
+        readonly attribute boolean active;
+        readonly attribute Element activeElement;
+    };
+
+}
+
index a02bc75..ff5970f 100644 (file)
@@ -76,6 +76,12 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotific
         case AXLayoutComplete:
             macNotification = "AXLayoutComplete";
             break;
+        case AXScreenChanged:
+            macNotification = "AXScreenChanged";
+            break;
+        case AXElementsChanged:
+            macNotification = "AXElementsChanged";
+            break;
         case AXLoadComplete:
             macNotification = "AXLoadComplete";
             break;
index 1076972..b6d351e 100644 (file)
 #if HAVE(ACCESSIBILITY)
 
 #import "AccessibilityObjectWrapper.h"
+#import "AXObjectCache.h"
 
 namespace WebCore {
 
+bool AccessibilityObject::isScreenReaderRunning() const
+{
+    // If the enhanced user interface is enabled, it means VoiceOver is running.
+    return AXObjectCache::accessibilityEnhancedUserInterfaceEnabled();
+}
+    
+Element* AccessibilityObject::screenReaderFocusedElement() const
+{
+    return 0;
+}
+    
+String AccessibilityObject::screenReaderVersion() const
+{ 
+    return nullAtom;
+}
+    
 bool AccessibilityObject::accessibilityIgnoreAttachment() const
 {
     NSView* attachment = [wrapper() attachmentView];
index 6c22fb1..e68507b 100644 (file)
@@ -23,6 +23,7 @@
 #include "config.h"
 #include "Navigator.h"
 
+#include "Accessibility.h"
 #include "Chrome.h"
 #include "CookieJar.h"
 #include "DOMMimeTypeArray.h"
@@ -66,6 +67,10 @@ void Navigator::disconnectFrame()
         m_geolocation->disconnectFrame();
         m_geolocation = 0;
     }
+    if (m_accessibility) {
+        m_accessibility->disconnectFrame();
+        m_accessibility = 0;
+    }
     m_frame = 0;
 }
 
@@ -127,6 +132,13 @@ DOMMimeTypeArray* Navigator::mimeTypes() const
         m_mimeTypes = DOMMimeTypeArray::create(m_frame);
     return m_mimeTypes.get();
 }
+    
+Accessibility* Navigator::accessibility() const
+{
+    if (!m_accessibility)
+        m_accessibility = Accessibility::create(m_frame);
+    return m_accessibility.get();
+}
 
 bool Navigator::cookieEnabled() const
 {
index 3a07126..2da39bc 100644 (file)
@@ -27,6 +27,7 @@
 
 namespace WebCore {
 
+class Accessibility;
 class DOMMimeTypeArray;
 class DOMPluginArray;
 class Frame;
@@ -46,6 +47,7 @@ public:
     String language() const;
     DOMPluginArray* plugins() const;
     DOMMimeTypeArray* mimeTypes() const;
+    Accessibility* accessibility() const;
     bool cookieEnabled() const;
     bool javaEnabled() const;
 
@@ -66,6 +68,7 @@ private:
     mutable RefPtr<DOMPluginArray> m_plugins;
     mutable RefPtr<DOMMimeTypeArray> m_mimeTypes;
     mutable RefPtr<Geolocation> m_geolocation;
+    mutable RefPtr<Accessibility> m_accessibility;
 };
 
 }
index e141e6c..a00e0a4 100644 (file)
@@ -31,6 +31,7 @@ module window {
         readonly attribute DOMString platform;
         readonly attribute DOMPluginArray plugins;
         readonly attribute DOMMimeTypeArray mimeTypes;
+        readonly attribute Accessibility accessibility;
         readonly attribute DOMString product;
         readonly attribute DOMString productSub;
         readonly attribute DOMString vendor;