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

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

Issue 11823026: Adding some new DumpAccessibilityTree tests, tweaking DumpAccessibilityTree helpers and fixing a bug (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix valueNow -> currentValue Created 7 years, 11 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 { NSAccessibilityURLAttribute, @"url" }, 292 { NSAccessibilityURLAttribute, @"url" },
293 { NSAccessibilityValueAttribute, @"value" }, 293 { NSAccessibilityValueAttribute, @"value" },
294 { NSAccessibilityValueDescriptionAttribute, @"valueDescription" }, 294 { NSAccessibilityValueDescriptionAttribute, @"valueDescription" },
295 { NSAccessibilityVisibleCharacterRangeAttribute, @"visibleCharacterRange" }, 295 { NSAccessibilityVisibleCharacterRangeAttribute, @"visibleCharacterRange" },
296 { NSAccessibilityWindowAttribute, @"window" }, 296 { NSAccessibilityWindowAttribute, @"window" },
297 { @"AXAccessKey", @"accessKey" }, 297 { @"AXAccessKey", @"accessKey" },
298 { @"AXARIAAtomic", @"ariaAtomic" }, 298 { @"AXARIAAtomic", @"ariaAtomic" },
299 { @"AXARIABusy", @"ariaBusy" }, 299 { @"AXARIABusy", @"ariaBusy" },
300 { @"AXARIALive", @"ariaLive" }, 300 { @"AXARIALive", @"ariaLive" },
301 { @"AXARIARelevant", @"ariaRelevant" }, 301 { @"AXARIARelevant", @"ariaRelevant" },
302 { @"AXInvalid", @"invalid" },
302 { @"AXLoaded", @"loaded" }, 303 { @"AXLoaded", @"loaded" },
303 { @"AXLoadingProgress", @"loadingProgress" }, 304 { @"AXLoadingProgress", @"loadingProgress" },
304 { @"AXRequired", @"required" }, 305 { @"AXRequired", @"required" },
305 { @"AXVisited", @"visited" }, 306 { @"AXVisited", @"visited" },
306 }; 307 };
307 308
308 NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; 309 NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
309 const size_t numAttributes = sizeof(attributeToMethodNameContainer) / 310 const size_t numAttributes = sizeof(attributeToMethodNameContainer) /
310 sizeof(attributeToMethodNameContainer[0]); 311 sizeof(attributeToMethodNameContainer[0]);
311 for (size_t i = 0; i < numAttributes; ++i) { 312 for (size_t i = 0; i < numAttributes; ++i) {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 browserAccessibility_->string_attributes(), 477 browserAccessibility_->string_attributes(),
477 AccessibilityNodeData::ATTR_HELP); 478 AccessibilityNodeData::ATTR_HELP);
478 } 479 }
479 480
480 // Returns whether or not this node should be ignored in the 481 // Returns whether or not this node should be ignored in the
481 // accessibility tree. 482 // accessibility tree.
482 - (BOOL)isIgnored { 483 - (BOOL)isIgnored {
483 return [[self role] isEqualToString:NSAccessibilityUnknownRole]; 484 return [[self role] isEqualToString:NSAccessibilityUnknownRole];
484 } 485 }
485 486
487 - (NSString*)invalid {
488 string16 invalidUTF;
489 if (!browserAccessibility_->GetHtmlAttribute("aria-invalid", &invalidUTF))
490 return NULL;
491 NSString* invalid = base::SysUTF16ToNSString(invalidUTF);
492 if ([invalid isEqualToString:@"false"] ||
493 [invalid isEqualToString:@""]) {
494 return @"false";
495 }
496 return invalid;
497 }
498
486 - (NSNumber*)loaded { 499 - (NSNumber*)loaded {
487 return [NSNumber numberWithBool:YES]; 500 return [NSNumber numberWithBool:YES];
488 } 501 }
489 502
490 - (NSNumber*)loadingProgress { 503 - (NSNumber*)loadingProgress {
491 float floatValue = 0.0; 504 float floatValue = 0.0;
492 browserAccessibility_->GetFloatAttribute( 505 browserAccessibility_->GetFloatAttribute(
493 AccessibilityNodeData::ATTR_DOC_LOADING_PROGRESS, &floatValue); 506 AccessibilityNodeData::ATTR_DOC_LOADING_PROGRESS, &floatValue);
494 return [NSNumber numberWithFloat:floatValue]; 507 return [NSNumber numberWithFloat:floatValue];
495 } 508 }
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 return [super hash]; 1138 return [super hash];
1126 return browserAccessibility_->renderer_id(); 1139 return browserAccessibility_->renderer_id();
1127 } 1140 }
1128 1141
1129 - (BOOL)accessibilityShouldUseUniqueId { 1142 - (BOOL)accessibilityShouldUseUniqueId {
1130 return YES; 1143 return YES;
1131 } 1144 }
1132 1145
1133 @end 1146 @end
1134 1147
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698