summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorklink@chromium.org <klink@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-05 21:56:48 +0000
committerklink@chromium.org <klink@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-05 21:56:48 +0000
commit27937bdc5b5199c82784c90fb2af4746a7054895 (patch)
tree9e36ec7cd0bfc2996b87cfa6928bce0d783202c9
parent25b3433897bab5e94dac9ab8a2f09b356792ab7d (diff)
downloadchromium_src-27937bdc5b5199c82784c90fb2af4746a7054895.zip
chromium_src-27937bdc5b5199c82784c90fb2af4746a7054895.tar.gz
chromium_src-27937bdc5b5199c82784c90fb2af4746a7054895.tar.bz2
Fixes an issue where the MSAA information was not reported back correctly to the AT, upon the HWND containing the web content first receiving focus. Note that this is not a full fix for the bug below, but one more piece to resolving it.BUG=13291TEST=none
Review URL: http://codereview.chromium.org/118206 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17778 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser_accessibility.cc16
-rw-r--r--chrome/browser/browser_accessibility.h13
-rw-r--r--chrome/browser/browser_accessibility_manager.cc5
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.cc5
-rw-r--r--chrome/common/render_messages.h4
-rw-r--r--webkit/glue/webaccessibility.h4
-rw-r--r--webkit/glue/webaccessibilitymanager_impl.cc9
-rw-r--r--webkit/glue/webaccessibilitymanager_impl.h3
8 files changed, 17 insertions, 42 deletions
diff --git a/chrome/browser/browser_accessibility.cc b/chrome/browser/browser_accessibility.cc
index 9fade8d..8af5a6a 100644
--- a/chrome/browser/browser_accessibility.cc
+++ b/chrome/browser/browser_accessibility.cc
@@ -11,7 +11,9 @@ using webkit_glue::WebAccessibility;
HRESULT BrowserAccessibility::Initialize(int iaccessible_id, int routing_id,
int process_id, HWND parent_hwnd) {
- if (!parent_hwnd || iaccessible_id < 0)
+ // Check input parameters. Root id is 1000, to avoid conflicts with the ids
+ // used by MSAA.
+ if (!parent_hwnd || iaccessible_id < 1000)
return E_INVALIDARG;
iaccessible_id_ = iaccessible_id;
@@ -21,10 +23,6 @@ HRESULT BrowserAccessibility::Initialize(int iaccessible_id, int routing_id,
// Mark instance as active.
instance_active_ = true;
-
- // Treat child ids intitially as referring to direct children of the object.
- direct_descendant_ = true;
-
return S_OK;
}
@@ -192,7 +190,7 @@ STDMETHODIMP BrowserAccessibility::get_accChild(VARIANT var_child,
return E_INVALIDARG;
// If var_child is the parent, remain with the same IDispatch.
- if (var_child.lVal == CHILDID_SELF && iaccessible_id_ != 0)
+ if (var_child.lVal == CHILDID_SELF && iaccessible_id_ != 1000)
return S_OK;
if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_GETCHILD, var_child,
@@ -411,7 +409,7 @@ STDMETHODIMP BrowserAccessibility::get_accParent(IDispatch** disp_parent) {
return E_INVALIDARG;
// Root node's parent is the containing HWND's IAccessible.
- if (iaccessible_id_ == 0) {
+ if (iaccessible_id_ == 1000) {
// For an object that has no parent (e.g. root), point the accessible parent
// to the default implementation.
HRESULT hr =
@@ -548,13 +546,9 @@ bool BrowserAccessibility::RequestAccessibilityInfo(int iaccessible_func_id,
in_params.object_id = iaccessible_id_;
in_params.function_id = iaccessible_func_id;
in_params.child_id = var_id.lVal;
- in_params.direct_descendant = direct_descendant();
in_params.input_long1 = input1;
in_params.input_long2 = input2;
- if (!direct_descendant())
- set_direct_descendant(true);
-
return BrowserAccessibilityManager::GetInstance()->
RequestAccessibilityInfo(&in_params, routing_id_, process_id_);
}
diff --git a/chrome/browser/browser_accessibility.h b/chrome/browser/browser_accessibility.h
index c8d4187..43b8b19 100644
--- a/chrome/browser/browser_accessibility.h
+++ b/chrome/browser/browser_accessibility.h
@@ -116,11 +116,6 @@ class ATL_NO_VTABLE BrowserAccessibility
}
int instance_active() const { return instance_active_; }
- void set_direct_descendant(bool direct_descendant) {
- direct_descendant_ = direct_descendant;
- }
- bool direct_descendant() const { return direct_descendant_; }
-
int routing_id() const { return routing_id_; }
private:
@@ -171,14 +166,6 @@ class ATL_NO_VTABLE BrowserAccessibility
HWND parent_hwnd_;
- // Indicates if an incoming request for child information relates to a child
- // id of a direct child of the BrowserAccessibility object, or if it refers
- // to an object elsewhere in the MSAA tree. Set by BrowserAccessibilityManager
- // and applicable only to the root BrowserAccessibility object (id 0). Needed
- // to properly handled MSAA focus events, where the child id is the only
- // parameter in our control.
- bool direct_descendant_;
-
// The instance should only be active if there is a non-terminated
// RenderProcessHost associated with it. The BrowserAccessibilityManager keeps
// track of this state, and sets it to false to disable all calls into the
diff --git a/chrome/browser/browser_accessibility_manager.cc b/chrome/browser/browser_accessibility_manager.cc
index 5190870..b2945e9 100644
--- a/chrome/browser/browser_accessibility_manager.cc
+++ b/chrome/browser/browser_accessibility_manager.cc
@@ -77,7 +77,6 @@ bool BrowserAccessibilityManager::RequestAccessibilityInfo(
in_params.object_id = in->object_id;
in_params.function_id = in->function_id;
in_params.child_id = in->child_id;
- in_params.direct_descendant = in->direct_descendant;
in_params.input_long1 = in->input_long1;
in_params.input_long2 = in->input_long2;
@@ -103,10 +102,6 @@ bool BrowserAccessibilityManager::ChangeAccessibilityFocus(int acc_obj_id,
BrowserAccessibility* browser_acc =
GetBrowserAccessibility(process_id, routing_id);
if (browser_acc) {
- // Indicate that the request for child information is referring to a non-
- // direct descendant of the root.
- browser_acc->set_direct_descendant(false);
-
// Notify Access Technology that there was a change in keyboard focus.
::NotifyWinEvent(EVENT_OBJECT_FOCUS, browser_acc->parent_hwnd(),
OBJID_CLIENT, static_cast<LONG>(acc_obj_id));
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc
index 8ac108c..6f2f835 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc
@@ -1200,9 +1200,10 @@ LRESULT RenderWidgetHostViewWin::OnGetObject(UINT message, WPARAM wparam,
// If our MSAA DOM root is already created, reuse that pointer. Otherwise,
// create a new one.
if (!browser_accessibility_root_) {
- // Create a new instance of IAccessible. Root id is always 0.
+ // Create a new instance of IAccessible. Root id is 1000, to avoid
+ // conflicts with the ids used by MSAA.
BrowserAccessibilityManager::GetInstance()->
- CreateAccessibilityInstance(IID_IAccessible, 0,
+ CreateAccessibilityInstance(IID_IAccessible, 1000,
render_widget_host_->routing_id(),
render_widget_host_->process()->pid(),
m_hWnd, reinterpret_cast<void **>
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 6ec1566..5719ce9 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -520,7 +520,6 @@ struct ParamTraits<webkit_glue::WebAccessibility::InParams> {
WriteParam(m, p.object_id);
WriteParam(m, p.function_id);
WriteParam(m, p.child_id);
- WriteParam(m, p.direct_descendant);
WriteParam(m, p.input_long1);
WriteParam(m, p.input_long2);
}
@@ -529,7 +528,6 @@ struct ParamTraits<webkit_glue::WebAccessibility::InParams> {
ReadParam(m, iter, &p->object_id) &&
ReadParam(m, iter, &p->function_id) &&
ReadParam(m, iter, &p->child_id) &&
- ReadParam(m, iter, &p->direct_descendant) &&
ReadParam(m, iter, &p->input_long1) &&
ReadParam(m, iter, &p->input_long2);
}
@@ -541,8 +539,6 @@ struct ParamTraits<webkit_glue::WebAccessibility::InParams> {
l->append(L", ");
LogParam(p.child_id, l);
l->append(L", ");
- LogParam(p.direct_descendant, l);
- l->append(L", ");
LogParam(p.input_long1, l);
l->append(L", ");
LogParam(p.input_long2, l);
diff --git a/webkit/glue/webaccessibility.h b/webkit/glue/webaccessibility.h
index 250c665..538e612 100644
--- a/webkit/glue/webaccessibility.h
+++ b/webkit/glue/webaccessibility.h
@@ -117,10 +117,6 @@ class WebAccessibility {
// Id of accessible child, whose information is being requested.
int child_id;
- // Indicates if the |child_id| refers to a direct child of the active
- // accessibility object (true) or not (false).
- bool direct_descendant;
-
// LONG input parameters, used differently depending on the function called.
long input_long1;
long input_long2;
diff --git a/webkit/glue/webaccessibilitymanager_impl.cc b/webkit/glue/webaccessibilitymanager_impl.cc
index f765127..382c6057a 100644
--- a/webkit/glue/webaccessibilitymanager_impl.cc
+++ b/webkit/glue/webaccessibilitymanager_impl.cc
@@ -35,7 +35,7 @@ WebAccessibilityManager* WebAccessibilityManager::Create() {
// class WebAccessibilityManagerImpl
WebAccessibilityManagerImpl::WebAccessibilityManagerImpl()
: root_(new GlueAccessibilityObjectRoot),
- acc_obj_id_(0) {
+ acc_obj_id_(1000) {
}
WebAccessibilityManagerImpl::~WebAccessibilityManagerImpl() {
@@ -55,7 +55,10 @@ bool WebAccessibilityManagerImpl::GetAccObjInfo(WebView* view,
int object_id = in_params.object_id;
int child_id = in_params.child_id;
- if (!in_params.direct_descendant) {
+ // Since ids assigned by Chrome starts at 1000, whereas platform-specific ids
+ // used to reference a child will be in a wholly different range, we know
+ // that any id that high should be treated as a non-direct descendant.
+ if (in_params.child_id >= 1000) {
// Object is not a direct child, re-map the input parameters accordingly.
// The object to be retrieved is referred to by the |in_params.child_id|, as
// a result of e.g. a focus event. The local |child_id| is set to 0, to
@@ -247,7 +250,7 @@ bool WebAccessibilityManagerImpl::ClearAccObjMap(int acc_obj_id,
}
int_to_glue_acc_obj_map_.erase(it);
- if (acc_obj_id == 0) {
+ if (acc_obj_id == 1000) {
// Invalidate root.
root_->acc_obj_root_ = 0;
}
diff --git a/webkit/glue/webaccessibilitymanager_impl.h b/webkit/glue/webaccessibilitymanager_impl.h
index 1bc0607..be14bec 100644
--- a/webkit/glue/webaccessibilitymanager_impl.h
+++ b/webkit/glue/webaccessibilitymanager_impl.h
@@ -35,6 +35,9 @@ class WebAccessibilityManagerImpl : public WebAccessibilityManager {
// Needed so WebAccessibilityManager::Create can call our constructor.
friend class WebAccessibilityManager;
+ // Constructor creates a new GlueAccessibilityObjectRoot, and initializes
+ // the root |acc_obj_id_| to 1000, to avoid conflicts with platform-specific
+ // child ids.
WebAccessibilityManagerImpl();
~WebAccessibilityManagerImpl();