| 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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 return E_FAIL; | 493 return E_FAIL; |
| 494 | 494 |
| 495 if (!disp_parent) | 495 if (!disp_parent) |
| 496 return E_INVALIDARG; | 496 return E_INVALIDARG; |
| 497 | 497 |
| 498 IAccessible* parent_obj = GetParent()->ToBrowserAccessibilityWin(); | 498 IAccessible* parent_obj = GetParent()->ToBrowserAccessibilityWin(); |
| 499 if (parent_obj == NULL) { | 499 if (parent_obj == NULL) { |
| 500 // This happens if we're the root of the tree; | 500 // This happens if we're the root of the tree; |
| 501 // return the IAccessible for the window. | 501 // return the IAccessible for the window. |
| 502 parent_obj = | 502 parent_obj = |
| 503 manager()->ToBrowserAccessibilityManagerWin()->parent_iaccessible(); | 503 manager()->ToBrowserAccessibilityManagerWin()->GetParentIAccessible(); |
| 504 // |parent| can only be NULL if the manager was created before the parent | 504 // |parent| can only be NULL if the manager was created before the parent |
| 505 // IAccessible was known and it wasn't subsequently set before a client | 505 // IAccessible was known and it wasn't subsequently set before a client |
| 506 // requested it. This has been fixed. |parent| may also be NULL during | 506 // requested it. This has been fixed. |parent| may also be NULL during |
| 507 // destruction. Possible cases where this could occur include tabs being | 507 // destruction. Possible cases where this could occur include tabs being |
| 508 // dragged to a new window, etc. | 508 // dragged to a new window, etc. |
| 509 if (!parent_obj) { | 509 if (!parent_obj) { |
| 510 DVLOG(1) << "In Function: " | 510 DVLOG(1) << "In Function: " |
| 511 << __FUNCTION__ | 511 << __FUNCTION__ |
| 512 << ". Parent IAccessible interface is NULL. Returning failure"; | 512 << ". Parent IAccessible interface is NULL. Returning failure"; |
| 513 return E_FAIL; | 513 return E_FAIL; |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 return S_OK; | 733 return S_OK; |
| 734 } | 734 } |
| 735 | 735 |
| 736 STDMETHODIMP BrowserAccessibilityWin::get_windowHandle(HWND* window_handle) { | 736 STDMETHODIMP BrowserAccessibilityWin::get_windowHandle(HWND* window_handle) { |
| 737 if (!instance_active()) | 737 if (!instance_active()) |
| 738 return E_FAIL; | 738 return E_FAIL; |
| 739 | 739 |
| 740 if (!window_handle) | 740 if (!window_handle) |
| 741 return E_INVALIDARG; | 741 return E_INVALIDARG; |
| 742 | 742 |
| 743 *window_handle = manager()->ToBrowserAccessibilityManagerWin()->parent_hwnd(); | 743 *window_handle = |
| 744 manager()->ToBrowserAccessibilityManagerWin()->GetParentHWND(); |
| 744 if (!*window_handle) | 745 if (!*window_handle) |
| 745 return E_FAIL; | 746 return E_FAIL; |
| 746 | 747 |
| 747 return S_OK; | 748 return S_OK; |
| 748 } | 749 } |
| 749 | 750 |
| 750 STDMETHODIMP BrowserAccessibilityWin::get_indexInParent(LONG* index_in_parent) { | 751 STDMETHODIMP BrowserAccessibilityWin::get_indexInParent(LONG* index_in_parent) { |
| 751 if (!instance_active()) | 752 if (!instance_active()) |
| 752 return E_FAIL; | 753 return E_FAIL; |
| 753 | 754 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 LONG* x, | 990 LONG* x, |
| 990 LONG* y) { | 991 LONG* y) { |
| 991 if (!instance_active()) | 992 if (!instance_active()) |
| 992 return E_FAIL; | 993 return E_FAIL; |
| 993 | 994 |
| 994 if (!x || !y) | 995 if (!x || !y) |
| 995 return E_INVALIDARG; | 996 return E_INVALIDARG; |
| 996 | 997 |
| 997 if (coordinate_type == IA2_COORDTYPE_SCREEN_RELATIVE) { | 998 if (coordinate_type == IA2_COORDTYPE_SCREEN_RELATIVE) { |
| 998 HWND parent_hwnd = | 999 HWND parent_hwnd = |
| 999 manager()->ToBrowserAccessibilityManagerWin()->parent_hwnd(); | 1000 manager()->ToBrowserAccessibilityManagerWin()->GetParentHWND(); |
| 1000 if (!parent_hwnd) | 1001 if (!parent_hwnd) |
| 1001 return E_FAIL; | 1002 return E_FAIL; |
| 1002 POINT top_left = {0, 0}; | 1003 POINT top_left = {0, 0}; |
| 1003 ::ClientToScreen(parent_hwnd, &top_left); | 1004 ::ClientToScreen(parent_hwnd, &top_left); |
| 1004 *x = GetLocation().x() + top_left.x; | 1005 *x = GetLocation().x() + top_left.x; |
| 1005 *y = GetLocation().y() + top_left.y; | 1006 *y = GetLocation().y() + top_left.y; |
| 1006 } else if (coordinate_type == IA2_COORDTYPE_PARENT_RELATIVE) { | 1007 } else if (coordinate_type == IA2_COORDTYPE_PARENT_RELATIVE) { |
| 1007 *x = GetLocation().x(); | 1008 *x = GetLocation().x(); |
| 1008 *y = GetLocation().y(); | 1009 *y = GetLocation().y(); |
| 1009 if (GetParent()) { | 1010 if (GetParent()) { |
| (...skipping 2782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3792 // The role should always be set. | 3793 // The role should always be set. |
| 3793 DCHECK(!role_name_.empty() || ia_role_); | 3794 DCHECK(!role_name_.empty() || ia_role_); |
| 3794 | 3795 |
| 3795 // If we didn't explicitly set the IAccessible2 role, make it the same | 3796 // If we didn't explicitly set the IAccessible2 role, make it the same |
| 3796 // as the MSAA role. | 3797 // as the MSAA role. |
| 3797 if (!ia2_role_) | 3798 if (!ia2_role_) |
| 3798 ia2_role_ = ia_role_; | 3799 ia2_role_ = ia_role_; |
| 3799 } | 3800 } |
| 3800 | 3801 |
| 3801 } // namespace content | 3802 } // namespace content |
| OLD | NEW |