diff options
author | dmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-10 20:21:41 +0000 |
---|---|---|
committer | dmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-10 20:21:41 +0000 |
commit | 9f4db510a3ba5dd8447d9f7b60827d926e13ed5e (patch) | |
tree | 1a39331bc057c956d3ed3add243836ac8fa94402 /webkit/glue/webaccessibility.h | |
parent | 5cff506ccd4f4381bfdf0620b308cb105abd4719 (diff) | |
download | chromium_src-9f4db510a3ba5dd8447d9f7b60827d926e13ed5e.zip chromium_src-9f4db510a3ba5dd8447d9f7b60827d926e13ed5e.tar.gz chromium_src-9f4db510a3ba5dd8447d9f7b60827d926e13ed5e.tar.bz2 |
Revert 46842 - Reimplement accessibility of web content by caching the entire
accessibility tree in the browser process.
Adds new RPCs for a browser tab to request accessibility info from
a renderer; the renderer responds with a complete tree of
accessibility metadata for the entire DOM, which is then cached
in the RenderWidgetHostView. This part is crossplatform and will
help with accessibility on both Windows and Mac OS X.
For Windows, MSAA support for web content has been rewritten to
use this new cache. Tested in JAWS and NVDA screen readers.
Using Chrome with a screen reader is now fast and stable,
unlike the previous implementation. However, note that most
advanced functionality is still not supported, and much work remains
to make Chrome work well with a screen reader. This is a necessary
step to improve stability first.
BUG=25564
BUG=13291
TEST=See http://codereview.chromium.org/1806001
Review URL: http://codereview.chromium.org/1637018
TBR=dmazzoni@chromium.org
Review URL: http://codereview.chromium.org/1989009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46847 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webaccessibility.h')
-rw-r--r-- | webkit/glue/webaccessibility.h | 158 |
1 files changed, 113 insertions, 45 deletions
diff --git a/webkit/glue/webaccessibility.h b/webkit/glue/webaccessibility.h index ea000e7..4bfd7743 100644 --- a/webkit/glue/webaccessibility.h +++ b/webkit/glue/webaccessibility.h @@ -1,16 +1,11 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef WEBKIT_GLUE_WEBACCESSIBILITY_H_ #define WEBKIT_GLUE_WEBACCESSIBILITY_H_ -#include <vector> - #include "base/string16.h" -#include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h" -#include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityRole.h" -#include "third_party/WebKit/WebKit/chromium/public/WebRect.h" namespace WebKit { class WebAccessibilityCache; @@ -18,15 +13,62 @@ class WebAccessibilityCache; namespace webkit_glue { -// A compact representation of the accessibility information for a -// single web object, in a form that can be serialized and sent from -// the renderer process to the browser process. -struct WebAccessibility { +class WebAccessibility { public: - // An alphabetical enumeration of accessibility roles. - enum Role { - ROLE_NONE = 0, + // This defines an enumeration of IDs that can uniquely identify a call to a + // specific accessibility information function. Should match the support + // implemented in WebKit and GlueAccessibilityObject (functions marked with + // return value E_NOTIMPL in WebKit are also excluded). + enum Function { + FUNCTION_NONE = 0, + + // Supported accessibility information retrieval functions. + FUNCTION_DODEFAULTACTION, + FUNCTION_HITTEST, + FUNCTION_LOCATION, + FUNCTION_NAVIGATE, + FUNCTION_GETCHILD, + FUNCTION_CHILDCOUNT, + FUNCTION_DEFAULTACTION, + FUNCTION_DESCRIPTION, + FUNCTION_GETFOCUSEDCHILD, + FUNCTION_HELPTEXT, + FUNCTION_KEYBOARDSHORTCUT, + FUNCTION_NAME, + FUNCTION_GETPARENT, + FUNCTION_ROLE, + FUNCTION_STATE, + FUNCTION_VALUE + + // The deprecated put_accName and put_accValue (IAccessible) are not + // supported here, nor is accSelect, get_accHelpTopic and get_accSelection + // (matching WebKit's support for IAccessible). + }; + + // This defines an enumeration of navigation directions based on (but + // independent of) the MSAA Navigation Constants. However, to avoid the use of + // COM in our Glue layer, we use this as a substitute with a one-to-one + // conversion between Browser side (has COM) and Glue. + enum Direction { + DIRECTION_NONE = 0, + // Valid directions. + DIRECTION_UP, + DIRECTION_DOWN, + DIRECTION_LEFT, + DIRECTION_RIGHT, + DIRECTION_NEXT, + DIRECTION_PREVIOUS, + DIRECTION_FIRSTCHILD, + DIRECTION_LASTCHILD + }; + + // This defines an enumeration (in alphabetical order) of the supported + // accessibility roles in our Glue layer (used in + // GlueAccessibilityObject::Role). Any interface using roles must provide a + // conversion to its own roles (see e.g. BrowserAccessibility::get_accRole and + // BrowserAccessibility::MSAARole). + enum Role { ROLE_APPLICATION, ROLE_CELL, ROLE_CHECKBUTTON, @@ -57,14 +99,14 @@ struct WebAccessibility { ROLE_TABLE, ROLE_TEXT, ROLE_TOOLBAR, - ROLE_TOOLTIP, - NUM_ROLES + ROLE_TOOLTIP }; - // An alphabetical enumeration of accessibility states. - // A state bitmask is formed by shifting 1 to the left by each state, - // for example: - // int mask = (1 << STATE_CHECKED) | (1 << STATE_FOCUSED); + // This defines an enumeration (in alphabetical order) of the supported + // accessibility states in our Glue layer (used in + // GlueAccessibilityObject::State). Any interface using states must provide a + // conversion to its own states (see e.g. BrowserAccessibility::get_accState + // and BrowserAccessibility::MSAAState). enum State { STATE_CHECKED, STATE_FOCUSABLE, @@ -81,32 +123,58 @@ struct WebAccessibility { STATE_UNAVAILABLE }; - // Empty constructor, for serialization. - WebAccessibility(); - - // Construct from a WebAccessibilityObject. Recursively creates child - // nodes as needed to complete the tree. Adds |src| to |cache| and - // stores its cache ID. - WebAccessibility(const WebKit::WebAccessibilityObject& src, - WebKit::WebAccessibilityCache* cache); - - // Initialize an already-created struct, same as the constructor a - void Init(const WebKit::WebAccessibilityObject& src, - WebKit::WebAccessibilityCache* cache); - - // This is a simple serializable struct. All member variables should be - // copyable. - int32 id; - string16 name; - string16 value; - string16 action; - string16 description; - string16 help; - string16 shortcut; - Role role; - uint32 state; - WebKit::WebRect location; - std::vector<WebAccessibility> children; + enum ReturnCode { + RETURNCODE_TRUE, // MSAA S_OK + RETURNCODE_FALSE, // MSAA S_FALSE + RETURNCODE_FAIL // E_FAIL + }; + + // Parameters structure to hold a union of the possible accessibility function + // INPUT variables, with the unused fields always set to default value. Used + // in ViewMsg_GetAccessibilityInfo, as only parameter. + struct InParams { + // Identifier to uniquely distinguish which instance of accessibility + // information is being called upon on the renderer side. + int object_id; + + // Identifier to resolve which accessibility information retrieval function + // is being called. + int function_id; + + // Id of accessible child, whose information is being requested. + int child_id; + + // LONG input parameters, used differently depending on the function called. + long input_long1; + long input_long2; + }; + + // Parameters structure to hold a union of the possible accessibility function + // OUTPUT variables, with the unused fields always set to default value. Used + // in ViewHostMsg_GetAccessibilityInfoResponse, as only parameter. + struct OutParams { + // Identifier to uniquely distinguish which instance of accessibility + // information is being called upon on the renderer side. + int object_id; + + // LONG output parameters, used differently depending on the function + // called. [output_long1] can in some cases be set to -1 to indicate that + // the child object found by the called IAccessible function is not a simple + // object. + long output_long1; + long output_long2; + long output_long3; + long output_long4; + + // String output parameter. + string16 output_string; + + // Return code of the accessibility function call. + int32 return_code; + }; + + static int32 GetAccObjInfo(WebKit::WebAccessibilityCache* cache, + const InParams& in_params, OutParams* out_params); }; } // namespace webkit_glue |