Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/accessibility/browser_accessibility_win.h" | 5 #include "content/browser/accessibility/browser_accessibility_win.h" |
| 6 | 6 |
| 7 #include <UIAutomationClient.h> | 7 #include <UIAutomationClient.h> |
| 8 #include <UIAutomationCoreApi.h> | 8 #include <UIAutomationCoreApi.h> |
| 9 | 9 |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 return S_OK; | 351 return S_OK; |
| 352 } | 352 } |
| 353 | 353 |
| 354 STDMETHODIMP BrowserAccessibilityWin::get_accChildCount(LONG* child_count) { | 354 STDMETHODIMP BrowserAccessibilityWin::get_accChildCount(LONG* child_count) { |
| 355 if (!instance_active_) | 355 if (!instance_active_) |
| 356 return E_FAIL; | 356 return E_FAIL; |
| 357 | 357 |
| 358 if (!child_count) | 358 if (!child_count) |
| 359 return E_INVALIDARG; | 359 return E_INVALIDARG; |
| 360 | 360 |
| 361 *child_count = children_.size(); | 361 if (IsLeaf()) |
| 362 *child_count = 0; | |
| 363 else | |
| 364 *child_count = children_.size(); | |
| 365 | |
| 362 return S_OK; | 366 return S_OK; |
| 363 } | 367 } |
| 364 | 368 |
| 365 STDMETHODIMP BrowserAccessibilityWin::get_accDefaultAction(VARIANT var_id, | 369 STDMETHODIMP BrowserAccessibilityWin::get_accDefaultAction(VARIANT var_id, |
| 366 BSTR* def_action) { | 370 BSTR* def_action) { |
| 367 if (!instance_active_) | 371 if (!instance_active_) |
| 368 return E_FAIL; | 372 return E_FAIL; |
| 369 | 373 |
| 370 if (!def_action) | 374 if (!def_action) |
| 371 return E_INVALIDARG; | 375 return E_INVALIDARG; |
| (...skipping 2239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2611 | 2615 |
| 2612 STDMETHODIMP BrowserAccessibilityWin::get_childAt( | 2616 STDMETHODIMP BrowserAccessibilityWin::get_childAt( |
| 2613 unsigned int child_index, | 2617 unsigned int child_index, |
| 2614 ISimpleDOMNode** node) { | 2618 ISimpleDOMNode** node) { |
| 2615 if (!instance_active_) | 2619 if (!instance_active_) |
| 2616 return E_FAIL; | 2620 return E_FAIL; |
| 2617 | 2621 |
| 2618 if (!node) | 2622 if (!node) |
| 2619 return E_INVALIDARG; | 2623 return E_INVALIDARG; |
| 2620 | 2624 |
| 2621 if (child_index < children_.size()) { | 2625 if (IsLeaf() || child_index < children_.size()) { |
|
David Tseng
2013/10/23 16:42:46
I'm confused by this indexing logic; child_index
dmazzoni
2013/10/30 16:45:26
Ack! Yes, you found a longstanding bug. We never c
| |
| 2622 *node = NULL; | 2626 *node = NULL; |
| 2623 return S_FALSE; | 2627 return S_FALSE; |
| 2624 } | 2628 } |
| 2625 | 2629 |
| 2626 *node = children_[child_index]->ToBrowserAccessibilityWin()->NewReference(); | 2630 *node = children_[child_index]->ToBrowserAccessibilityWin()->NewReference(); |
| 2627 return S_OK; | 2631 return S_OK; |
| 2628 } | 2632 } |
| 2629 | 2633 |
| 2630 // | 2634 // |
| 2631 // ISimpleDOMText methods. | 2635 // ISimpleDOMText methods. |
| (...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3661 // The role should always be set. | 3665 // The role should always be set. |
| 3662 DCHECK(!role_name_.empty() || ia_role_); | 3666 DCHECK(!role_name_.empty() || ia_role_); |
| 3663 | 3667 |
| 3664 // If we didn't explicitly set the IAccessible2 role, make it the same | 3668 // If we didn't explicitly set the IAccessible2 role, make it the same |
| 3665 // as the MSAA role. | 3669 // as the MSAA role. |
| 3666 if (!ia2_role_) | 3670 if (!ia2_role_) |
| 3667 ia2_role_ = ia_role_; | 3671 ia2_role_ = ia_role_; |
| 3668 } | 3672 } |
| 3669 | 3673 |
| 3670 } // namespace content | 3674 } // namespace content |
| OLD | NEW |