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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA && GetText().empty()) | 285 if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA && GetText().empty()) |
286 return false; | 286 return false; |
287 | 287 |
288 // Focusable nodes are always interesting. Note that IsFocusable() | 288 // Focusable nodes are always interesting. Note that IsFocusable() |
289 // already skips over things like iframes and child frames that are | 289 // already skips over things like iframes and child frames that are |
290 // technically focusable but shouldn't be exposed as focusable on Android. | 290 // technically focusable but shouldn't be exposed as focusable on Android. |
291 if (IsFocusable()) | 291 if (IsFocusable()) |
292 return true; | 292 return true; |
293 | 293 |
294 // If it's not focusable but has a control role, then it's interesting. | 294 // If it's not focusable but has a control role, then it's interesting. |
295 if (IsControl()) | 295 if (ui::IsControl(GetRole())) |
296 return true; | 296 return true; |
297 | 297 |
298 // Otherwise, the interesting nodes are leaf nodes with non-whitespace text. | 298 // Otherwise, the interesting nodes are leaf nodes with non-whitespace text. |
299 return PlatformIsLeaf() && | 299 return PlatformIsLeaf() && |
300 !base::ContainsOnlyChars(GetText(), base::kWhitespaceUTF16); | 300 !base::ContainsOnlyChars(GetText(), base::kWhitespaceUTF16); |
301 } | 301 } |
302 | 302 |
303 const BrowserAccessibilityAndroid* | 303 const BrowserAccessibilityAndroid* |
304 BrowserAccessibilityAndroid::GetSoleInterestingNodeFromSubtree() const { | 304 BrowserAccessibilityAndroid::GetSoleInterestingNodeFromSubtree() const { |
305 if (IsInterestingOnAndroid()) | 305 if (IsInterestingOnAndroid()) |
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { | 1408 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { |
1409 int count = 0; | 1409 int count = 0; |
1410 for (uint32_t i = 0; i < PlatformChildCount(); i++) { | 1410 for (uint32_t i = 0; i < PlatformChildCount(); i++) { |
1411 if (PlatformGetChild(i)->GetRole() == role) | 1411 if (PlatformGetChild(i)->GetRole() == role) |
1412 count++; | 1412 count++; |
1413 } | 1413 } |
1414 return count; | 1414 return count; |
1415 } | 1415 } |
1416 | 1416 |
1417 } // namespace content | 1417 } // namespace content |
OLD | NEW |