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

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

Issue 1589623002: Keep track of accessibility focus across windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final suggestions Created 4 years, 10 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/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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 bool BrowserAccessibilityAndroid::IsFocusable() const { 177 bool BrowserAccessibilityAndroid::IsFocusable() const {
178 bool focusable = HasState(ui::AX_STATE_FOCUSABLE); 178 bool focusable = HasState(ui::AX_STATE_FOCUSABLE);
179 if (IsIframe() || 179 if (IsIframe() ||
180 GetRole() == ui::AX_ROLE_WEB_AREA) { 180 GetRole() == ui::AX_ROLE_WEB_AREA) {
181 focusable = false; 181 focusable = false;
182 } 182 }
183 return focusable; 183 return focusable;
184 } 184 }
185 185
186 bool BrowserAccessibilityAndroid::IsFocused() const { 186 bool BrowserAccessibilityAndroid::IsFocused() const {
187 return manager()->GetFocus(manager()->GetRoot()) == this; 187 return manager()->GetFocus() == this;
188 } 188 }
189 189
190 bool BrowserAccessibilityAndroid::IsHeading() const { 190 bool BrowserAccessibilityAndroid::IsHeading() const {
191 BrowserAccessibilityAndroid* parent = 191 BrowserAccessibilityAndroid* parent =
192 static_cast<BrowserAccessibilityAndroid*>(GetParent()); 192 static_cast<BrowserAccessibilityAndroid*>(GetParent());
193 if (parent && parent->IsHeading()) 193 if (parent && parent->IsHeading())
194 return true; 194 return true;
195 195
196 return (GetRole() == ui::AX_ROLE_COLUMN_HEADER || 196 return (GetRole() == ui::AX_ROLE_COLUMN_HEADER ||
197 GetRole() == ui::AX_ROLE_HEADING || 197 GetRole() == ui::AX_ROLE_HEADING ||
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { 1380 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const {
1381 int count = 0; 1381 int count = 0;
1382 for (uint32_t i = 0; i < PlatformChildCount(); i++) { 1382 for (uint32_t i = 0; i < PlatformChildCount(); i++) {
1383 if (PlatformGetChild(i)->GetRole() == role) 1383 if (PlatformGetChild(i)->GetRole() == role)
1384 count++; 1384 count++;
1385 } 1385 }
1386 return count; 1386 return count;
1387 } 1387 }
1388 1388
1389 } // namespace content 1389 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698