Chromium Code Reviews| 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 2828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2839 } | 2839 } |
| 2840 | 2840 |
| 2841 // Returns the deepest accessibility child that should not be ignored. | 2841 // Returns the deepest accessibility child that should not be ignored. |
| 2842 // It is assumed that the hit test has been narrowed down to this object | 2842 // It is assumed that the hit test has been narrowed down to this object |
| 2843 // or one of its children, so this will never return nil unless this | 2843 // or one of its children, so this will never return nil unless this |
| 2844 // object is invalid. | 2844 // object is invalid. |
| 2845 - (id)accessibilityHitTest:(NSPoint)point { | 2845 - (id)accessibilityHitTest:(NSPoint)point { |
| 2846 if (![self instanceActive]) | 2846 if (![self instanceActive]) |
| 2847 return nil; | 2847 return nil; |
| 2848 | 2848 |
| 2849 BrowserAccessibilityCocoa* hit = self; | 2849 BrowserAccessibilityManager* manager = browserAccessibility_->manager(); |
| 2850 for (BrowserAccessibilityCocoa* child in [self children]) { | 2850 gfx::Point screen_point(point.x, point.y); |
| 2851 if (!child->browserAccessibility_) | 2851 screen_point += manager->GetViewBounds().OffsetFromOrigin(); |
| 2852 continue; | 2852 |
| 2853 NSPoint origin = [child origin]; | 2853 BrowserAccessibility* hit = manager->CachingAsyncHitTest(screen_point); |
| 2854 NSSize size = [[child size] sizeValue]; | 2854 LOG(ERROR) << "HitTest " << point.x << ", " << point.y |
|
Elly Fong-Jones
2016/10/06 14:20:53
leftover?
dmazzoni
2016/10/10 19:36:42
Fixed
| |
| 2855 NSRect rect; | 2855 << " : " << (hit ? hit->GetData().ToString() : "null"); |
| 2856 rect.origin = origin; | 2856 return NSAccessibilityUnignoredAncestor(ToBrowserAccessibilityCocoa(hit)); |
| 2857 rect.size = size; | |
| 2858 if (NSPointInRect(point, rect)) { | |
| 2859 hit = child; | |
| 2860 id childResult = [child accessibilityHitTest:point]; | |
| 2861 if (![childResult accessibilityIsIgnored]) { | |
| 2862 hit = childResult; | |
| 2863 break; | |
| 2864 } | |
| 2865 } | |
| 2866 } | |
| 2867 return NSAccessibilityUnignoredAncestor(hit); | |
| 2868 } | 2857 } |
| 2869 | 2858 |
| 2870 - (BOOL)isEqual:(id)object { | 2859 - (BOOL)isEqual:(id)object { |
| 2871 if (![object isKindOfClass:[BrowserAccessibilityCocoa class]]) | 2860 if (![object isKindOfClass:[BrowserAccessibilityCocoa class]]) |
| 2872 return NO; | 2861 return NO; |
| 2873 return ([self hash] == [object hash]); | 2862 return ([self hash] == [object hash]); |
| 2874 } | 2863 } |
| 2875 | 2864 |
| 2876 - (NSUInteger)hash { | 2865 - (NSUInteger)hash { |
| 2877 // Potentially called during dealloc. | 2866 // Potentially called during dealloc. |
| 2878 if (![self instanceActive]) | 2867 if (![self instanceActive]) |
| 2879 return [super hash]; | 2868 return [super hash]; |
| 2880 return browserAccessibility_->GetId(); | 2869 return browserAccessibility_->GetId(); |
| 2881 } | 2870 } |
| 2882 | 2871 |
| 2883 - (BOOL)accessibilityShouldUseUniqueId { | 2872 - (BOOL)accessibilityShouldUseUniqueId { |
| 2884 return YES; | 2873 return YES; |
| 2885 } | 2874 } |
| 2886 | 2875 |
| 2887 @end | 2876 @end |
| OLD | NEW |