OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_android.h" | 5 #include "content/browser/accessibility/browser_accessibility_android.h" |
6 | 6 |
7 #include "base/i18n/break_iterator.h" | 7 #include "base/i18n/break_iterator.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 } | 158 } |
159 | 159 |
160 bool BrowserAccessibilityAndroid::IsChecked() const { | 160 bool BrowserAccessibilityAndroid::IsChecked() const { |
161 const auto checked_state = static_cast<ui::AXCheckedState>( | 161 const auto checked_state = static_cast<ui::AXCheckedState>( |
162 GetIntAttribute(ui::AX_ATTR_CHECKED_STATE)); | 162 GetIntAttribute(ui::AX_ATTR_CHECKED_STATE)); |
163 return (checked_state == ui::AX_CHECKED_STATE_TRUE || | 163 return (checked_state == ui::AX_CHECKED_STATE_TRUE || |
164 HasState(ui::AX_STATE_PRESSED)); | 164 HasState(ui::AX_STATE_PRESSED)); |
165 } | 165 } |
166 | 166 |
167 bool BrowserAccessibilityAndroid::IsClickable() const { | 167 bool BrowserAccessibilityAndroid::IsClickable() const { |
168 // If it has a default action, it's definitely clickable. | 168 // If it has a custom default action verb, it's definitely clickable. |
169 if (HasIntAttribute(ui::AX_ATTR_ACTION)) | 169 if (HasIntAttribute(ui::AX_ATTR_DEFAULT_ACTION_VERB)) |
170 return true; | 170 return true; |
171 | 171 |
172 // Otherwise return true if it's focusable, but skip web areas and iframes. | 172 // Otherwise return true if it's focusable, but skip web areas and iframes. |
173 if (IsIframe() || (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA)) | 173 if (IsIframe() || (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA)) |
174 return false; | 174 return false; |
175 return IsFocusable(); | 175 return IsFocusable(); |
176 } | 176 } |
177 | 177 |
178 bool BrowserAccessibilityAndroid::IsCollapsed() const { | 178 bool BrowserAccessibilityAndroid::IsCollapsed() const { |
179 return HasState(ui::AX_STATE_COLLAPSED); | 179 return HasState(ui::AX_STATE_COLLAPSED); |
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1426 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { | 1426 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { |
1427 int count = 0; | 1427 int count = 0; |
1428 for (uint32_t i = 0; i < PlatformChildCount(); i++) { | 1428 for (uint32_t i = 0; i < PlatformChildCount(); i++) { |
1429 if (PlatformGetChild(i)->GetRole() == role) | 1429 if (PlatformGetChild(i)->GetRole() == role) |
1430 count++; | 1430 count++; |
1431 } | 1431 } |
1432 return count; | 1432 return count; |
1433 } | 1433 } |
1434 | 1434 |
1435 } // namespace content | 1435 } // namespace content |
OLD | NEW |