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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 // This is called from PlatformIsLeaf, so don't call PlatformChildCount | 401 // This is called from PlatformIsLeaf, so don't call PlatformChildCount |
402 // from within this! | 402 // from within this! |
403 if (text.empty() && (HasOnlyTextChildren() || | 403 if (text.empty() && (HasOnlyTextChildren() || |
404 (IsFocusable() && HasOnlyTextAndImageChildren()))) { | 404 (IsFocusable() && HasOnlyTextAndImageChildren()))) { |
405 for (uint32_t i = 0; i < InternalChildCount(); i++) { | 405 for (uint32_t i = 0; i < InternalChildCount(); i++) { |
406 BrowserAccessibility* child = InternalGetChild(i); | 406 BrowserAccessibility* child = InternalGetChild(i); |
407 text += static_cast<BrowserAccessibilityAndroid*>(child)->GetText(); | 407 text += static_cast<BrowserAccessibilityAndroid*>(child)->GetText(); |
408 } | 408 } |
409 } | 409 } |
410 | 410 |
411 if (text.empty() && (IsLink() || GetRole() == ui::AX_ROLE_IMAGE)) { | 411 if (text.empty() && (IsLink() || GetRole() == ui::AX_ROLE_IMAGE) && |
| 412 !HasExplicitlyEmptyName()) { |
412 base::string16 url = GetString16Attribute(ui::AX_ATTR_URL); | 413 base::string16 url = GetString16Attribute(ui::AX_ATTR_URL); |
413 text = ui::AXSnapshotNodeAndroid::AXUrlBaseText(url); | 414 text = ui::AXSnapshotNodeAndroid::AXUrlBaseText(url); |
414 } | 415 } |
415 | 416 |
416 return text; | 417 return text; |
417 } | 418 } |
418 | 419 |
419 base::string16 BrowserAccessibilityAndroid::GetRoleDescription() const { | 420 base::string16 BrowserAccessibilityAndroid::GetRoleDescription() const { |
420 content::ContentClient* content_client = content::GetContentClient(); | 421 content::ContentClient* content_client = content::GetContentClient(); |
421 | 422 |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1415 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { | 1416 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { |
1416 int count = 0; | 1417 int count = 0; |
1417 for (uint32_t i = 0; i < PlatformChildCount(); i++) { | 1418 for (uint32_t i = 0; i < PlatformChildCount(); i++) { |
1418 if (PlatformGetChild(i)->GetRole() == role) | 1419 if (PlatformGetChild(i)->GetRole() == role) |
1419 count++; | 1420 count++; |
1420 } | 1421 } |
1421 return count; | 1422 return count; |
1422 } | 1423 } |
1423 | 1424 |
1424 } // namespace content | 1425 } // namespace content |
OLD | NEW |