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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 } | 763 } |
764 return children_; | 764 return children_; |
765 } | 765 } |
766 | 766 |
767 - (void)childrenChanged { | 767 - (void)childrenChanged { |
768 if (![self instanceActive]) | 768 if (![self instanceActive]) |
769 return; | 769 return; |
770 if (![self isIgnored]) { | 770 if (![self isIgnored]) { |
771 children_.reset(); | 771 children_.reset(); |
772 } else { | 772 } else { |
773 [ToBrowserAccessibilityCocoa(browserAccessibility_->GetParent()) | 773 [ToBrowserAccessibilityCocoa(browserAccessibility_->PlatformGetParent()) |
774 childrenChanged]; | 774 childrenChanged]; |
775 } | 775 } |
776 } | 776 } |
777 | 777 |
778 - (NSArray*)columnHeaders { | 778 - (NSArray*)columnHeaders { |
779 if (![self instanceActive]) | 779 if (![self instanceActive]) |
780 return nil; | 780 return nil; |
781 if ([self internalRole] != ui::AX_ROLE_TABLE && | 781 if ([self internalRole] != ui::AX_ROLE_TABLE && |
782 [self internalRole] != ui::AX_ROLE_GRID) { | 782 [self internalRole] != ui::AX_ROLE_GRID) { |
783 return nil; | 783 return nil; |
784 } | 784 } |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 if (![self instanceActive]) | 1236 if (![self instanceActive]) |
1237 return NSMakePoint(0, 0); | 1237 return NSMakePoint(0, 0); |
1238 gfx::Rect bounds = browserAccessibility_->GetPageBoundsRect(); | 1238 gfx::Rect bounds = browserAccessibility_->GetPageBoundsRect(); |
1239 return NSMakePoint(bounds.x(), bounds.y()); | 1239 return NSMakePoint(bounds.x(), bounds.y()); |
1240 } | 1240 } |
1241 | 1241 |
1242 - (id)parent { | 1242 - (id)parent { |
1243 if (![self instanceActive]) | 1243 if (![self instanceActive]) |
1244 return nil; | 1244 return nil; |
1245 // A nil parent means we're the root. | 1245 // A nil parent means we're the root. |
1246 if (browserAccessibility_->GetParent()) { | 1246 if (browserAccessibility_->PlatformGetParent()) { |
1247 return NSAccessibilityUnignoredAncestor( | 1247 return NSAccessibilityUnignoredAncestor(ToBrowserAccessibilityCocoa( |
1248 ToBrowserAccessibilityCocoa(browserAccessibility_->GetParent())); | 1248 browserAccessibility_->PlatformGetParent())); |
1249 } else { | 1249 } else { |
1250 // Hook back up to RenderWidgetHostViewCocoa. | 1250 // Hook back up to RenderWidgetHostViewCocoa. |
1251 BrowserAccessibilityManagerMac* manager = | 1251 BrowserAccessibilityManagerMac* manager = |
1252 browserAccessibility_->manager()->GetRootManager() | 1252 browserAccessibility_->manager()->GetRootManager() |
1253 ->ToBrowserAccessibilityManagerMac(); | 1253 ->ToBrowserAccessibilityManagerMac(); |
1254 if (manager) | 1254 if (manager) |
1255 return manager->GetParentView(); | 1255 return manager->GetParentView(); |
1256 return nil; | 1256 return nil; |
1257 } | 1257 } |
1258 } | 1258 } |
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2410 NSAccessibilityIndexForChildUIElementParameterizedAttribute]) { | 2410 NSAccessibilityIndexForChildUIElementParameterizedAttribute]) { |
2411 if (![parameter isKindOfClass:[BrowserAccessibilityCocoa class]]) | 2411 if (![parameter isKindOfClass:[BrowserAccessibilityCocoa class]]) |
2412 return nil; | 2412 return nil; |
2413 | 2413 |
2414 BrowserAccessibilityCocoa* childCocoaObj = | 2414 BrowserAccessibilityCocoa* childCocoaObj = |
2415 (BrowserAccessibilityCocoa*)parameter; | 2415 (BrowserAccessibilityCocoa*)parameter; |
2416 BrowserAccessibility* child = [childCocoaObj browserAccessibility]; | 2416 BrowserAccessibility* child = [childCocoaObj browserAccessibility]; |
2417 if (!child) | 2417 if (!child) |
2418 return nil; | 2418 return nil; |
2419 | 2419 |
2420 if (child->GetParent() != browserAccessibility_) | 2420 if (child->PlatformGetParent() != browserAccessibility_) |
2421 return nil; | 2421 return nil; |
2422 | 2422 |
2423 return @(child->GetIndexInParent()); | 2423 return @(child->GetIndexInParent()); |
2424 } | 2424 } |
2425 | 2425 |
2426 return nil; | 2426 return nil; |
2427 } | 2427 } |
2428 | 2428 |
2429 // Returns an array of parameterized attributes names that this object will | 2429 // Returns an array of parameterized attributes names that this object will |
2430 // respond to. | 2430 // respond to. |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2641 NSAccessibilityValueDescriptionAttribute | 2641 NSAccessibilityValueDescriptionAttribute |
2642 ]]; | 2642 ]]; |
2643 } else if ([subrole isEqualToString:NSAccessibilityOutlineRowSubrole]) { | 2643 } else if ([subrole isEqualToString:NSAccessibilityOutlineRowSubrole]) { |
2644 [ret addObjectsFromArray:@[ | 2644 [ret addObjectsFromArray:@[ |
2645 NSAccessibilityDisclosingAttribute, | 2645 NSAccessibilityDisclosingAttribute, |
2646 NSAccessibilityDisclosedByRowAttribute, | 2646 NSAccessibilityDisclosedByRowAttribute, |
2647 NSAccessibilityDisclosureLevelAttribute, | 2647 NSAccessibilityDisclosureLevelAttribute, |
2648 NSAccessibilityDisclosedRowsAttribute | 2648 NSAccessibilityDisclosedRowsAttribute |
2649 ]]; | 2649 ]]; |
2650 } else if ([role isEqualToString:NSAccessibilityRowRole]) { | 2650 } else if ([role isEqualToString:NSAccessibilityRowRole]) { |
2651 if (browserAccessibility_->GetParent()) { | 2651 if (browserAccessibility_->PlatformGetParent()) { |
2652 base::string16 parentRole; | 2652 base::string16 parentRole; |
2653 browserAccessibility_->GetParent()->GetHtmlAttribute( | 2653 browserAccessibility_->PlatformGetParent()->GetHtmlAttribute("role", |
2654 "role", &parentRole); | 2654 &parentRole); |
2655 const base::string16 treegridRole(base::ASCIIToUTF16("treegrid")); | 2655 const base::string16 treegridRole(base::ASCIIToUTF16("treegrid")); |
2656 if (parentRole == treegridRole) { | 2656 if (parentRole == treegridRole) { |
2657 [ret addObjectsFromArray:@[ | 2657 [ret addObjectsFromArray:@[ |
2658 NSAccessibilityDisclosingAttribute, | 2658 NSAccessibilityDisclosingAttribute, |
2659 NSAccessibilityDisclosedByRowAttribute, | 2659 NSAccessibilityDisclosedByRowAttribute, |
2660 NSAccessibilityDisclosureLevelAttribute, | 2660 NSAccessibilityDisclosureLevelAttribute, |
2661 NSAccessibilityDisclosedRowsAttribute | 2661 NSAccessibilityDisclosedRowsAttribute |
2662 ]]; | 2662 ]]; |
2663 } else { | 2663 } else { |
2664 [ret addObjectsFromArray:@[ NSAccessibilityIndexAttribute ]]; | 2664 [ret addObjectsFromArray:@[ NSAccessibilityIndexAttribute ]]; |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2896 } | 2896 } |
2897 | 2897 |
2898 - (BOOL)accessibilityNotifiesWhenDestroyed { | 2898 - (BOOL)accessibilityNotifiesWhenDestroyed { |
2899 // Indicate that BrowserAccessibilityCocoa will post a notification when it's | 2899 // Indicate that BrowserAccessibilityCocoa will post a notification when it's |
2900 // destroyed (see -detach). This allows VoiceOver to do some internal things | 2900 // destroyed (see -detach). This allows VoiceOver to do some internal things |
2901 // more efficiently. | 2901 // more efficiently. |
2902 return YES; | 2902 return YES; |
2903 } | 2903 } |
2904 | 2904 |
2905 @end | 2905 @end |
OLD | NEW |