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

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

Issue 1063383005: Chromium side Implementation to expose aria properties - setsize & posinset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updating expectations on android Created 5 years, 8 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_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 438
439 return text; 439 return text;
440 } 440 }
441 441
442 int BrowserAccessibilityAndroid::GetItemIndex() const { 442 int BrowserAccessibilityAndroid::GetItemIndex() const {
443 int index = 0; 443 int index = 0;
444 switch (GetRole()) { 444 switch (GetRole()) {
445 case ui::AX_ROLE_LIST_ITEM: 445 case ui::AX_ROLE_LIST_ITEM:
446 case ui::AX_ROLE_LIST_BOX_OPTION: 446 case ui::AX_ROLE_LIST_BOX_OPTION:
447 case ui::AX_ROLE_TREE_ITEM: 447 case ui::AX_ROLE_TREE_ITEM:
448 index = GetIndexInParent(); 448 index = GetIntAttribute(ui::AX_ATTR_POS_IN_SET) - 1;
449 break; 449 break;
450 case ui::AX_ROLE_SLIDER: 450 case ui::AX_ROLE_SLIDER:
451 case ui::AX_ROLE_PROGRESS_INDICATOR: { 451 case ui::AX_ROLE_PROGRESS_INDICATOR: {
452 // Return a percentage here for live feedback in an AccessibilityEvent. 452 // Return a percentage here for live feedback in an AccessibilityEvent.
453 // The exact value is returned in RangeCurrentValue. 453 // The exact value is returned in RangeCurrentValue.
454 float min = GetFloatAttribute(ui::AX_ATTR_MIN_VALUE_FOR_RANGE); 454 float min = GetFloatAttribute(ui::AX_ATTR_MIN_VALUE_FOR_RANGE);
455 float max = GetFloatAttribute(ui::AX_ATTR_MAX_VALUE_FOR_RANGE); 455 float max = GetFloatAttribute(ui::AX_ATTR_MAX_VALUE_FOR_RANGE);
456 float value = GetFloatAttribute(ui::AX_ATTR_VALUE_FOR_RANGE); 456 float value = GetFloatAttribute(ui::AX_ATTR_VALUE_FOR_RANGE);
457 if (max > min && value >= min && value <= max) 457 if (max > min && value >= min && value <= max)
458 index = static_cast<int>(((value - min)) * 100 / (max - min)); 458 index = static_cast<int>(((value - min)) * 100 / (max - min));
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { 875 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const {
876 int count = 0; 876 int count = 0;
877 for (uint32 i = 0; i < PlatformChildCount(); i++) { 877 for (uint32 i = 0; i < PlatformChildCount(); i++) {
878 if (PlatformGetChild(i)->GetRole() == role) 878 if (PlatformGetChild(i)->GetRole() == role)
879 count++; 879 count++;
880 } 880 }
881 return count; 881 return count;
882 } 882 }
883 883
884 } // namespace content 884 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698