OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/accessibility/browser_accessibility_cocoa.h" | 7 #import "chrome/browser/accessibility/browser_accessibility_cocoa.h" |
8 | 8 |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 // Returns whether or not this node should be ignored in the | 120 // Returns whether or not this node should be ignored in the |
121 // accessibility tree. | 121 // accessibility tree. |
122 - (BOOL)isIgnored { | 122 - (BOOL)isIgnored { |
123 return [self role] == NSAccessibilityUnknownRole; | 123 return [self role] == NSAccessibilityUnknownRole; |
124 } | 124 } |
125 | 125 |
126 // The origin of this accessibility object in the page's document. | 126 // The origin of this accessibility object in the page's document. |
127 // This is relative to webkit's top-left origin, not Cocoa's | 127 // This is relative to webkit's top-left origin, not Cocoa's |
128 // bottom-left origin. | 128 // bottom-left origin. |
129 - (NSPoint)origin { | 129 - (NSPoint)origin { |
130 return NSMakePoint(browserAccessibility_->location().x, | 130 return NSMakePoint(browserAccessibility_->location().x(), |
Tom Sepez
2011/03/23 17:32:53
Maybe change gfx::rect to make the underlying memb
jam
2011/03/23 18:21:02
We couldn't do that since that would go against th
| |
131 browserAccessibility_->location().y); | 131 browserAccessibility_->location().y()); |
132 } | 132 } |
133 | 133 |
134 // Returns a string indicating the role of this object. | 134 // Returns a string indicating the role of this object. |
135 - (NSString*)role { | 135 - (NSString*)role { |
136 WebAccessibility::Role value = | 136 WebAccessibility::Role value = |
137 static_cast<WebAccessibility::Role>( browserAccessibility_->role()); | 137 static_cast<WebAccessibility::Role>( browserAccessibility_->role()); |
138 | 138 |
139 // Roles that we only determine at runtime. | 139 // Roles that we only determine at runtime. |
140 if (value == WebAccessibility::ROLE_TEXT_FIELD && | 140 if (value == WebAccessibility::ROLE_TEXT_FIELD && |
141 GetState(browserAccessibility_, WebAccessibility::STATE_PROTECTED)) { | 141 GetState(browserAccessibility_, WebAccessibility::STATE_PROTECTED)) { |
(...skipping 22 matching lines...) Expand all Loading... | |
164 return l10n_util::GetNSString(IDS_AX_ROLE_LINK); | 164 return l10n_util::GetNSString(IDS_AX_ROLE_LINK); |
165 | 165 |
166 if ([[self role] isEqualToString:@"AXHeading"]) | 166 if ([[self role] isEqualToString:@"AXHeading"]) |
167 return l10n_util::GetNSString(IDS_AX_ROLE_HEADING); | 167 return l10n_util::GetNSString(IDS_AX_ROLE_HEADING); |
168 | 168 |
169 return NSAccessibilityRoleDescription([self role], nil); | 169 return NSAccessibilityRoleDescription([self role], nil); |
170 } | 170 } |
171 | 171 |
172 // Returns the size of this object. | 172 // Returns the size of this object. |
173 - (NSSize)size { | 173 - (NSSize)size { |
174 return NSMakeSize(browserAccessibility_->location().width, | 174 return NSMakeSize(browserAccessibility_->location().width(), |
175 browserAccessibility_->location().height); | 175 browserAccessibility_->location().height()); |
176 } | 176 } |
177 | 177 |
178 // Returns the accessibility value for the given attribute. If the value isn't | 178 // Returns the accessibility value for the given attribute. If the value isn't |
179 // supported this will return nil. | 179 // supported this will return nil. |
180 - (id)accessibilityAttributeValue:(NSString*)attribute { | 180 - (id)accessibilityAttributeValue:(NSString*)attribute { |
181 if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) { | 181 if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) { |
182 return [self role]; | 182 return [self role]; |
183 } | 183 } |
184 if ([attribute isEqualToString:NSAccessibilityDescriptionAttribute]) { | 184 if ([attribute isEqualToString:NSAccessibilityDescriptionAttribute]) { |
185 return NSStringForWebAccessibilityAttribute( | 185 return NSStringForWebAccessibilityAttribute( |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
486 | 486 |
487 - (NSUInteger)hash { | 487 - (NSUInteger)hash { |
488 // Potentially called during dealloc. | 488 // Potentially called during dealloc. |
489 if (!browserAccessibility_) | 489 if (!browserAccessibility_) |
490 return [super hash]; | 490 return [super hash]; |
491 return browserAccessibility_->renderer_id(); | 491 return browserAccessibility_->renderer_id(); |
492 } | 492 } |
493 | 493 |
494 @end | 494 @end |
495 | 495 |
OLD | NEW |