| 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 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1165 base::string16 value = browserAccessibility_->GetValue(); | 1165 base::string16 value = browserAccessibility_->GetValue(); |
| 1166 return [NSNumber numberWithUnsignedInt:value.size()]; | 1166 return [NSNumber numberWithUnsignedInt:value.size()]; |
| 1167 } | 1167 } |
| 1168 | 1168 |
| 1169 // The origin of this accessibility object in the page's document. | 1169 // The origin of this accessibility object in the page's document. |
| 1170 // This is relative to webkit's top-left origin, not Cocoa's | 1170 // This is relative to webkit's top-left origin, not Cocoa's |
| 1171 // bottom-left origin. | 1171 // bottom-left origin. |
| 1172 - (NSPoint)origin { | 1172 - (NSPoint)origin { |
| 1173 if (![self instanceActive]) | 1173 if (![self instanceActive]) |
| 1174 return NSMakePoint(0, 0); | 1174 return NSMakePoint(0, 0); |
| 1175 gfx::Rect bounds = browserAccessibility_->GetLocalBoundsRect(); | 1175 gfx::Rect bounds = browserAccessibility_->GetPageBoundsRect(); |
| 1176 return NSMakePoint(bounds.x(), bounds.y()); | 1176 return NSMakePoint(bounds.x(), bounds.y()); |
| 1177 } | 1177 } |
| 1178 | 1178 |
| 1179 - (id)parent { | 1179 - (id)parent { |
| 1180 if (![self instanceActive]) | 1180 if (![self instanceActive]) |
| 1181 return nil; | 1181 return nil; |
| 1182 // A nil parent means we're the root. | 1182 // A nil parent means we're the root. |
| 1183 if (browserAccessibility_->GetParent()) { | 1183 if (browserAccessibility_->GetParent()) { |
| 1184 return NSAccessibilityUnignoredAncestor( | 1184 return NSAccessibilityUnignoredAncestor( |
| 1185 ToBrowserAccessibilityCocoa(browserAccessibility_->GetParent())); | 1185 ToBrowserAccessibilityCocoa(browserAccessibility_->GetParent())); |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1603 manager->GetTreeData().sel_anchor_affinity; | 1603 manager->GetTreeData().sel_anchor_affinity; |
| 1604 ui::AXTextAffinity focusAffinity = manager->GetTreeData().sel_focus_affinity; | 1604 ui::AXTextAffinity focusAffinity = manager->GetTreeData().sel_focus_affinity; |
| 1605 | 1605 |
| 1606 return CreateTextMarkerRange(*anchorObject, anchorOffset, anchorAffinity, | 1606 return CreateTextMarkerRange(*anchorObject, anchorOffset, anchorAffinity, |
| 1607 *focusObject, focusOffset, focusAffinity); | 1607 *focusObject, focusOffset, focusAffinity); |
| 1608 } | 1608 } |
| 1609 | 1609 |
| 1610 - (NSValue*)size { | 1610 - (NSValue*)size { |
| 1611 if (![self instanceActive]) | 1611 if (![self instanceActive]) |
| 1612 return nil; | 1612 return nil; |
| 1613 gfx::Rect bounds = browserAccessibility_->GetLocalBoundsRect(); | 1613 gfx::Rect bounds = browserAccessibility_->GetPageBoundsRect(); |
| 1614 return [NSValue valueWithSize:NSMakeSize(bounds.width(), bounds.height())]; | 1614 return [NSValue valueWithSize:NSMakeSize(bounds.width(), bounds.height())]; |
| 1615 } | 1615 } |
| 1616 | 1616 |
| 1617 - (NSString*)sortDirection { | 1617 - (NSString*)sortDirection { |
| 1618 if (![self instanceActive]) | 1618 if (![self instanceActive]) |
| 1619 return nil; | 1619 return nil; |
| 1620 int sortDirection; | 1620 int sortDirection; |
| 1621 if (!browserAccessibility_->GetIntAttribute( | 1621 if (!browserAccessibility_->GetIntAttribute( |
| 1622 ui::AX_ATTR_SORT_DIRECTION, &sortDirection)) | 1622 ui::AX_ATTR_SORT_DIRECTION, &sortDirection)) |
| 1623 return nil; | 1623 return nil; |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2241 if ([attribute isEqualToString:@"AXLengthForTextMarkerRange"]) { | 2241 if ([attribute isEqualToString:@"AXLengthForTextMarkerRange"]) { |
| 2242 NSString* text = GetTextForTextMarkerRange(parameter); | 2242 NSString* text = GetTextForTextMarkerRange(parameter); |
| 2243 return [NSNumber numberWithInt:[text length]]; | 2243 return [NSNumber numberWithInt:[text length]]; |
| 2244 } | 2244 } |
| 2245 | 2245 |
| 2246 if ([attribute isEqualToString: | 2246 if ([attribute isEqualToString: |
| 2247 NSAccessibilityBoundsForRangeParameterizedAttribute]) { | 2247 NSAccessibilityBoundsForRangeParameterizedAttribute]) { |
| 2248 if ([self internalRole] != ui::AX_ROLE_STATIC_TEXT) | 2248 if ([self internalRole] != ui::AX_ROLE_STATIC_TEXT) |
| 2249 return nil; | 2249 return nil; |
| 2250 NSRange range = [(NSValue*)parameter rangeValue]; | 2250 NSRange range = [(NSValue*)parameter rangeValue]; |
| 2251 gfx::Rect rect = browserAccessibility_->GetGlobalBoundsForRange( | 2251 gfx::Rect rect = browserAccessibility_->GetScreenBoundsForRange( |
| 2252 range.location, range.length); | 2252 range.location, range.length); |
| 2253 NSPoint origin = NSMakePoint(rect.x(), rect.y()); | 2253 NSPoint origin = NSMakePoint(rect.x(), rect.y()); |
| 2254 NSSize size = NSMakeSize(rect.width(), rect.height()); | 2254 NSSize size = NSMakeSize(rect.width(), rect.height()); |
| 2255 NSPoint pointInScreen = [self pointInScreen:origin size:size]; | 2255 NSPoint pointInScreen = [self pointInScreen:origin size:size]; |
| 2256 NSRect nsrect = NSMakeRect( | 2256 NSRect nsrect = NSMakeRect( |
| 2257 pointInScreen.x, pointInScreen.y, rect.width(), rect.height()); | 2257 pointInScreen.x, pointInScreen.y, rect.width(), rect.height()); |
| 2258 return [NSValue valueWithRect:nsrect]; | 2258 return [NSValue valueWithRect:nsrect]; |
| 2259 } | 2259 } |
| 2260 | 2260 |
| 2261 if ([attribute isEqualToString:@"AXUIElementCountForSearchPredicate"]) { | 2261 if ([attribute isEqualToString:@"AXUIElementCountForSearchPredicate"]) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2305 ui::AXTextAffinity startAffinity, endAffinity; | 2305 ui::AXTextAffinity startAffinity, endAffinity; |
| 2306 if (!GetTextMarkerRange(parameter, | 2306 if (!GetTextMarkerRange(parameter, |
| 2307 &startObject, &startOffset, &startAffinity, | 2307 &startObject, &startOffset, &startAffinity, |
| 2308 &endObject, &endOffset, &endAffinity)) { | 2308 &endObject, &endOffset, &endAffinity)) { |
| 2309 return nil; | 2309 return nil; |
| 2310 } | 2310 } |
| 2311 DCHECK(startObject && endObject); | 2311 DCHECK(startObject && endObject); |
| 2312 DCHECK_GE(startOffset, 0); | 2312 DCHECK_GE(startOffset, 0); |
| 2313 DCHECK_GE(endOffset, 0); | 2313 DCHECK_GE(endOffset, 0); |
| 2314 | 2314 |
| 2315 gfx::Rect rect = BrowserAccessibilityManager::GetLocalBoundsForRange( | 2315 gfx::Rect rect = BrowserAccessibilityManager::GetPageBoundsForRange( |
| 2316 *startObject, startOffset, *endObject, endOffset); | 2316 *startObject, startOffset, *endObject, endOffset); |
| 2317 NSPoint origin = NSMakePoint(rect.x(), rect.y()); | 2317 NSPoint origin = NSMakePoint(rect.x(), rect.y()); |
| 2318 NSSize size = NSMakeSize(rect.width(), rect.height()); | 2318 NSSize size = NSMakeSize(rect.width(), rect.height()); |
| 2319 NSPoint pointInScreen = [self pointInScreen:origin size:size]; | 2319 NSPoint pointInScreen = [self pointInScreen:origin size:size]; |
| 2320 NSRect nsrect = NSMakeRect( | 2320 NSRect nsrect = NSMakeRect( |
| 2321 pointInScreen.x, pointInScreen.y, rect.width(), rect.height()); | 2321 pointInScreen.x, pointInScreen.y, rect.width(), rect.height()); |
| 2322 return [NSValue valueWithRect:nsrect]; | 2322 return [NSValue valueWithRect:nsrect]; |
| 2323 } | 2323 } |
| 2324 | 2324 |
| 2325 if ([attribute isEqualToString: | 2325 if ([attribute isEqualToString: |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2851 if (![self instanceActive]) | 2851 if (![self instanceActive]) |
| 2852 return [super hash]; | 2852 return [super hash]; |
| 2853 return browserAccessibility_->GetId(); | 2853 return browserAccessibility_->GetId(); |
| 2854 } | 2854 } |
| 2855 | 2855 |
| 2856 - (BOOL)accessibilityShouldUseUniqueId { | 2856 - (BOOL)accessibilityShouldUseUniqueId { |
| 2857 return YES; | 2857 return YES; |
| 2858 } | 2858 } |
| 2859 | 2859 |
| 2860 @end | 2860 @end |
| OLD | NEW |