Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: content/browser/accessibility/browser_accessibility_android.cc

Issue 303113003: Properly prioritize the sources of an accessible name on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "content/browser/accessibility/browser_accessibility_manager_android.h" 8 #include "content/browser/accessibility/browser_accessibility_manager_android.h"
9 #include "content/common/accessibility_messages.h" 9 #include "content/common/accessibility_messages.h"
10 10
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 return class_name; 262 return class_name;
263 } 263 }
264 264
265 base::string16 BrowserAccessibilityAndroid::GetText() const { 265 base::string16 BrowserAccessibilityAndroid::GetText() const {
266 if (IsIframe() || 266 if (IsIframe() ||
267 GetRole() == ui::AX_ROLE_WEB_AREA) { 267 GetRole() == ui::AX_ROLE_WEB_AREA) {
268 return base::string16(); 268 return base::string16();
269 } 269 }
270 270
271 base::string16 description = GetString16Attribute(ui::AX_ATTR_DESCRIPTION); 271 base::string16 description = GetString16Attribute(ui::AX_ATTR_DESCRIPTION);
272 base::string16 help = GetString16Attribute(ui::AX_ATTR_HELP);
273 int title_elem_id = GetIntAttribute(
274 ui::AX_ATTR_TITLE_UI_ELEMENT);
272 base::string16 text; 275 base::string16 text;
273 if (!name().empty()) 276 if (!description.empty())
277 text = description;
278 else if (title_elem_id && !name().empty())
aboxhall 2014/05/30 21:26:21 I don't follow this logic. Why isn't it getting th
dmazzoni 2014/05/30 22:03:33 I added a comment. I need to clean this up in Blin
274 text = base::UTF8ToUTF16(name()); 279 text = base::UTF8ToUTF16(name());
275 else if (!description.empty()) 280 else if (!help.empty())
276 text = description; 281 text = help;
282 else if (!name().empty())
283 text = base::UTF8ToUTF16(name());
277 else if (!value().empty()) 284 else if (!value().empty())
278 text = base::UTF8ToUTF16(value()); 285 text = base::UTF8ToUTF16(value());
279 286
280 // This is called from PlatformIsLeaf, so don't call PlatformChildCount 287 // This is called from PlatformIsLeaf, so don't call PlatformChildCount
281 // from within this! 288 // from within this!
282 if (text.empty() && HasOnlyStaticTextChildren()) { 289 if (text.empty() && HasOnlyStaticTextChildren()) {
283 for (uint32 i = 0; i < InternalChildCount(); i++) { 290 for (uint32 i = 0; i < InternalChildCount(); i++) {
284 BrowserAccessibility* child = InternalGetChild(i); 291 BrowserAccessibility* child = InternalGetChild(i);
285 text += static_cast<BrowserAccessibilityAndroid*>(child)->GetText(); 292 text += static_cast<BrowserAccessibilityAndroid*>(child)->GetText();
286 } 293 }
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { 633 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const {
627 int count = 0; 634 int count = 0;
628 for (uint32 i = 0; i < PlatformChildCount(); i++) { 635 for (uint32 i = 0; i < PlatformChildCount(); i++) {
629 if (PlatformGetChild(i)->GetRole() == role) 636 if (PlatformGetChild(i)->GetRole() == role)
630 count++; 637 count++;
631 } 638 }
632 return count; 639 return count;
633 } 640 }
634 641
635 } // namespace content 642 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698