Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: content/browser/accessibility/browser_accessibility_cocoa.mm

Issue 1413423003: Move some AX attrs from AXNodeData to AXTreeData. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 if ([ret count] == 0) 761 if ([ret count] == 0)
762 return nil; 762 return nil;
763 return ret; 763 return ret;
764 } 764 }
765 765
766 - (NSNumber*)loaded { 766 - (NSNumber*)loaded {
767 return [NSNumber numberWithBool:YES]; 767 return [NSNumber numberWithBool:YES];
768 } 768 }
769 769
770 - (NSNumber*)loadingProgress { 770 - (NSNumber*)loadingProgress {
771 float floatValue = browserAccessibility_->GetFloatAttribute( 771 BrowserAccessibilityManager* manager = browserAccessibility_->manager();
772 ui::AX_ATTR_DOC_LOADING_PROGRESS); 772 float floatValue = manager->GetTreeData().loading_progress;
773 return [NSNumber numberWithFloat:floatValue]; 773 return [NSNumber numberWithFloat:floatValue];
774 } 774 }
775 775
776 - (NSNumber*)maxValue { 776 - (NSNumber*)maxValue {
777 float floatValue = browserAccessibility_->GetFloatAttribute( 777 float floatValue = browserAccessibility_->GetFloatAttribute(
778 ui::AX_ATTR_MAX_VALUE_FOR_RANGE); 778 ui::AX_ATTR_MAX_VALUE_FOR_RANGE);
779 return [NSNumber numberWithFloat:floatValue]; 779 return [NSNumber numberWithFloat:floatValue];
780 } 780 }
781 781
782 - (NSNumber*)minValue { 782 - (NSNumber*)minValue {
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 BrowserAccessibility* titleElement = 1198 BrowserAccessibility* titleElement =
1199 browserAccessibility_->manager()->GetFromID(labelledby_ids[0]); 1199 browserAccessibility_->manager()->GetFromID(labelledby_ids[0]);
1200 if (titleElement) 1200 if (titleElement)
1201 return titleElement->ToBrowserAccessibilityCocoa(); 1201 return titleElement->ToBrowserAccessibilityCocoa();
1202 } 1202 }
1203 1203
1204 return nil; 1204 return nil;
1205 } 1205 }
1206 1206
1207 - (NSURL*)url { 1207 - (NSURL*)url {
1208 StringAttribute urlAttribute = 1208 std::string url;
1209 [[self role] isEqualToString:@"AXWebArea"] ? 1209 if ([[self role] isEqualToString:@"AXWebArea"])
1210 ui::AX_ATTR_DOC_URL : 1210 url = browserAccessibility_->manager()->GetTreeData().url;
1211 ui::AX_ATTR_URL; 1211 else
1212 url = browserAccessibility_->GetStringAttribute(ui::AX_ATTR_URL);
1212 1213
1213 std::string urlStr = browserAccessibility_->GetStringAttribute(urlAttribute); 1214 if (url.empty())
1214 if (urlStr.empty())
1215 return nil; 1215 return nil;
1216 1216
1217 return [NSURL URLWithString:(base::SysUTF8ToNSString(urlStr))]; 1217 return [NSURL URLWithString:(base::SysUTF8ToNSString(url))];
1218 } 1218 }
1219 1219
1220 - (id)value { 1220 - (id)value {
1221 // WebCore uses an attachmentView to get the below behavior. 1221 // WebCore uses an attachmentView to get the below behavior.
1222 // We do not have any native views backing this object, so need 1222 // We do not have any native views backing this object, so need
1223 // to approximate Cocoa ax behavior best as we can. 1223 // to approximate Cocoa ax behavior best as we can.
1224 NSString* role = [self role]; 1224 NSString* role = [self role];
1225 if ([role isEqualToString:@"AXHeading"]) { 1225 if ([role isEqualToString:@"AXHeading"]) {
1226 int level = 0; 1226 int level = 0;
1227 if (browserAccessibility_->GetIntAttribute( 1227 if (browserAccessibility_->GetIntAttribute(
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 if (!browserAccessibility_) 1985 if (!browserAccessibility_)
1986 return [super hash]; 1986 return [super hash];
1987 return browserAccessibility_->GetId(); 1987 return browserAccessibility_->GetId();
1988 } 1988 }
1989 1989
1990 - (BOOL)accessibilityShouldUseUniqueId { 1990 - (BOOL)accessibilityShouldUseUniqueId {
1991 return YES; 1991 return YES;
1992 } 1992 }
1993 1993
1994 @end 1994 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698