| 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 2835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2846 } | 2846 } |
| 2847 | 2847 |
| 2848 // Returns the deepest accessibility child that should not be ignored. | 2848 // Returns the deepest accessibility child that should not be ignored. |
| 2849 // It is assumed that the hit test has been narrowed down to this object | 2849 // It is assumed that the hit test has been narrowed down to this object |
| 2850 // or one of its children, so this will never return nil unless this | 2850 // or one of its children, so this will never return nil unless this |
| 2851 // object is invalid. | 2851 // object is invalid. |
| 2852 - (id)accessibilityHitTest:(NSPoint)point { | 2852 - (id)accessibilityHitTest:(NSPoint)point { |
| 2853 if (![self instanceActive]) | 2853 if (![self instanceActive]) |
| 2854 return nil; | 2854 return nil; |
| 2855 | 2855 |
| 2856 BrowserAccessibilityCocoa* hit = self; | 2856 BrowserAccessibilityManager* manager = browserAccessibility_->manager(); |
| 2857 for (BrowserAccessibilityCocoa* child in [self children]) { | 2857 gfx::Point screen_point(point.x, point.y); |
| 2858 if (!child->browserAccessibility_) | 2858 screen_point += manager->GetViewBounds().OffsetFromOrigin(); |
| 2859 continue; | 2859 |
| 2860 NSPoint origin = [child origin]; | 2860 BrowserAccessibility* hit = manager->CachingAsyncHitTest(screen_point); |
| 2861 NSSize size = [[child size] sizeValue]; | 2861 if (!hit) |
| 2862 NSRect rect; | 2862 return nil; |
| 2863 rect.origin = origin; | 2863 |
| 2864 rect.size = size; | 2864 return NSAccessibilityUnignoredAncestor(ToBrowserAccessibilityCocoa(hit)); |
| 2865 if (NSPointInRect(point, rect)) { | |
| 2866 hit = child; | |
| 2867 id childResult = [child accessibilityHitTest:point]; | |
| 2868 if (![childResult accessibilityIsIgnored]) { | |
| 2869 hit = childResult; | |
| 2870 break; | |
| 2871 } | |
| 2872 } | |
| 2873 } | |
| 2874 return NSAccessibilityUnignoredAncestor(hit); | |
| 2875 } | 2865 } |
| 2876 | 2866 |
| 2877 - (BOOL)isEqual:(id)object { | 2867 - (BOOL)isEqual:(id)object { |
| 2878 if (![object isKindOfClass:[BrowserAccessibilityCocoa class]]) | 2868 if (![object isKindOfClass:[BrowserAccessibilityCocoa class]]) |
| 2879 return NO; | 2869 return NO; |
| 2880 return ([self hash] == [object hash]); | 2870 return ([self hash] == [object hash]); |
| 2881 } | 2871 } |
| 2882 | 2872 |
| 2883 - (NSUInteger)hash { | 2873 - (NSUInteger)hash { |
| 2884 // Potentially called during dealloc. | 2874 // Potentially called during dealloc. |
| 2885 if (![self instanceActive]) | 2875 if (![self instanceActive]) |
| 2886 return [super hash]; | 2876 return [super hash]; |
| 2887 return browserAccessibility_->GetId(); | 2877 return browserAccessibility_->GetId(); |
| 2888 } | 2878 } |
| 2889 | 2879 |
| 2890 - (BOOL)accessibilityNotifiesWhenDestroyed { | 2880 - (BOOL)accessibilityNotifiesWhenDestroyed { |
| 2891 // Indicate that BrowserAccessibilityCocoa will post a notification when it's | 2881 // Indicate that BrowserAccessibilityCocoa will post a notification when it's |
| 2892 // destroyed (see -detach). This allows VoiceOver to do some internal things | 2882 // destroyed (see -detach). This allows VoiceOver to do some internal things |
| 2893 // more efficiently. | 2883 // more efficiently. |
| 2894 return YES; | 2884 return YES; |
| 2895 } | 2885 } |
| 2896 | 2886 |
| 2897 @end | 2887 @end |
| OLD | NEW |