OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #import "content/browser/accessibility/browser_accessibility_cocoa.h" | 5 #import "content/browser/accessibility/browser_accessibility_cocoa.h" |
6 | 6 |
7 #include <execinfo.h> | 7 #include <execinfo.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1878 | 1878 |
1879 if (isMixed) | 1879 if (isMixed) |
1880 value = 2; | 1880 value = 2; |
1881 | 1881 |
1882 return [NSNumber numberWithInt:value]; | 1882 return [NSNumber numberWithInt:value]; |
1883 | 1883 |
1884 } else if ([role isEqualToString:NSAccessibilityCheckBoxRole] || | 1884 } else if ([role isEqualToString:NSAccessibilityCheckBoxRole] || |
1885 [role isEqualToString:NSAccessibilityRadioButtonRole] || | 1885 [role isEqualToString:NSAccessibilityRadioButtonRole] || |
1886 [self internalRole] == ui::AX_ROLE_MENU_ITEM_CHECK_BOX || | 1886 [self internalRole] == ui::AX_ROLE_MENU_ITEM_CHECK_BOX || |
1887 [self internalRole] == ui::AX_ROLE_MENU_ITEM_RADIO) { | 1887 [self internalRole] == ui::AX_ROLE_MENU_ITEM_RADIO) { |
1888 int value = 0; | 1888 int value; |
1889 value = GetState( | 1889 const auto checkedState = static_cast<ui::AXCheckedState>( |
1890 browserAccessibility_, ui::AX_STATE_CHECKED) ? 1 : 0; | 1890 browserAccessibility_->GetIntAttribute(ui::AX_ATTR_CHECKED_STATE)); |
1891 value = GetState( | 1891 switch (checkedState) { |
1892 browserAccessibility_, ui::AX_STATE_SELECTED) ? | 1892 case ui::AX_CHECKED_STATE_TRUE: |
1893 1 : | 1893 value = 1; |
1894 value; | 1894 break; |
1895 | 1895 case ui::AX_CHECKED_STATE_MIXED: |
1896 if (browserAccessibility_->GetBoolAttribute(ui::AX_ATTR_STATE_MIXED)) { | 1896 value = 2; |
1897 value = 2; | 1897 break; |
| 1898 default: |
| 1899 value = GetState(browserAccessibility_, ui::AX_STATE_SELECTED) ? 1 : 0; |
| 1900 break; |
1898 } | 1901 } |
1899 return [NSNumber numberWithInt:value]; | 1902 return [NSNumber numberWithInt:value]; |
1900 } else if ([role isEqualToString:NSAccessibilityProgressIndicatorRole] || | 1903 } else if ([role isEqualToString:NSAccessibilityProgressIndicatorRole] || |
1901 [role isEqualToString:NSAccessibilitySliderRole] || | 1904 [role isEqualToString:NSAccessibilitySliderRole] || |
1902 [role isEqualToString:NSAccessibilityIncrementorRole] || | 1905 [role isEqualToString:NSAccessibilityIncrementorRole] || |
1903 [role isEqualToString:NSAccessibilityScrollBarRole]) { | 1906 [role isEqualToString:NSAccessibilityScrollBarRole]) { |
1904 float floatValue; | 1907 float floatValue; |
1905 if (browserAccessibility_->GetFloatAttribute( | 1908 if (browserAccessibility_->GetFloatAttribute( |
1906 ui::AX_ATTR_VALUE_FOR_RANGE, &floatValue)) { | 1909 ui::AX_ATTR_VALUE_FOR_RANGE, &floatValue)) { |
1907 return [NSNumber numberWithFloat:floatValue]; | 1910 return [NSNumber numberWithFloat:floatValue]; |
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2896 } | 2899 } |
2897 | 2900 |
2898 - (BOOL)accessibilityNotifiesWhenDestroyed { | 2901 - (BOOL)accessibilityNotifiesWhenDestroyed { |
2899 // Indicate that BrowserAccessibilityCocoa will post a notification when it's | 2902 // Indicate that BrowserAccessibilityCocoa will post a notification when it's |
2900 // destroyed (see -detach). This allows VoiceOver to do some internal things | 2903 // destroyed (see -detach). This allows VoiceOver to do some internal things |
2901 // more efficiently. | 2904 // more efficiently. |
2902 return YES; | 2905 return YES; |
2903 } | 2906 } |
2904 | 2907 |
2905 @end | 2908 @end |
OLD | NEW |