OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |