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 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1414 // Returns the deepest accessibility child that should not be ignored. | 1414 // Returns the deepest accessibility child that should not be ignored. |
1415 // It is assumed that the hit test has been narrowed down to this object | 1415 // It is assumed that the hit test has been narrowed down to this object |
1416 // or one of its children, so this will never return nil unless this | 1416 // or one of its children, so this will never return nil unless this |
1417 // object is invalid. | 1417 // object is invalid. |
1418 - (id)accessibilityHitTest:(NSPoint)point { | 1418 - (id)accessibilityHitTest:(NSPoint)point { |
1419 if (!browserAccessibility_) | 1419 if (!browserAccessibility_) |
1420 return nil; | 1420 return nil; |
1421 | 1421 |
1422 BrowserAccessibilityCocoa* hit = self; | 1422 BrowserAccessibilityCocoa* hit = self; |
1423 for (BrowserAccessibilityCocoa* child in [self children]) { | 1423 for (BrowserAccessibilityCocoa* child in [self children]) { |
1424 if (!child) | |
dmazzoni
2013/11/05 16:44:32
This doesn't look right, I don't see how |child| s
| |
1425 continue; | |
1424 NSPoint origin = [child origin]; | 1426 NSPoint origin = [child origin]; |
1425 NSSize size = [[child size] sizeValue]; | 1427 NSSize size = [[child size] sizeValue]; |
1426 NSRect rect; | 1428 NSRect rect; |
1427 rect.origin = origin; | 1429 rect.origin = origin; |
1428 rect.size = size; | 1430 rect.size = size; |
1429 if (NSPointInRect(point, rect)) { | 1431 if (NSPointInRect(point, rect)) { |
1430 hit = child; | 1432 hit = child; |
1431 id childResult = [child accessibilityHitTest:point]; | 1433 id childResult = [child accessibilityHitTest:point]; |
1432 if (![childResult accessibilityIsIgnored]) { | 1434 if (![childResult accessibilityIsIgnored]) { |
dmazzoni
2013/11/05 16:44:32
I think childResult could be nil here. Is that the
| |
1433 hit = childResult; | 1435 hit = childResult; |
1434 break; | 1436 break; |
1435 } | 1437 } |
1436 } | 1438 } |
1437 } | 1439 } |
1438 return NSAccessibilityUnignoredAncestor(hit); | 1440 return NSAccessibilityUnignoredAncestor(hit); |
1439 } | 1441 } |
1440 | 1442 |
1441 - (BOOL)isEqual:(id)object { | 1443 - (BOOL)isEqual:(id)object { |
1442 if (![object isKindOfClass:[BrowserAccessibilityCocoa class]]) | 1444 if (![object isKindOfClass:[BrowserAccessibilityCocoa class]]) |
1443 return NO; | 1445 return NO; |
1444 return ([self hash] == [object hash]); | 1446 return ([self hash] == [object hash]); |
1445 } | 1447 } |
1446 | 1448 |
1447 - (NSUInteger)hash { | 1449 - (NSUInteger)hash { |
1448 // Potentially called during dealloc. | 1450 // Potentially called during dealloc. |
1449 if (!browserAccessibility_) | 1451 if (!browserAccessibility_) |
1450 return [super hash]; | 1452 return [super hash]; |
1451 return browserAccessibility_->renderer_id(); | 1453 return browserAccessibility_->renderer_id(); |
1452 } | 1454 } |
1453 | 1455 |
1454 - (BOOL)accessibilityShouldUseUniqueId { | 1456 - (BOOL)accessibilityShouldUseUniqueId { |
1455 return YES; | 1457 return YES; |
1456 } | 1458 } |
1457 | 1459 |
1458 @end | 1460 @end |
1459 | 1461 |
OLD | NEW |