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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 | 155 |
156 bool BrowserAccessibilityAndroid::IsClickable() const { | 156 bool BrowserAccessibilityAndroid::IsClickable() const { |
157 if (!PlatformIsLeaf()) | 157 if (!PlatformIsLeaf()) |
158 return false; | 158 return false; |
159 | 159 |
160 // We are very aggressive about returning true with IsClickable on Android | 160 // We are very aggressive about returning true with IsClickable on Android |
161 // because there is no way to know for sure what might have a click handler. | 161 // because there is no way to know for sure what might have a click handler. |
162 return IsFocusable() || !GetText().empty(); | 162 return IsFocusable() || !GetText().empty(); |
163 } | 163 } |
164 | 164 |
165 bool BrowserAccessibilityAndroid::IsCollapsed() const { | |
166 return HasState(ui::AX_STATE_COLLAPSED); | |
167 } | |
168 | |
165 bool BrowserAccessibilityAndroid::IsCollection() const { | 169 bool BrowserAccessibilityAndroid::IsCollection() const { |
166 return (GetRole() == ui::AX_ROLE_GRID || | 170 return (GetRole() == ui::AX_ROLE_GRID || |
167 GetRole() == ui::AX_ROLE_LIST || | 171 GetRole() == ui::AX_ROLE_LIST || |
168 GetRole() == ui::AX_ROLE_LIST_BOX || | 172 GetRole() == ui::AX_ROLE_LIST_BOX || |
169 GetRole() == ui::AX_ROLE_DESCRIPTION_LIST || | 173 GetRole() == ui::AX_ROLE_DESCRIPTION_LIST || |
170 GetRole() == ui::AX_ROLE_TABLE || | 174 GetRole() == ui::AX_ROLE_TABLE || |
171 GetRole() == ui::AX_ROLE_TREE); | 175 GetRole() == ui::AX_ROLE_TREE); |
172 } | 176 } |
173 | 177 |
174 bool BrowserAccessibilityAndroid::IsCollectionItem() const { | 178 bool BrowserAccessibilityAndroid::IsCollectionItem() const { |
(...skipping 16 matching lines...) Expand all Loading... | |
191 } | 195 } |
192 | 196 |
193 bool BrowserAccessibilityAndroid::IsEditableText() const { | 197 bool BrowserAccessibilityAndroid::IsEditableText() const { |
194 return GetRole() == ui::AX_ROLE_TEXT_FIELD; | 198 return GetRole() == ui::AX_ROLE_TEXT_FIELD; |
195 } | 199 } |
196 | 200 |
197 bool BrowserAccessibilityAndroid::IsEnabled() const { | 201 bool BrowserAccessibilityAndroid::IsEnabled() const { |
198 return !HasState(ui::AX_STATE_DISABLED); | 202 return !HasState(ui::AX_STATE_DISABLED); |
199 } | 203 } |
200 | 204 |
205 bool BrowserAccessibilityAndroid::IsExpanded() const { | |
206 return HasState(ui::AX_STATE_EXPANDED); | |
David Tseng
2016/08/24 22:46:13
Is a widget ever both expanded and collapsed at th
dmazzoni
2016/08/24 22:56:05
No, we enforce that in content/renderer/accessibil
| |
207 } | |
208 | |
201 bool BrowserAccessibilityAndroid::IsFocusable() const { | 209 bool BrowserAccessibilityAndroid::IsFocusable() const { |
202 bool focusable = HasState(ui::AX_STATE_FOCUSABLE); | 210 bool focusable = HasState(ui::AX_STATE_FOCUSABLE); |
203 if (IsIframe() || | 211 if (IsIframe() || |
204 GetRole() == ui::AX_ROLE_WEB_AREA) { | 212 GetRole() == ui::AX_ROLE_WEB_AREA) { |
205 focusable = false; | 213 focusable = false; |
206 } | 214 } |
207 return focusable; | 215 return focusable; |
208 } | 216 } |
209 | 217 |
210 bool BrowserAccessibilityAndroid::IsFocused() const { | 218 bool BrowserAccessibilityAndroid::IsFocused() const { |
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1412 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { | 1420 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { |
1413 int count = 0; | 1421 int count = 0; |
1414 for (uint32_t i = 0; i < PlatformChildCount(); i++) { | 1422 for (uint32_t i = 0; i < PlatformChildCount(); i++) { |
1415 if (PlatformGetChild(i)->GetRole() == role) | 1423 if (PlatformGetChild(i)->GetRole() == role) |
1416 count++; | 1424 count++; |
1417 } | 1425 } |
1418 return count; | 1426 return count; |
1419 } | 1427 } |
1420 | 1428 |
1421 } // namespace content | 1429 } // namespace content |
OLD | NEW |