| 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 #include <execinfo.h> | 5 #include <execinfo.h> |
| 6 #include <stddef.h> | 6 #include <stddef.h> |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #import "content/browser/accessibility/browser_accessibility_cocoa.h" | 9 #import "content/browser/accessibility/browser_accessibility_cocoa.h" |
| 10 | 10 |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 } | 858 } |
| 859 | 859 |
| 860 - (NSNumber*)expanded { | 860 - (NSNumber*)expanded { |
| 861 return [NSNumber numberWithBool: | 861 return [NSNumber numberWithBool: |
| 862 GetState(browserAccessibility_, ui::AX_STATE_EXPANDED)]; | 862 GetState(browserAccessibility_, ui::AX_STATE_EXPANDED)]; |
| 863 } | 863 } |
| 864 | 864 |
| 865 - (NSNumber*)focused { | 865 - (NSNumber*)focused { |
| 866 BrowserAccessibilityManager* manager = browserAccessibility_->manager(); | 866 BrowserAccessibilityManager* manager = browserAccessibility_->manager(); |
| 867 NSNumber* ret = [NSNumber numberWithBool: | 867 NSNumber* ret = [NSNumber numberWithBool: |
| 868 manager->GetFocus(NULL) == browserAccessibility_]; | 868 manager->GetFocus() == browserAccessibility_]; |
| 869 return ret; | 869 return ret; |
| 870 } | 870 } |
| 871 | 871 |
| 872 - (NSNumber*)grabbed { | 872 - (NSNumber*)grabbed { |
| 873 std::string grabbed; | 873 std::string grabbed; |
| 874 if (browserAccessibility_->GetHtmlAttribute("aria-grabbed", &grabbed) && | 874 if (browserAccessibility_->GetHtmlAttribute("aria-grabbed", &grabbed) && |
| 875 grabbed == "true") | 875 grabbed == "true") |
| 876 return [NSNumber numberWithBool:YES]; | 876 return [NSNumber numberWithBool:YES]; |
| 877 | 877 |
| 878 return [NSNumber numberWithBool:NO]; | 878 return [NSNumber numberWithBool:NO]; |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1315 [ret addObject:rowElement->ToBrowserAccessibilityCocoa()]; | 1315 [ret addObject:rowElement->ToBrowserAccessibilityCocoa()]; |
| 1316 } | 1316 } |
| 1317 } | 1317 } |
| 1318 | 1318 |
| 1319 return ret; | 1319 return ret; |
| 1320 } | 1320 } |
| 1321 | 1321 |
| 1322 - (NSArray*)selectedChildren { | 1322 - (NSArray*)selectedChildren { |
| 1323 NSMutableArray* ret = [[[NSMutableArray alloc] init] autorelease]; | 1323 NSMutableArray* ret = [[[NSMutableArray alloc] init] autorelease]; |
| 1324 BrowserAccessibilityManager* manager = browserAccessibility_->manager(); | 1324 BrowserAccessibilityManager* manager = browserAccessibility_->manager(); |
| 1325 BrowserAccessibility* focusedChild = manager->GetFocus(browserAccessibility_); | 1325 BrowserAccessibility* focusedChild = manager->GetFocus(); |
| 1326 if (!focusedChild->IsDescendantOf(browserAccessibility_)) |
| 1327 focusedChild = nullptr; |
| 1326 | 1328 |
| 1327 // If it's not multiselectable, try to skip iterating over the | 1329 // If it's not multiselectable, try to skip iterating over the |
| 1328 // children. | 1330 // children. |
| 1329 if (!GetState(browserAccessibility_, ui::AX_STATE_MULTISELECTABLE)) { | 1331 if (!GetState(browserAccessibility_, ui::AX_STATE_MULTISELECTABLE)) { |
| 1330 // First try the focused child. | 1332 // First try the focused child. |
| 1331 if (focusedChild && focusedChild != browserAccessibility_) { | 1333 if (focusedChild && focusedChild != browserAccessibility_) { |
| 1332 [ret addObject:focusedChild->ToBrowserAccessibilityCocoa()]; | 1334 [ret addObject:focusedChild->ToBrowserAccessibilityCocoa()]; |
| 1333 return ret; | 1335 return ret; |
| 1334 } | 1336 } |
| 1335 | 1337 |
| (...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2354 // Sets the value for an accessibility attribute via the accessibility API. | 2356 // Sets the value for an accessibility attribute via the accessibility API. |
| 2355 - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute { | 2357 - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute { |
| 2356 if (!browserAccessibility_) | 2358 if (!browserAccessibility_) |
| 2357 return; | 2359 return; |
| 2358 | 2360 |
| 2359 if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) { | 2361 if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) { |
| 2360 BrowserAccessibilityManager* manager = browserAccessibility_->manager(); | 2362 BrowserAccessibilityManager* manager = browserAccessibility_->manager(); |
| 2361 NSNumber* focusedNumber = value; | 2363 NSNumber* focusedNumber = value; |
| 2362 BOOL focused = [focusedNumber intValue]; | 2364 BOOL focused = [focusedNumber intValue]; |
| 2363 if (focused) | 2365 if (focused) |
| 2364 manager->SetFocus(browserAccessibility_, true); | 2366 manager->SetFocus(*browserAccessibility_); |
| 2365 } | 2367 } |
| 2366 if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute]) { | 2368 if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute]) { |
| 2367 NSRange range = [(NSValue*)value rangeValue]; | 2369 NSRange range = [(NSValue*)value rangeValue]; |
| 2368 [self delegate]->AccessibilitySetSelection( | 2370 [self delegate]->AccessibilitySetSelection( |
| 2369 browserAccessibility_->GetId(), range.location, | 2371 browserAccessibility_->GetId(), range.location, |
| 2370 browserAccessibility_->GetId(), range.location + range.length); | 2372 browserAccessibility_->GetId(), range.location + range.length); |
| 2371 } | 2373 } |
| 2372 } | 2374 } |
| 2373 | 2375 |
| 2374 // Returns the deepest accessibility child that should not be ignored. | 2376 // Returns the deepest accessibility child that should not be ignored. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2411 if (!browserAccessibility_) | 2413 if (!browserAccessibility_) |
| 2412 return [super hash]; | 2414 return [super hash]; |
| 2413 return browserAccessibility_->GetId(); | 2415 return browserAccessibility_->GetId(); |
| 2414 } | 2416 } |
| 2415 | 2417 |
| 2416 - (BOOL)accessibilityShouldUseUniqueId { | 2418 - (BOOL)accessibilityShouldUseUniqueId { |
| 2417 return YES; | 2419 return YES; |
| 2418 } | 2420 } |
| 2419 | 2421 |
| 2420 @end | 2422 @end |
| OLD | NEW |