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

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

Issue 2761853004: Rename BrowserAccessibility::GetParent to PlatformGetParent. (Closed)
Patch Set: PlatformGetParent rename Created 3 years, 9 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 bool BrowserAccessibilityAndroid::IsExpanded() const { 208 bool BrowserAccessibilityAndroid::IsExpanded() const {
209 return HasState(ui::AX_STATE_EXPANDED); 209 return HasState(ui::AX_STATE_EXPANDED);
210 } 210 }
211 211
212 bool BrowserAccessibilityAndroid::IsFocusable() const { 212 bool BrowserAccessibilityAndroid::IsFocusable() const {
213 // If it's an iframe element, or the root element of a child frame, 213 // If it's an iframe element, or the root element of a child frame,
214 // only mark it as focusable if the element has an explicit name. 214 // only mark it as focusable if the element has an explicit name.
215 // Otherwise mark it as not focusable to avoid the user landing on 215 // Otherwise mark it as not focusable to avoid the user landing on
216 // empty container elements in the tree. 216 // empty container elements in the tree.
217 if (IsIframe() || (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA && GetParent())) 217 if (IsIframe() ||
218 (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA && PlatformGetParent()))
218 return HasStringAttribute(ui::AX_ATTR_NAME); 219 return HasStringAttribute(ui::AX_ATTR_NAME);
219 220
220 return HasState(ui::AX_STATE_FOCUSABLE); 221 return HasState(ui::AX_STATE_FOCUSABLE);
221 } 222 }
222 223
223 bool BrowserAccessibilityAndroid::IsFocused() const { 224 bool BrowserAccessibilityAndroid::IsFocused() const {
224 return manager()->GetFocus() == this; 225 return manager()->GetFocus() == this;
225 } 226 }
226 227
227 bool BrowserAccessibilityAndroid::IsHeading() const { 228 bool BrowserAccessibilityAndroid::IsHeading() const {
228 BrowserAccessibilityAndroid* parent = 229 BrowserAccessibilityAndroid* parent =
229 static_cast<BrowserAccessibilityAndroid*>(GetParent()); 230 static_cast<BrowserAccessibilityAndroid*>(PlatformGetParent());
230 if (parent && parent->IsHeading()) 231 if (parent && parent->IsHeading())
231 return true; 232 return true;
232 233
233 return (GetRole() == ui::AX_ROLE_COLUMN_HEADER || 234 return (GetRole() == ui::AX_ROLE_COLUMN_HEADER ||
234 GetRole() == ui::AX_ROLE_HEADING || 235 GetRole() == ui::AX_ROLE_HEADING ||
235 GetRole() == ui::AX_ROLE_ROW_HEADER); 236 GetRole() == ui::AX_ROLE_ROW_HEADER);
236 } 237 }
237 238
238 bool BrowserAccessibilityAndroid::IsHierarchical() const { 239 bool BrowserAccessibilityAndroid::IsHierarchical() const {
239 return (GetRole() == ui::AX_ROLE_LIST || 240 return (GetRole() == ui::AX_ROLE_LIST ||
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 break; 376 break;
376 case ui::AX_ROLE_LIST: 377 case ui::AX_ROLE_LIST:
377 case ui::AX_ROLE_LIST_BOX: 378 case ui::AX_ROLE_LIST_BOX:
378 case ui::AX_ROLE_DESCRIPTION_LIST: 379 case ui::AX_ROLE_DESCRIPTION_LIST:
379 class_name = ui::kAXListViewClassname; 380 class_name = ui::kAXListViewClassname;
380 break; 381 break;
381 case ui::AX_ROLE_DIALOG: 382 case ui::AX_ROLE_DIALOG:
382 class_name = ui::kAXDialogClassname; 383 class_name = ui::kAXDialogClassname;
383 break; 384 break;
384 case ui::AX_ROLE_ROOT_WEB_AREA: 385 case ui::AX_ROLE_ROOT_WEB_AREA:
385 if (GetParent() == nullptr) 386 if (PlatformGetParent() == nullptr)
386 class_name = ui::kAXWebViewClassname; 387 class_name = ui::kAXWebViewClassname;
387 else 388 else
388 class_name = ui::kAXViewClassname; 389 class_name = ui::kAXViewClassname;
389 break; 390 break;
390 case ui::AX_ROLE_MENU_ITEM: 391 case ui::AX_ROLE_MENU_ITEM:
391 case ui::AX_ROLE_MENU_ITEM_CHECK_BOX: 392 case ui::AX_ROLE_MENU_ITEM_CHECK_BOX:
392 case ui::AX_ROLE_MENU_ITEM_RADIO: 393 case ui::AX_ROLE_MENU_ITEM_RADIO:
393 class_name = ui::kAXMenuItemClassname; 394 class_name = ui::kAXMenuItemClassname;
394 break; 395 break;
395 default: 396 default:
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 int x = GetIntAttribute(ui::AX_ATTR_SCROLL_X); 1039 int x = GetIntAttribute(ui::AX_ATTR_SCROLL_X);
1039 int x_min = GetIntAttribute(ui::AX_ATTR_SCROLL_X_MIN); 1040 int x_min = GetIntAttribute(ui::AX_ATTR_SCROLL_X_MIN);
1040 int x_max = GetIntAttribute(ui::AX_ATTR_SCROLL_X_MAX); 1041 int x_max = GetIntAttribute(ui::AX_ATTR_SCROLL_X_MAX);
1041 int y = GetIntAttribute(ui::AX_ATTR_SCROLL_Y); 1042 int y = GetIntAttribute(ui::AX_ATTR_SCROLL_Y);
1042 int y_min = GetIntAttribute(ui::AX_ATTR_SCROLL_Y_MIN); 1043 int y_min = GetIntAttribute(ui::AX_ATTR_SCROLL_Y_MIN);
1043 int y_max = GetIntAttribute(ui::AX_ATTR_SCROLL_Y_MAX); 1044 int y_max = GetIntAttribute(ui::AX_ATTR_SCROLL_Y_MAX);
1044 1045
1045 // Figure out the bounding box of the visible portion of this scrollable 1046 // Figure out the bounding box of the visible portion of this scrollable
1046 // view so we know how much to scroll by. 1047 // view so we know how much to scroll by.
1047 gfx::Rect bounds; 1048 gfx::Rect bounds;
1048 if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA && !GetParent()) { 1049 if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA && !PlatformGetParent()) {
1049 // If this is the root web area, use the bounds of the view to determine 1050 // If this is the root web area, use the bounds of the view to determine
1050 // how big one page is. 1051 // how big one page is.
1051 if (!manager()->delegate()) 1052 if (!manager()->delegate())
1052 return false; 1053 return false;
1053 bounds = manager()->delegate()->AccessibilityGetViewBounds(); 1054 bounds = manager()->delegate()->AccessibilityGetViewBounds();
1054 } else if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA && GetParent()) { 1055 } else if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA && PlatformGetParent()) {
1055 // If this is a web area inside of an iframe, try to use the bounds of 1056 // If this is a web area inside of an iframe, try to use the bounds of
1056 // the containing element. 1057 // the containing element.
1057 BrowserAccessibility* parent = GetParent(); 1058 BrowserAccessibility* parent = PlatformGetParent();
1058 while (parent && (parent->GetPageBoundsRect().width() == 0 || 1059 while (parent && (parent->GetPageBoundsRect().width() == 0 ||
1059 parent->GetPageBoundsRect().height() == 0)) { 1060 parent->GetPageBoundsRect().height() == 0)) {
1060 parent = parent->GetParent(); 1061 parent = parent->PlatformGetParent();
1061 } 1062 }
1062 if (parent) 1063 if (parent)
1063 bounds = parent->GetPageBoundsRect(); 1064 bounds = parent->GetPageBoundsRect();
1064 else 1065 else
1065 bounds = GetPageBoundsRect(); 1066 bounds = GetPageBoundsRect();
1066 } else { 1067 } else {
1067 // Otherwise this is something like a scrollable div, just use the 1068 // Otherwise this is something like a scrollable div, just use the
1068 // bounds of this object itself. 1069 // bounds of this object itself.
1069 bounds = GetPageBoundsRect(); 1070 bounds = GetPageBoundsRect();
1070 } 1071 }
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { 1500 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const {
1500 int count = 0; 1501 int count = 0;
1501 for (uint32_t i = 0; i < PlatformChildCount(); i++) { 1502 for (uint32_t i = 0; i < PlatformChildCount(); i++) {
1502 if (PlatformGetChild(i)->GetRole() == role) 1503 if (PlatformGetChild(i)->GetRole() == role)
1503 count++; 1504 count++;
1504 } 1505 }
1505 return count; 1506 return count;
1506 } 1507 }
1507 1508
1508 } // namespace content 1509 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698