Index: chrome/browser/browser_accessibility.cc |
=================================================================== |
--- chrome/browser/browser_accessibility.cc (revision 39785) |
+++ chrome/browser/browser_accessibility.cc (working copy) |
@@ -29,7 +29,7 @@ |
HRESULT BrowserAccessibility::accDoDefaultAction(VARIANT var_id) { |
if (!instance_active()) { |
// Instance no longer active, fail gracefully. |
- // TODO(klink): Once we have MSAA events, change these fails to having |
+ // TODO(ctguil): Once we have MSAA events, change these fails to having |
// BrowserAccessibilityManager firing the right event. |
return E_FAIL; |
} |
@@ -42,7 +42,7 @@ |
return E_FAIL; |
} |
- if (!response().return_code) |
+ if (response().return_code == WebAccessibility::RETURNCODE_FALSE) |
return S_FALSE; |
return S_OK; |
@@ -69,11 +69,11 @@ |
::ScreenToClient(parent_hwnd_, &p); |
if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_HITTEST, |
- EmptyVariant(), p.x, p.y)) { |
+ ChildSelfVariant(), p.x, p.y)) { |
return E_FAIL; |
} |
- if (!response().return_code) { |
+ if (response().return_code == WebAccessibility::RETURNCODE_FALSE) { |
// The point is outside of the object's boundaries. |
child->vt = VT_EMPTY; |
return S_FALSE; |
@@ -156,7 +156,7 @@ |
return E_FAIL; |
} |
- if (!response().return_code) { |
+ if (response().return_code == WebAccessibility::RETURNCODE_FALSE) { |
// No screen element was found in the specified direction. |
end->vt = VT_EMPTY; |
return S_FALSE; |
@@ -198,7 +198,8 @@ |
return E_FAIL; |
} |
- if (!response().return_code) { |
+ // TODO(ctguil): Figure out when the return code would be false |
+ if (response().return_code == WebAccessibility::RETURNCODE_FALSE) { |
// When at a leaf, children are handled by the parent object. |
*disp_child = NULL; |
return S_FALSE; |
@@ -226,7 +227,7 @@ |
return E_INVALIDARG; |
if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_CHILDCOUNT, |
- EmptyVariant(), NULL, NULL)) { |
+ ChildSelfVariant(), NULL, NULL)) { |
return E_FAIL; |
} |
@@ -249,7 +250,7 @@ |
return E_FAIL; |
} |
- if (!response().return_code) { |
+ if (response().return_code == WebAccessibility::RETURNCODE_FALSE) { |
// No string found. |
return S_FALSE; |
} |
@@ -275,7 +276,7 @@ |
return E_FAIL; |
} |
- if (!response().return_code) { |
+ if (response().return_code == WebAccessibility::RETURNCODE_FALSE) { |
// No string found. |
return S_FALSE; |
} |
@@ -296,11 +297,11 @@ |
return E_INVALIDARG; |
if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_GETFOCUSEDCHILD, |
- EmptyVariant(), NULL, NULL)) { |
+ ChildSelfVariant(), NULL, NULL)) { |
return E_FAIL; |
} |
- if (!response().return_code) { |
+ if (response().return_code == WebAccessibility::RETURNCODE_FALSE) { |
// The window that contains this object is not the active window. |
focus_child->vt = VT_EMPTY; |
return S_FALSE; |
@@ -337,7 +338,8 @@ |
return E_FAIL; |
} |
- if (!response().return_code || response().output_string.empty()) { |
+ if (response().return_code == WebAccessibility::RETURNCODE_FALSE || |
+ response().output_string.empty()) { |
// No string found. |
return S_FALSE; |
} |
@@ -363,7 +365,7 @@ |
return E_FAIL; |
} |
- if (!response().return_code) { |
+ if (response().return_code == WebAccessibility::RETURNCODE_FALSE) { |
// No string found. |
return S_FALSE; |
} |
@@ -388,7 +390,7 @@ |
return E_FAIL; |
} |
- if (!response().return_code) { |
+ if (response().return_code == WebAccessibility::RETURNCODE_FALSE) { |
// No string found. |
return S_FALSE; |
} |
@@ -425,11 +427,11 @@ |
} |
if (!RequestAccessibilityInfo(WebAccessibility::FUNCTION_GETPARENT, |
- EmptyVariant(), NULL, NULL)) { |
+ ChildSelfVariant(), NULL, NULL)) { |
return E_FAIL; |
} |
- if (!response().return_code) { |
+ if (response().return_code == WebAccessibility::RETURNCODE_FALSE) { |
// No parent exists for this object. |
return S_FALSE; |
} |
@@ -499,7 +501,8 @@ |
return E_FAIL; |
} |
- if (!response().return_code || response().output_string.empty()) { |
+ if (response().return_code == WebAccessibility::RETURNCODE_FALSE || |
+ response().output_string.empty()) { |
// No string found. |
return S_FALSE; |
} |
@@ -540,17 +543,20 @@ |
bool BrowserAccessibility::RequestAccessibilityInfo(int iaccessible_func_id, |
VARIANT var_id, LONG input1, |
LONG input2) { |
+ DCHECK(V_VT(&var_id) == VT_I4); |
+ |
// Create and populate IPC message structure, for retrieval of accessibility |
// information from the renderer. |
WebAccessibility::InParams in_params; |
in_params.object_id = iaccessible_id_; |
in_params.function_id = iaccessible_func_id; |
- in_params.child_id = var_id.lVal; |
+ in_params.child_id = V_I4(&var_id); |
in_params.input_long1 = input1; |
in_params.input_long2 = input2; |
return BrowserAccessibilityManager::GetInstance()-> |
- RequestAccessibilityInfo(&in_params, routing_id_, process_id_); |
+ RequestAccessibilityInfo(&in_params, routing_id_, process_id_) && |
+ response().return_code != WebAccessibility::RETURNCODE_FAIL; |
} |
const WebAccessibility::OutParams& BrowserAccessibility::response() { |