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

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

Issue 2692173003: Implemented SetSelection for the Web content on Windows. (Closed)
Patch Set: Created 3 years, 10 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 #import "content/browser/accessibility/browser_accessibility_cocoa.h" 5 #import "content/browser/accessibility/browser_accessibility_cocoa.h"
6 6
7 #include <execinfo.h> 7 #include <execinfo.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 } 952 }
953 953
954 // Returns a text marker that points to the last character in the document that 954 // Returns a text marker that points to the last character in the document that
955 // can be selected with VoiceOver. 955 // can be selected with VoiceOver.
956 - (id)endTextMarker { 956 - (id)endTextMarker {
957 const BrowserAccessibility* root = 957 const BrowserAccessibility* root =
958 browserAccessibility_->manager()->GetRoot(); 958 browserAccessibility_->manager()->GetRoot();
959 if (!root) 959 if (!root)
960 return nil; 960 return nil;
961 961
962 AXPlatformPositionInstance position = 962 AXPlatformPositionInstance position = root->CreatePositionAt(0);
963 CreateTextPosition(*root, 0, ui::AX_TEXT_AFFINITY_DOWNSTREAM);
964 return CreateTextMarker(position->CreatePositionAtEndOfAnchor()); 963 return CreateTextMarker(position->CreatePositionAtEndOfAnchor());
965 } 964 }
966 965
967 - (NSNumber*)expanded { 966 - (NSNumber*)expanded {
968 if (![self instanceActive]) 967 if (![self instanceActive])
969 return nil; 968 return nil;
970 return [NSNumber numberWithBool: 969 return [NSNumber numberWithBool:
971 GetState(browserAccessibility_, ui::AX_STATE_EXPANDED)]; 970 GetState(browserAccessibility_, ui::AX_STATE_EXPANDED)];
972 } 971 }
973 972
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 } 1711 }
1713 1712
1714 // Returns a text marker that points to the first character in the document that 1713 // Returns a text marker that points to the first character in the document that
1715 // can be selected with VoiceOver. 1714 // can be selected with VoiceOver.
1716 - (id)startTextMarker { 1715 - (id)startTextMarker {
1717 const BrowserAccessibility* root = 1716 const BrowserAccessibility* root =
1718 browserAccessibility_->manager()->GetRoot(); 1717 browserAccessibility_->manager()->GetRoot();
1719 if (!root) 1718 if (!root)
1720 return nil; 1719 return nil;
1721 1720
1722 AXPlatformPositionInstance position = 1721 AXPlatformPositionInstance position = root->CreatePositionAt(0);
1723 CreateTextPosition(*root, 0, ui::AX_TEXT_AFFINITY_DOWNSTREAM);
1724 return CreateTextMarker(position->CreatePositionAtStartOfAnchor()); 1722 return CreateTextMarker(position->CreatePositionAtStartOfAnchor());
1725 } 1723 }
1726 1724
1727 // Returns a subrole based upon the role. 1725 // Returns a subrole based upon the role.
1728 - (NSString*) subrole { 1726 - (NSString*) subrole {
1729 if (![self instanceActive]) 1727 if (![self instanceActive])
1730 return nil; 1728 return nil;
1731 ui::AXRole browserAccessibilityRole = [self internalRole]; 1729 ui::AXRole browserAccessibilityRole = [self internalRole];
1732 if (browserAccessibilityRole == ui::AX_ROLE_TEXT_FIELD && 1730 if (browserAccessibilityRole == ui::AX_ROLE_TEXT_FIELD &&
1733 GetState(browserAccessibility_, ui::AX_STATE_PROTECTED)) { 1731 GetState(browserAccessibility_, ui::AX_STATE_PROTECTED)) {
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
2121 if ([attribute isEqualToString:@"AXUIElementForTextMarker"]) { 2119 if ([attribute isEqualToString:@"AXUIElementForTextMarker"]) {
2122 AXPlatformPositionInstance position = 2120 AXPlatformPositionInstance position =
2123 CreatePositionFromTextMarker(parameter); 2121 CreatePositionFromTextMarker(parameter);
2124 if (!position->IsNullPosition()) 2122 if (!position->IsNullPosition())
2125 return ToBrowserAccessibilityCocoa(position->GetAnchor()); 2123 return ToBrowserAccessibilityCocoa(position->GetAnchor());
2126 2124
2127 return nil; 2125 return nil;
2128 } 2126 }
2129 2127
2130 if ([attribute isEqualToString:@"AXTextMarkerRangeForUIElement"]) { 2128 if ([attribute isEqualToString:@"AXTextMarkerRangeForUIElement"]) {
2131 AXPlatformPositionInstance startPosition = CreateTextPosition( 2129 AXPlatformPositionInstance startPosition =
2132 *browserAccessibility_, 0, ui::AX_TEXT_AFFINITY_DOWNSTREAM); 2130 browser_accessibility_->CreatePositionAt(0);
2133 AXPlatformPositionInstance endPosition = 2131 AXPlatformPositionInstance endPosition =
2134 startPosition->CreatePositionAtEndOfAnchor(); 2132 startPosition->CreatePositionAtEndOfAnchor();
2135 AXPlatformRange range = 2133 AXPlatformRange range =
2136 AXPlatformRange(std::move(startPosition), std::move(endPosition)); 2134 AXPlatformRange(std::move(startPosition), std::move(endPosition));
2137 return CreateTextMarkerRange(std::move(range)); 2135 return CreateTextMarkerRange(std::move(range));
2138 } 2136 }
2139 2137
2140 if ([attribute isEqualToString:@"AXStringForTextMarkerRange"]) 2138 if ([attribute isEqualToString:@"AXStringForTextMarkerRange"])
2141 return GetTextForTextMarkerRange(parameter); 2139 return GetTextForTextMarkerRange(parameter);
2142 2140
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
2817 } 2815 }
2818 2816
2819 - (BOOL)accessibilityNotifiesWhenDestroyed { 2817 - (BOOL)accessibilityNotifiesWhenDestroyed {
2820 // Indicate that BrowserAccessibilityCocoa will post a notification when it's 2818 // Indicate that BrowserAccessibilityCocoa will post a notification when it's
2821 // destroyed (see -detach). This allows VoiceOver to do some internal things 2819 // destroyed (see -detach). This allows VoiceOver to do some internal things
2822 // more efficiently. 2820 // more efficiently.
2823 return YES; 2821 return YES;
2824 } 2822 }
2825 2823
2826 @end 2824 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698