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 | 6 |
7 #import "content/browser/accessibility/browser_accessibility_cocoa.h" | 7 #import "content/browser/accessibility/browser_accessibility_cocoa.h" |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 { @"AXARIAAtomic", @"ariaAtomic" }, | 108 { @"AXARIAAtomic", @"ariaAtomic" }, |
109 { @"AXARIABusy", @"ariaBusy" }, | 109 { @"AXARIABusy", @"ariaBusy" }, |
110 { @"AXARIALive", @"ariaLive" }, | 110 { @"AXARIALive", @"ariaLive" }, |
111 { @"AXARIARelevant", @"ariaRelevant" }, | 111 { @"AXARIARelevant", @"ariaRelevant" }, |
112 { @"AXDropEffects", @"dropeffect" }, | 112 { @"AXDropEffects", @"dropeffect" }, |
113 { @"AXGrabbed", @"grabbed" }, | 113 { @"AXGrabbed", @"grabbed" }, |
114 { @"AXInvalid", @"invalid" }, | 114 { @"AXInvalid", @"invalid" }, |
115 { @"AXLoaded", @"loaded" }, | 115 { @"AXLoaded", @"loaded" }, |
116 { @"AXLoadingProgress", @"loadingProgress" }, | 116 { @"AXLoadingProgress", @"loadingProgress" }, |
117 { @"AXPlaceholder", @"placeholder" }, | 117 { @"AXPlaceholder", @"placeholder" }, |
| 118 { @"AXMenuItemMarkChar", @"menuItemMarkChar"}, |
118 { @"AXRequired", @"required" }, | 119 { @"AXRequired", @"required" }, |
119 { @"AXSortDirection", @"sortDirection" }, | 120 { @"AXSortDirection", @"sortDirection" }, |
120 { @"AXVisited", @"visited" }, | 121 { @"AXVisited", @"visited" }, |
121 }; | 122 }; |
122 | 123 |
123 NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; | 124 NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; |
124 const size_t numAttributes = sizeof(attributeToMethodNameContainer) / | 125 const size_t numAttributes = sizeof(attributeToMethodNameContainer) / |
125 sizeof(attributeToMethodNameContainer[0]); | 126 sizeof(attributeToMethodNameContainer[0]); |
126 for (size_t i = 0; i < numAttributes; ++i) { | 127 for (size_t i = 0; i < numAttributes; ++i) { |
127 [dict setObject:attributeToMethodNameContainer[i].methodName | 128 [dict setObject:attributeToMethodNameContainer[i].methodName |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 | 488 |
488 - (NSString*)orientation { | 489 - (NSString*)orientation { |
489 if (GetState(browserAccessibility_, ui::AX_STATE_VERTICAL)) | 490 if (GetState(browserAccessibility_, ui::AX_STATE_VERTICAL)) |
490 return NSAccessibilityVerticalOrientationValue; | 491 return NSAccessibilityVerticalOrientationValue; |
491 else if (GetState(browserAccessibility_, ui::AX_STATE_HORIZONTAL)) | 492 else if (GetState(browserAccessibility_, ui::AX_STATE_HORIZONTAL)) |
492 return NSAccessibilityHorizontalOrientationValue; | 493 return NSAccessibilityHorizontalOrientationValue; |
493 | 494 |
494 return @""; | 495 return @""; |
495 } | 496 } |
496 | 497 |
| 498 - (NSString*)menuItemMarkChar { |
| 499 if (GetState(browserAccessibility_, ui::AX_STATE_CHECKED)) |
| 500 return @"\u2713"; |
| 501 else |
| 502 return @"nil"; |
| 503 } |
| 504 |
497 - (NSNumber*)numberOfCharacters { | 505 - (NSNumber*)numberOfCharacters { |
498 std::string value = browserAccessibility_->GetStringAttribute( | 506 std::string value = browserAccessibility_->GetStringAttribute( |
499 ui::AX_ATTR_VALUE); | 507 ui::AX_ATTR_VALUE); |
500 return [NSNumber numberWithInt:value.size()]; | 508 return [NSNumber numberWithInt:value.size()]; |
501 } | 509 } |
502 | 510 |
503 // The origin of this accessibility object in the page's document. | 511 // The origin of this accessibility object in the page's document. |
504 // This is relative to webkit's top-left origin, not Cocoa's | 512 // This is relative to webkit's top-left origin, not Cocoa's |
505 // bottom-left origin. | 513 // bottom-left origin. |
506 - (NSPoint)origin { | 514 - (NSPoint)origin { |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1381 [ret addObjectsFromArray:[NSArray arrayWithObjects: | 1389 [ret addObjectsFromArray:[NSArray arrayWithObjects: |
1382 NSAccessibilityIndexAttribute, | 1390 NSAccessibilityIndexAttribute, |
1383 nil]]; | 1391 nil]]; |
1384 } | 1392 } |
1385 } | 1393 } |
1386 } else if ([role isEqualToString:NSAccessibilityListRole]) { | 1394 } else if ([role isEqualToString:NSAccessibilityListRole]) { |
1387 [ret addObjectsFromArray:[NSArray arrayWithObjects: | 1395 [ret addObjectsFromArray:[NSArray arrayWithObjects: |
1388 NSAccessibilitySelectedChildrenAttribute, | 1396 NSAccessibilitySelectedChildrenAttribute, |
1389 NSAccessibilityVisibleChildrenAttribute, | 1397 NSAccessibilityVisibleChildrenAttribute, |
1390 nil]]; | 1398 nil]]; |
| 1399 } else if ([role isEqualToString:NSAccessibilityMenuItemRole]) { |
| 1400 [ret addObjectsFromArray:[NSArray arrayWithObjects: |
| 1401 @"AXMenuItemMarkChar", |
| 1402 nil]]; |
1391 } | 1403 } |
1392 | 1404 |
1393 // Add the url attribute only if it has a valid url. | 1405 // Add the url attribute only if it has a valid url. |
1394 if ([self url] != nil) { | 1406 if ([self url] != nil) { |
1395 [ret addObjectsFromArray:[NSArray arrayWithObjects: | 1407 [ret addObjectsFromArray:[NSArray arrayWithObjects: |
1396 NSAccessibilityURLAttribute, | 1408 NSAccessibilityURLAttribute, |
1397 nil]]; | 1409 nil]]; |
1398 } | 1410 } |
1399 | 1411 |
1400 // Live regions. | 1412 // Live regions. |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1615 if (!browserAccessibility_) | 1627 if (!browserAccessibility_) |
1616 return [super hash]; | 1628 return [super hash]; |
1617 return browserAccessibility_->GetId(); | 1629 return browserAccessibility_->GetId(); |
1618 } | 1630 } |
1619 | 1631 |
1620 - (BOOL)accessibilityShouldUseUniqueId { | 1632 - (BOOL)accessibilityShouldUseUniqueId { |
1621 return YES; | 1633 return YES; |
1622 } | 1634 } |
1623 | 1635 |
1624 @end | 1636 @end |
OLD | NEW |