| 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 5055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5066 | 5066 |
| 5067 void BrowserAccessibilityWin::InitRoleAndState() { | 5067 void BrowserAccessibilityWin::InitRoleAndState() { |
| 5068 int32_t ia_role = 0; | 5068 int32_t ia_role = 0; |
| 5069 int32_t ia_state = 0; | 5069 int32_t ia_state = 0; |
| 5070 base::string16 role_name; | 5070 base::string16 role_name; |
| 5071 int32_t ia2_role = 0; | 5071 int32_t ia2_role = 0; |
| 5072 int32_t ia2_state = IA2_STATE_OPAQUE; | 5072 int32_t ia2_state = IA2_STATE_OPAQUE; |
| 5073 | 5073 |
| 5074 if (HasState(ui::AX_STATE_BUSY)) | 5074 if (HasState(ui::AX_STATE_BUSY)) |
| 5075 ia_state |= STATE_SYSTEM_BUSY; | 5075 ia_state |= STATE_SYSTEM_BUSY; |
| 5076 if (HasState(ui::AX_STATE_CHECKED)) | 5076 |
| 5077 ia_state |= STATE_SYSTEM_CHECKED; | 5077 const auto checked_state = static_cast<ui::AXCheckedState>( |
| 5078 GetIntAttribute(ui::AX_ATTR_CHECKED_STATE)); |
| 5079 switch (checked_state) { |
| 5080 case ui::AX_CHECKED_STATE_TRUE: |
| 5081 ia_state |= STATE_SYSTEM_CHECKED; |
| 5082 break; |
| 5083 case ui::AX_CHECKED_STATE_MIXED: |
| 5084 ia_state |= STATE_SYSTEM_MIXED; |
| 5085 break; |
| 5086 default: |
| 5087 break; |
| 5088 } |
| 5089 |
| 5078 if (HasState(ui::AX_STATE_COLLAPSED)) | 5090 if (HasState(ui::AX_STATE_COLLAPSED)) |
| 5079 ia_state |= STATE_SYSTEM_COLLAPSED; | 5091 ia_state |= STATE_SYSTEM_COLLAPSED; |
| 5080 if (HasState(ui::AX_STATE_EXPANDED)) | 5092 if (HasState(ui::AX_STATE_EXPANDED)) |
| 5081 ia_state |= STATE_SYSTEM_EXPANDED; | 5093 ia_state |= STATE_SYSTEM_EXPANDED; |
| 5082 if (HasState(ui::AX_STATE_FOCUSABLE)) | 5094 if (HasState(ui::AX_STATE_FOCUSABLE)) |
| 5083 ia_state |= STATE_SYSTEM_FOCUSABLE; | 5095 ia_state |= STATE_SYSTEM_FOCUSABLE; |
| 5084 if (HasState(ui::AX_STATE_HASPOPUP)) | 5096 if (HasState(ui::AX_STATE_HASPOPUP)) |
| 5085 ia_state |= STATE_SYSTEM_HASPOPUP; | 5097 ia_state |= STATE_SYSTEM_HASPOPUP; |
| 5086 if (HasIntAttribute(ui::AX_ATTR_INVALID_STATE) && | 5098 if (HasIntAttribute(ui::AX_ATTR_INVALID_STATE) && |
| 5087 GetIntAttribute(ui::AX_ATTR_INVALID_STATE) != ui::AX_INVALID_STATE_FALSE) | 5099 GetIntAttribute(ui::AX_ATTR_INVALID_STATE) != ui::AX_INVALID_STATE_FALSE) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5124 BrowserAccessibilityStateImpl* accessibility_state = | 5136 BrowserAccessibilityStateImpl* accessibility_state = |
| 5125 BrowserAccessibilityStateImpl::GetInstance(); | 5137 BrowserAccessibilityStateImpl::GetInstance(); |
| 5126 if (!accessibility_state->disable_hot_tracking_for_testing()) { | 5138 if (!accessibility_state->disable_hot_tracking_for_testing()) { |
| 5127 if (HasState(ui::AX_STATE_HOVERED)) | 5139 if (HasState(ui::AX_STATE_HOVERED)) |
| 5128 ia_state |= STATE_SYSTEM_HOTTRACKED; | 5140 ia_state |= STATE_SYSTEM_HOTTRACKED; |
| 5129 } | 5141 } |
| 5130 | 5142 |
| 5131 if (HasState(ui::AX_STATE_EDITABLE)) | 5143 if (HasState(ui::AX_STATE_EDITABLE)) |
| 5132 ia2_state |= IA2_STATE_EDITABLE; | 5144 ia2_state |= IA2_STATE_EDITABLE; |
| 5133 | 5145 |
| 5134 if (GetBoolAttribute(ui::AX_ATTR_STATE_MIXED)) | |
| 5135 ia_state |= STATE_SYSTEM_MIXED; | |
| 5136 | |
| 5137 if (GetBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE)) | 5146 if (GetBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE)) |
| 5138 ia2_state |= IA2_STATE_EDITABLE; | 5147 ia2_state |= IA2_STATE_EDITABLE; |
| 5139 | 5148 |
| 5140 if (!GetStringAttribute(ui::AX_ATTR_AUTO_COMPLETE).empty()) | 5149 if (!GetStringAttribute(ui::AX_ATTR_AUTO_COMPLETE).empty()) |
| 5141 ia2_state |= IA2_STATE_SUPPORTS_AUTOCOMPLETION; | 5150 ia2_state |= IA2_STATE_SUPPORTS_AUTOCOMPLETION; |
| 5142 | 5151 |
| 5143 if (GetBoolAttribute(ui::AX_ATTR_MODAL)) | 5152 if (GetBoolAttribute(ui::AX_ATTR_MODAL)) |
| 5144 ia2_state |= IA2_STATE_MODAL; | 5153 ia2_state |= IA2_STATE_MODAL; |
| 5145 | 5154 |
| 5146 base::string16 html_tag = GetString16Attribute( | 5155 base::string16 html_tag = GetString16Attribute( |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5670 return static_cast<BrowserAccessibilityWin*>(obj); | 5679 return static_cast<BrowserAccessibilityWin*>(obj); |
| 5671 } | 5680 } |
| 5672 | 5681 |
| 5673 const BrowserAccessibilityWin* | 5682 const BrowserAccessibilityWin* |
| 5674 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { | 5683 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { |
| 5675 DCHECK(!obj || obj->IsNative()); | 5684 DCHECK(!obj || obj->IsNative()); |
| 5676 return static_cast<const BrowserAccessibilityWin*>(obj); | 5685 return static_cast<const BrowserAccessibilityWin*>(obj); |
| 5677 } | 5686 } |
| 5678 | 5687 |
| 5679 } // namespace content | 5688 } // namespace content |
| OLD | NEW |