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 2846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2857 // | 2857 // |
2858 // CComObjectRootEx methods. | 2858 // CComObjectRootEx methods. |
2859 // | 2859 // |
2860 | 2860 |
2861 // static | 2861 // static |
2862 HRESULT WINAPI BrowserAccessibilityWin::InternalQueryInterface( | 2862 HRESULT WINAPI BrowserAccessibilityWin::InternalQueryInterface( |
2863 void* this_ptr, | 2863 void* this_ptr, |
2864 const _ATL_INTMAP_ENTRY* entries, | 2864 const _ATL_INTMAP_ENTRY* entries, |
2865 REFIID iid, | 2865 REFIID iid, |
2866 void** object) { | 2866 void** object) { |
2867 int32 ia_role = | 2867 BrowserAccessibilityWin* accessibility = |
2868 reinterpret_cast<BrowserAccessibilityWin*>(this_ptr)->ia_role_; | 2868 reinterpret_cast<BrowserAccessibilityWin*>(this_ptr); |
| 2869 int32 ia_role = accessibility->ia_role_; |
2869 if (iid == IID_IAccessibleImage) { | 2870 if (iid == IID_IAccessibleImage) { |
2870 if (ia_role != ROLE_SYSTEM_GRAPHIC) { | 2871 if (ia_role != ROLE_SYSTEM_GRAPHIC) { |
2871 *object = NULL; | 2872 *object = NULL; |
2872 return E_NOINTERFACE; | 2873 return E_NOINTERFACE; |
2873 } | 2874 } |
2874 } else if (iid == IID_IAccessibleTable || iid == IID_IAccessibleTable2) { | 2875 } else if (iid == IID_IAccessibleTable || iid == IID_IAccessibleTable2) { |
2875 if (ia_role != ROLE_SYSTEM_TABLE) { | 2876 if (ia_role != ROLE_SYSTEM_TABLE) { |
2876 *object = NULL; | 2877 *object = NULL; |
2877 return E_NOINTERFACE; | 2878 return E_NOINTERFACE; |
2878 } | 2879 } |
2879 } else if (iid == IID_IAccessibleTableCell) { | 2880 } else if (iid == IID_IAccessibleTableCell) { |
2880 if (ia_role != ROLE_SYSTEM_CELL) { | 2881 if (!accessibility->IsCellOrTableHeaderRole()) { |
2881 *object = NULL; | 2882 *object = NULL; |
2882 return E_NOINTERFACE; | 2883 return E_NOINTERFACE; |
2883 } | 2884 } |
2884 } else if (iid == IID_IAccessibleValue) { | 2885 } else if (iid == IID_IAccessibleValue) { |
2885 if (ia_role != ROLE_SYSTEM_PROGRESSBAR && | 2886 if (ia_role != ROLE_SYSTEM_PROGRESSBAR && |
2886 ia_role != ROLE_SYSTEM_SCROLLBAR && | 2887 ia_role != ROLE_SYSTEM_SCROLLBAR && |
2887 ia_role != ROLE_SYSTEM_SLIDER) { | 2888 ia_role != ROLE_SYSTEM_SLIDER) { |
2888 *object = NULL; | 2889 *object = NULL; |
2889 return E_NOINTERFACE; | 2890 return E_NOINTERFACE; |
2890 } | 2891 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2956 "container-busy"); | 2957 "container-busy"); |
2957 | 2958 |
2958 // Expose slider value. | 2959 // Expose slider value. |
2959 if (ia_role_ == ROLE_SYSTEM_PROGRESSBAR || | 2960 if (ia_role_ == ROLE_SYSTEM_PROGRESSBAR || |
2960 ia_role_ == ROLE_SYSTEM_SCROLLBAR || | 2961 ia_role_ == ROLE_SYSTEM_SCROLLBAR || |
2961 ia_role_ == ROLE_SYSTEM_SLIDER) { | 2962 ia_role_ == ROLE_SYSTEM_SLIDER) { |
2962 ia2_attributes_.push_back(L"valuetext:" + GetValueText()); | 2963 ia2_attributes_.push_back(L"valuetext:" + GetValueText()); |
2963 } | 2964 } |
2964 | 2965 |
2965 // Expose table cell index. | 2966 // Expose table cell index. |
2966 if (ia_role_ == ROLE_SYSTEM_CELL) { | 2967 if (IsCellOrTableHeaderRole()) { |
2967 BrowserAccessibility* table = GetParent(); | 2968 BrowserAccessibility* table = GetParent(); |
2968 while (table && table->GetRole() != ui::AX_ROLE_TABLE) | 2969 while (table && table->GetRole() != ui::AX_ROLE_TABLE) |
2969 table = table->GetParent(); | 2970 table = table->GetParent(); |
2970 if (table) { | 2971 if (table) { |
2971 const std::vector<int32>& unique_cell_ids = table->GetIntListAttribute( | 2972 const std::vector<int32>& unique_cell_ids = table->GetIntListAttribute( |
2972 ui::AX_ATTR_UNIQUE_CELL_IDS); | 2973 ui::AX_ATTR_UNIQUE_CELL_IDS); |
2973 for (size_t i = 0; i < unique_cell_ids.size(); ++i) { | 2974 for (size_t i = 0; i < unique_cell_ids.size(); ++i) { |
2974 if (unique_cell_ids[i] == GetId()) { | 2975 if (unique_cell_ids[i] == GetId()) { |
2975 ia2_attributes_.push_back( | 2976 ia2_attributes_.push_back( |
2976 base::string16(L"table-cell-index:") + base::IntToString16(i)); | 2977 base::string16(L"table-cell-index:") + base::IntToString16(i)); |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3850 // The role should always be set. | 3851 // The role should always be set. |
3851 DCHECK(!role_name_.empty() || ia_role_); | 3852 DCHECK(!role_name_.empty() || ia_role_); |
3852 | 3853 |
3853 // If we didn't explicitly set the IAccessible2 role, make it the same | 3854 // If we didn't explicitly set the IAccessible2 role, make it the same |
3854 // as the MSAA role. | 3855 // as the MSAA role. |
3855 if (!ia2_role_) | 3856 if (!ia2_role_) |
3856 ia2_role_ = ia_role_; | 3857 ia2_role_ = ia_role_; |
3857 } | 3858 } |
3858 | 3859 |
3859 } // namespace content | 3860 } // namespace content |
OLD | NEW |