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 <algorithm> | 10 #include <algorithm> |
(...skipping 5196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5207 | 5207 |
5208 void BrowserAccessibilityWin::InitRoleAndState() { | 5208 void BrowserAccessibilityWin::InitRoleAndState() { |
5209 int32_t ia_role = 0; | 5209 int32_t ia_role = 0; |
5210 int32_t ia_state = 0; | 5210 int32_t ia_state = 0; |
5211 base::string16 role_name; | 5211 base::string16 role_name; |
5212 int32_t ia2_role = 0; | 5212 int32_t ia2_role = 0; |
5213 int32_t ia2_state = IA2_STATE_OPAQUE; | 5213 int32_t ia2_state = IA2_STATE_OPAQUE; |
5214 | 5214 |
5215 if (HasState(ui::AX_STATE_BUSY)) | 5215 if (HasState(ui::AX_STATE_BUSY)) |
5216 ia_state |= STATE_SYSTEM_BUSY; | 5216 ia_state |= STATE_SYSTEM_BUSY; |
5217 if (HasState(ui::AX_STATE_CHECKED)) | 5217 |
5218 ia_state |= STATE_SYSTEM_CHECKED; | 5218 const int checked = GetIntAttribute(ui::AX_ATTR_CHECKED_STATE); |
| 5219 switch (checked) { |
| 5220 case ui::AX_CHECKED_STATE_TRUE: |
| 5221 ia_state |= STATE_SYSTEM_CHECKED; |
| 5222 break; |
| 5223 case ui::AX_CHECKED_STATE_MIXED: |
| 5224 ia_state |= STATE_SYSTEM_MIXED; |
| 5225 break; |
| 5226 default: |
| 5227 break; |
| 5228 } |
| 5229 |
5219 if (HasState(ui::AX_STATE_COLLAPSED)) | 5230 if (HasState(ui::AX_STATE_COLLAPSED)) |
5220 ia_state |= STATE_SYSTEM_COLLAPSED; | 5231 ia_state |= STATE_SYSTEM_COLLAPSED; |
5221 if (HasState(ui::AX_STATE_EXPANDED)) | 5232 if (HasState(ui::AX_STATE_EXPANDED)) |
5222 ia_state |= STATE_SYSTEM_EXPANDED; | 5233 ia_state |= STATE_SYSTEM_EXPANDED; |
5223 if (HasState(ui::AX_STATE_FOCUSABLE)) | 5234 if (HasState(ui::AX_STATE_FOCUSABLE)) |
5224 ia_state |= STATE_SYSTEM_FOCUSABLE; | 5235 ia_state |= STATE_SYSTEM_FOCUSABLE; |
5225 if (HasState(ui::AX_STATE_HASPOPUP)) | 5236 if (HasState(ui::AX_STATE_HASPOPUP)) |
5226 ia_state |= STATE_SYSTEM_HASPOPUP; | 5237 ia_state |= STATE_SYSTEM_HASPOPUP; |
5227 if (HasIntAttribute(ui::AX_ATTR_INVALID_STATE) && | 5238 if (HasIntAttribute(ui::AX_ATTR_INVALID_STATE) && |
5228 GetIntAttribute(ui::AX_ATTR_INVALID_STATE) != ui::AX_INVALID_STATE_FALSE) | 5239 GetIntAttribute(ui::AX_ATTR_INVALID_STATE) != ui::AX_INVALID_STATE_FALSE) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5265 BrowserAccessibilityStateImpl* accessibility_state = | 5276 BrowserAccessibilityStateImpl* accessibility_state = |
5266 BrowserAccessibilityStateImpl::GetInstance(); | 5277 BrowserAccessibilityStateImpl::GetInstance(); |
5267 if (!accessibility_state->disable_hot_tracking_for_testing()) { | 5278 if (!accessibility_state->disable_hot_tracking_for_testing()) { |
5268 if (HasState(ui::AX_STATE_HOVERED)) | 5279 if (HasState(ui::AX_STATE_HOVERED)) |
5269 ia_state |= STATE_SYSTEM_HOTTRACKED; | 5280 ia_state |= STATE_SYSTEM_HOTTRACKED; |
5270 } | 5281 } |
5271 | 5282 |
5272 if (HasState(ui::AX_STATE_EDITABLE)) | 5283 if (HasState(ui::AX_STATE_EDITABLE)) |
5273 ia2_state |= IA2_STATE_EDITABLE; | 5284 ia2_state |= IA2_STATE_EDITABLE; |
5274 | 5285 |
5275 if (GetBoolAttribute(ui::AX_ATTR_STATE_MIXED)) | |
5276 ia_state |= STATE_SYSTEM_MIXED; | |
5277 | |
5278 if (GetBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE)) | 5286 if (GetBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE)) |
5279 ia2_state |= IA2_STATE_EDITABLE; | 5287 ia2_state |= IA2_STATE_EDITABLE; |
5280 | 5288 |
5281 if (!GetStringAttribute(ui::AX_ATTR_AUTO_COMPLETE).empty()) | 5289 if (!GetStringAttribute(ui::AX_ATTR_AUTO_COMPLETE).empty()) |
5282 ia2_state |= IA2_STATE_SUPPORTS_AUTOCOMPLETION; | 5290 ia2_state |= IA2_STATE_SUPPORTS_AUTOCOMPLETION; |
5283 | 5291 |
5284 if (GetBoolAttribute(ui::AX_ATTR_MODAL)) | 5292 if (GetBoolAttribute(ui::AX_ATTR_MODAL)) |
5285 ia2_state |= IA2_STATE_MODAL; | 5293 ia2_state |= IA2_STATE_MODAL; |
5286 | 5294 |
5287 base::string16 html_tag = GetString16Attribute( | 5295 base::string16 html_tag = GetString16Attribute( |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5786 return static_cast<BrowserAccessibilityWin*>(obj); | 5794 return static_cast<BrowserAccessibilityWin*>(obj); |
5787 } | 5795 } |
5788 | 5796 |
5789 const BrowserAccessibilityWin* | 5797 const BrowserAccessibilityWin* |
5790 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { | 5798 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { |
5791 DCHECK(!obj || obj->IsNative()); | 5799 DCHECK(!obj || obj->IsNative()); |
5792 return static_cast<const BrowserAccessibilityWin*>(obj); | 5800 return static_cast<const BrowserAccessibilityWin*>(obj); |
5793 } | 5801 } |
5794 | 5802 |
5795 } // namespace content | 5803 } // namespace content |
OLD | NEW |