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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
346 | 346 |
347 - (NSString*)ariaRelevant { | 347 - (NSString*)ariaRelevant { |
348 return NSStringForStringAttribute( | 348 return NSStringForStringAttribute( |
349 browserAccessibility_, AccessibilityNodeData::ATTR_LIVE_RELEVANT); | 349 browserAccessibility_, AccessibilityNodeData::ATTR_LIVE_RELEVANT); |
350 } | 350 } |
351 | 351 |
352 // Returns an array of BrowserAccessibilityCocoa objects, representing the | 352 // Returns an array of BrowserAccessibilityCocoa objects, representing the |
353 // accessibility children of this object. | 353 // accessibility children of this object. |
354 - (NSArray*)children { | 354 - (NSArray*)children { |
355 if (!children_) { | 355 if (!children_) { |
356 children_.reset([[NSMutableArray alloc] | 356 uint32 childCount = browserAccessibility_->child_count(); |
357 initWithCapacity:browserAccessibility_->child_count()] ); | 357 if (browserAccessibility_->IsLeaf()) |
358 for (uint32 index = 0; | 358 childCount = 0; |
aboxhall
2013/10/23 16:15:21
Extra-trivial nit: how about
uint32 childCount = 0
| |
359 index < browserAccessibility_->child_count(); | 359 children_.reset([[NSMutableArray alloc] initWithCapacity:childCount]); |
360 ++index) { | 360 for (uint32 index = 0; index < childCount; ++index) { |
361 BrowserAccessibilityCocoa* child = | 361 BrowserAccessibilityCocoa* child = |
362 browserAccessibility_->GetChild(index)->ToBrowserAccessibilityCocoa(); | 362 browserAccessibility_->GetChild(index)->ToBrowserAccessibilityCocoa(); |
363 if ([child isIgnored]) | 363 if ([child isIgnored]) |
364 [children_ addObjectsFromArray:[child children]]; | 364 [children_ addObjectsFromArray:[child children]]; |
365 else | 365 else |
366 [children_ addObject:child]; | 366 [children_ addObject:child]; |
367 } | 367 } |
368 | 368 |
369 // Also, add indirect children (if any). | 369 // Also, add indirect children (if any). |
370 const std::vector<int32>& indirectChildIds = | 370 const std::vector<int32>& indirectChildIds = |
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1451 return [super hash]; | 1451 return [super hash]; |
1452 return browserAccessibility_->renderer_id(); | 1452 return browserAccessibility_->renderer_id(); |
1453 } | 1453 } |
1454 | 1454 |
1455 - (BOOL)accessibilityShouldUseUniqueId { | 1455 - (BOOL)accessibilityShouldUseUniqueId { |
1456 return YES; | 1456 return YES; |
1457 } | 1457 } |
1458 | 1458 |
1459 @end | 1459 @end |
1460 | 1460 |
OLD | NEW |