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