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

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

Issue 880523002: Revert of Send Windows accessibility events based on tree updates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@implicit_1_tests
Patch Set: Created 5 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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 - (NSString*)orientation { 475 - (NSString*)orientation {
476 if (GetState(browserAccessibility_, ui::AX_STATE_VERTICAL)) 476 if (GetState(browserAccessibility_, ui::AX_STATE_VERTICAL))
477 return NSAccessibilityVerticalOrientationValue; 477 return NSAccessibilityVerticalOrientationValue;
478 else if (GetState(browserAccessibility_, ui::AX_STATE_HORIZONTAL)) 478 else if (GetState(browserAccessibility_, ui::AX_STATE_HORIZONTAL))
479 return NSAccessibilityHorizontalOrientationValue; 479 return NSAccessibilityHorizontalOrientationValue;
480 480
481 return @""; 481 return @"";
482 } 482 }
483 483
484 - (NSNumber*)numberOfCharacters { 484 - (NSNumber*)numberOfCharacters {
485 std::string value = browserAccessibility_->GetStringAttribute( 485 return [NSNumber numberWithInt:browserAccessibility_->value().length()];
486 ui::AX_ATTR_VALUE);
487 return [NSNumber numberWithInt:value.size()];
488 } 486 }
489 487
490 // The origin of this accessibility object in the page's document. 488 // The origin of this accessibility object in the page's document.
491 // This is relative to webkit's top-left origin, not Cocoa's 489 // This is relative to webkit's top-left origin, not Cocoa's
492 // bottom-left origin. 490 // bottom-left origin.
493 - (NSPoint)origin { 491 - (NSPoint)origin {
494 gfx::Rect bounds = browserAccessibility_->GetLocalBoundsRect(); 492 gfx::Rect bounds = browserAccessibility_->GetLocalBoundsRect();
495 return NSMakePoint(bounds.x(), bounds.y()); 493 return NSMakePoint(bounds.x(), bounds.y());
496 } 494 }
497 495
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 return NSStringForStringAttribute( 911 return NSStringForStringAttribute(
914 browserAccessibility_, ui::AX_ATTR_VALUE); 912 browserAccessibility_, ui::AX_ATTR_VALUE);
915 } 913 }
916 914
917 - (NSString*)valueDescription { 915 - (NSString*)valueDescription {
918 return NSStringForStringAttribute( 916 return NSStringForStringAttribute(
919 browserAccessibility_, ui::AX_ATTR_VALUE); 917 browserAccessibility_, ui::AX_ATTR_VALUE);
920 } 918 }
921 919
922 - (NSValue*)visibleCharacterRange { 920 - (NSValue*)visibleCharacterRange {
923 std::string value = browserAccessibility_->GetStringAttribute( 921 return [NSValue valueWithRange:
924 ui::AX_ATTR_VALUE); 922 NSMakeRange(0, browserAccessibility_->value().length())];
925 return [NSValue valueWithRange:NSMakeRange(0, value.size())];
926 } 923 }
927 924
928 - (NSArray*)visibleCells { 925 - (NSArray*)visibleCells {
929 NSMutableArray* ret = [[[NSMutableArray alloc] init] autorelease]; 926 NSMutableArray* ret = [[[NSMutableArray alloc] init] autorelease];
930 const std::vector<int32>& uniqueCellIds = 927 const std::vector<int32>& uniqueCellIds =
931 browserAccessibility_->GetIntListAttribute( 928 browserAccessibility_->GetIntListAttribute(
932 ui::AX_ATTR_UNIQUE_CELL_IDS); 929 ui::AX_ATTR_UNIQUE_CELL_IDS);
933 for (size_t i = 0; i < uniqueCellIds.size(); ++i) { 930 for (size_t i = 0; i < uniqueCellIds.size(); ++i) {
934 int id = uniqueCellIds[i]; 931 int id = uniqueCellIds[i];
935 BrowserAccessibility* cell = 932 BrowserAccessibility* cell =
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 // Returns the accessibility value for the given attribute and parameter. If the 1026 // Returns the accessibility value for the given attribute and parameter. If the
1030 // value isn't supported this will return nil. 1027 // value isn't supported this will return nil.
1031 - (id)accessibilityAttributeValue:(NSString*)attribute 1028 - (id)accessibilityAttributeValue:(NSString*)attribute
1032 forParameter:(id)parameter { 1029 forParameter:(id)parameter {
1033 if (!browserAccessibility_) 1030 if (!browserAccessibility_)
1034 return nil; 1031 return nil;
1035 1032
1036 const std::vector<int32>& line_breaks = 1033 const std::vector<int32>& line_breaks =
1037 browserAccessibility_->GetIntListAttribute( 1034 browserAccessibility_->GetIntListAttribute(
1038 ui::AX_ATTR_LINE_BREAKS); 1035 ui::AX_ATTR_LINE_BREAKS);
1039 std::string value = browserAccessibility_->GetStringAttribute( 1036 int len = static_cast<int>(browserAccessibility_->value().size());
1040 ui::AX_ATTR_VALUE);
1041 int len = static_cast<int>(value.size());
1042 1037
1043 if ([attribute isEqualToString: 1038 if ([attribute isEqualToString:
1044 NSAccessibilityStringForRangeParameterizedAttribute]) { 1039 NSAccessibilityStringForRangeParameterizedAttribute]) {
1045 NSRange range = [(NSValue*)parameter rangeValue]; 1040 NSRange range = [(NSValue*)parameter rangeValue];
1046 std::string value = browserAccessibility_->GetStringAttribute( 1041 std::string value = browserAccessibility_->GetStringAttribute(
1047 ui::AX_ATTR_VALUE); 1042 ui::AX_ATTR_VALUE);
1048 return base::SysUTF8ToNSString(value.substr(range.location, range.length)); 1043 return base::SysUTF8ToNSString(value.substr(range.location, range.length));
1049 } 1044 }
1050 1045
1051 if ([attribute isEqualToString: 1046 if ([attribute isEqualToString:
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 if (!browserAccessibility_) 1560 if (!browserAccessibility_)
1566 return [super hash]; 1561 return [super hash];
1567 return browserAccessibility_->GetId(); 1562 return browserAccessibility_->GetId();
1568 } 1563 }
1569 1564
1570 - (BOOL)accessibilityShouldUseUniqueId { 1565 - (BOOL)accessibilityShouldUseUniqueId {
1571 return YES; 1566 return YES;
1572 } 1567 }
1573 1568
1574 @end 1569 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698