| 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_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 else if (title_elem_id && !name().empty()) | 385 else if (title_elem_id && !name().empty()) |
| 386 text = base::UTF8ToUTF16(name()); | 386 text = base::UTF8ToUTF16(name()); |
| 387 else if (!help.empty()) | 387 else if (!help.empty()) |
| 388 text = help; | 388 text = help; |
| 389 else if (!name().empty()) | 389 else if (!name().empty()) |
| 390 text = base::UTF8ToUTF16(name()); | 390 text = base::UTF8ToUTF16(name()); |
| 391 else if (!placeholder.empty()) | 391 else if (!placeholder.empty()) |
| 392 text = placeholder; | 392 text = placeholder; |
| 393 else if (!value().empty()) | 393 else if (!value().empty()) |
| 394 text = base::UTF8ToUTF16(value()); | 394 text = base::UTF8ToUTF16(value()); |
| 395 else if (title_elem_id) { |
| 396 BrowserAccessibility* title_elem = |
| 397 manager()->GetFromID(title_elem_id); |
| 398 if (title_elem) |
| 399 text = static_cast<BrowserAccessibilityAndroid*>(title_elem)->GetText(); |
| 400 } |
| 395 | 401 |
| 396 // This is called from PlatformIsLeaf, so don't call PlatformChildCount | 402 // This is called from PlatformIsLeaf, so don't call PlatformChildCount |
| 397 // from within this! | 403 // from within this! |
| 398 if (text.empty() && | 404 if (text.empty() && |
| 399 (HasOnlyStaticTextChildren() || | 405 (HasOnlyStaticTextChildren() || |
| 400 (IsFocusable() && HasOnlyTextAndImageChildren()))) { | 406 (IsFocusable() && HasOnlyTextAndImageChildren()))) { |
| 401 for (uint32 i = 0; i < InternalChildCount(); i++) { | 407 for (uint32 i = 0; i < InternalChildCount(); i++) { |
| 402 BrowserAccessibility* child = InternalGetChild(i); | 408 BrowserAccessibility* child = InternalGetChild(i); |
| 403 text += static_cast<BrowserAccessibilityAndroid*>(child)->GetText(); | 409 text += static_cast<BrowserAccessibilityAndroid*>(child)->GetText(); |
| 404 } | 410 } |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { | 867 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { |
| 862 int count = 0; | 868 int count = 0; |
| 863 for (uint32 i = 0; i < PlatformChildCount(); i++) { | 869 for (uint32 i = 0; i < PlatformChildCount(); i++) { |
| 864 if (PlatformGetChild(i)->GetRole() == role) | 870 if (PlatformGetChild(i)->GetRole() == role) |
| 865 count++; | 871 count++; |
| 866 } | 872 } |
| 867 return count; | 873 return count; |
| 868 } | 874 } |
| 869 | 875 |
| 870 } // namespace content | 876 } // namespace content |
| OLD | NEW |