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

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

Issue 2430473003: Revert of Create AXAction and AXActionData as a way to simplify accessibility actions (Closed)
Patch Set: Created 4 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 #include <stddef.h> 6 #include <stddef.h>
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #import "content/browser/accessibility/browser_accessibility_cocoa.h" 9 #import "content/browser/accessibility/browser_accessibility_cocoa.h"
10 10
(...skipping 2778 matching lines...) Expand 10 before | Expand all | Expand 10 after
2789 return [self isIgnored]; 2789 return [self isIgnored];
2790 } 2790 }
2791 2791
2792 // Performs the given accessibility action on the webkit accessibility object 2792 // Performs the given accessibility action on the webkit accessibility object
2793 // that backs this object. 2793 // that backs this object.
2794 - (void)accessibilityPerformAction:(NSString*)action { 2794 - (void)accessibilityPerformAction:(NSString*)action {
2795 if (![self instanceActive]) 2795 if (![self instanceActive])
2796 return; 2796 return;
2797 2797
2798 // TODO(dmazzoni): Support more actions. 2798 // TODO(dmazzoni): Support more actions.
2799 BrowserAccessibilityManager* manager = browserAccessibility_->manager();
2800 if ([action isEqualToString:NSAccessibilityPressAction]) { 2799 if ([action isEqualToString:NSAccessibilityPressAction]) {
2801 manager->DoDefaultAction(*browserAccessibility_); 2800 [self delegate]->AccessibilityDoDefaultAction(
2801 browserAccessibility_->GetId());
2802 } else if ([action isEqualToString:NSAccessibilityShowMenuAction]) { 2802 } else if ([action isEqualToString:NSAccessibilityShowMenuAction]) {
2803 manager->ShowContextMenu(*browserAccessibility_); 2803 [self delegate]->AccessibilityShowContextMenu(
2804 browserAccessibility_->GetId());
2804 } else if ([action isEqualToString:NSAccessibilityScrollToVisibleAction]) { 2805 } else if ([action isEqualToString:NSAccessibilityScrollToVisibleAction]) {
2805 manager->ScrollToMakeVisible( 2806 browserAccessibility_->manager()->ScrollToMakeVisible(
2806 *browserAccessibility_, gfx::Rect()); 2807 *browserAccessibility_, gfx::Rect());
2807 } 2808 }
2808 } 2809 }
2809 2810
2810 // Returns the description of the given action. 2811 // Returns the description of the given action.
2811 - (NSString*)accessibilityActionDescription:(NSString*)action { 2812 - (NSString*)accessibilityActionDescription:(NSString*)action {
2812 if (![self instanceActive]) 2813 if (![self instanceActive])
2813 return nil; 2814 return nil;
2814 2815
2815 return NSAccessibilityActionDescription(action); 2816 return NSAccessibilityActionDescription(action);
(...skipping 15 matching lines...) Expand all
2831 2832
2832 if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) { 2833 if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) {
2833 BrowserAccessibilityManager* manager = browserAccessibility_->manager(); 2834 BrowserAccessibilityManager* manager = browserAccessibility_->manager();
2834 NSNumber* focusedNumber = value; 2835 NSNumber* focusedNumber = value;
2835 BOOL focused = [focusedNumber intValue]; 2836 BOOL focused = [focusedNumber intValue];
2836 if (focused) 2837 if (focused)
2837 manager->SetFocus(*browserAccessibility_); 2838 manager->SetFocus(*browserAccessibility_);
2838 } 2839 }
2839 if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute]) { 2840 if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute]) {
2840 NSRange range = [(NSValue*)value rangeValue]; 2841 NSRange range = [(NSValue*)value rangeValue];
2841 BrowserAccessibilityManager* manager = browserAccessibility_->manager(); 2842 [self delegate]->AccessibilitySetSelection(
2842 manager->SetTextSelection( 2843 browserAccessibility_->GetId(), range.location,
2843 *browserAccessibility_, range.location, range.location + range.length); 2844 browserAccessibility_->GetId(), range.location + range.length);
2844 } 2845 }
2845 } 2846 }
2846 2847
2847 // Returns the deepest accessibility child that should not be ignored. 2848 // Returns the deepest accessibility child that should not be ignored.
2848 // It is assumed that the hit test has been narrowed down to this object 2849 // It is assumed that the hit test has been narrowed down to this object
2849 // or one of its children, so this will never return nil unless this 2850 // or one of its children, so this will never return nil unless this
2850 // object is invalid. 2851 // object is invalid.
2851 - (id)accessibilityHitTest:(NSPoint)point { 2852 - (id)accessibilityHitTest:(NSPoint)point {
2852 if (![self instanceActive]) 2853 if (![self instanceActive])
2853 return nil; 2854 return nil;
(...skipping 23 matching lines...) Expand all
2877 } 2878 }
2878 2879
2879 - (BOOL)accessibilityNotifiesWhenDestroyed { 2880 - (BOOL)accessibilityNotifiesWhenDestroyed {
2880 // Indicate that BrowserAccessibilityCocoa will post a notification when it's 2881 // Indicate that BrowserAccessibilityCocoa will post a notification when it's
2881 // destroyed (see -detach). This allows VoiceOver to do some internal things 2882 // destroyed (see -detach). This allows VoiceOver to do some internal things
2882 // more efficiently. 2883 // more efficiently.
2883 return YES; 2884 return YES;
2884 } 2885 }
2885 2886
2886 @end 2887 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698