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

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

Issue 2427813002: Android accessibility should not treat whitespace-only nodes as interesting. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | content/browser/accessibility/one_shot_accessibility_tree_search.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 // Focusable nodes are always interesting. Note that IsFocusable() 281 // Focusable nodes are always interesting. Note that IsFocusable()
282 // already skips over things like iframes and child frames that are 282 // already skips over things like iframes and child frames that are
283 // technically focusable but shouldn't be exposed as focusable on Android. 283 // technically focusable but shouldn't be exposed as focusable on Android.
284 if (IsFocusable()) 284 if (IsFocusable())
285 return true; 285 return true;
286 286
287 // If it's not focusable but has a control role, then it's interesting. 287 // If it's not focusable but has a control role, then it's interesting.
288 if (IsControl()) 288 if (IsControl())
289 return true; 289 return true;
290 290
291 // Otherwise, the interesting nodes are leaf nodes with text. 291 // Otherwise, the interesting nodes are leaf nodes with non-whitespace text.
292 return PlatformIsLeaf() && !GetText().empty(); 292 return PlatformIsLeaf() &&
293 !base::ContainsOnlyChars(GetText(), base::kWhitespaceUTF16);
293 } 294 }
294 295
295 const BrowserAccessibilityAndroid* 296 const BrowserAccessibilityAndroid*
296 BrowserAccessibilityAndroid::GetInterestingChild() const { 297 BrowserAccessibilityAndroid::GetInterestingChild() const {
297 if (IsInterestingOnAndroid()) 298 if (IsInterestingOnAndroid())
298 return this; 299 return this;
299 300
300 const BrowserAccessibilityAndroid* interesting_child = nullptr; 301 const BrowserAccessibilityAndroid* interesting_child = nullptr;
301 for (uint32_t i = 0; i < PlatformChildCount(); ++i) { 302 for (uint32_t i = 0; i < PlatformChildCount(); ++i) {
302 const BrowserAccessibilityAndroid* result = 303 const BrowserAccessibilityAndroid* result =
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { 1465 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const {
1465 int count = 0; 1466 int count = 0;
1466 for (uint32_t i = 0; i < PlatformChildCount(); i++) { 1467 for (uint32_t i = 0; i < PlatformChildCount(); i++) {
1467 if (PlatformGetChild(i)->GetRole() == role) 1468 if (PlatformGetChild(i)->GetRole() == role)
1468 count++; 1469 count++;
1469 } 1470 }
1470 return count; 1471 return count;
1471 } 1472 }
1472 1473
1473 } // namespace content 1474 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/accessibility/one_shot_accessibility_tree_search.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698