OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <QuartzCore/QuartzCore.h> | 5 #include <QuartzCore/QuartzCore.h> |
6 | 6 |
7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
8 | 8 |
9 #include "app/app_switches.h" | 9 #include "app/app_switches.h" |
10 #include "app/surface/io_surface_support_mac.h" | 10 #include "app/surface/io_surface_support_mac.h" |
(...skipping 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1780 } | 1780 } |
1781 | 1781 |
1782 - (NSUInteger)accessibilityArrayAttributeCount:(NSString *)attribute { | 1782 - (NSUInteger)accessibilityArrayAttributeCount:(NSString *)attribute { |
1783 NSArray* fullArray = [self accessibilityAttributeValue:attribute]; | 1783 NSArray* fullArray = [self accessibilityAttributeValue:attribute]; |
1784 return [fullArray count]; | 1784 return [fullArray count]; |
1785 } | 1785 } |
1786 | 1786 |
1787 - (id)accessibilityAttributeValue:(NSString *)attribute { | 1787 - (id)accessibilityAttributeValue:(NSString *)attribute { |
1788 BrowserAccessibilityManager* manager = | 1788 BrowserAccessibilityManager* manager = |
1789 renderWidgetHostView_->browser_accessibility_manager_.get(); | 1789 renderWidgetHostView_->browser_accessibility_manager_.get(); |
1790 if ([attribute isEqualToString:NSAccessibilityChildrenAttribute] && | 1790 |
| 1791 // Contents specifies document view of RenderWidgetHostViewCocoa provided by |
| 1792 // BrowserAccessibilityManager. Children includes all subviews in addition to |
| 1793 // contents. Currently we do not have subviews besides the document view. |
| 1794 if (([attribute isEqualToString:NSAccessibilityChildrenAttribute] || |
| 1795 [attribute isEqualToString:NSAccessibilityContentsAttribute]) && |
1791 manager) { | 1796 manager) { |
1792 return [NSArray arrayWithObjects:manager-> | 1797 return [NSArray arrayWithObjects:manager-> |
1793 GetRoot()->toBrowserAccessibilityCocoa(), nil]; | 1798 GetRoot()->toBrowserAccessibilityCocoa(), nil]; |
1794 } else if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) { | 1799 } else if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) { |
1795 return NSAccessibilityScrollAreaRole; | 1800 return NSAccessibilityScrollAreaRole; |
1796 } | 1801 } |
1797 id ret = [super accessibilityAttributeValue:attribute]; | 1802 id ret = [super accessibilityAttributeValue:attribute]; |
1798 return ret; | 1803 return ret; |
1799 } | 1804 } |
1800 | 1805 |
| 1806 - (NSArray*)accessibilityAttributeNames { |
| 1807 NSMutableArray* ret = [[[NSMutableArray alloc] init] autorelease]; |
| 1808 [ret addObject:NSAccessibilityContentsAttribute]; |
| 1809 [ret addObjectsFromArray:[super accessibilityAttributeNames]]; |
| 1810 return ret; |
| 1811 } |
| 1812 |
1801 - (id)accessibilityHitTest:(NSPoint)point { | 1813 - (id)accessibilityHitTest:(NSPoint)point { |
1802 if (!renderWidgetHostView_->browser_accessibility_manager_.get()) | 1814 if (!renderWidgetHostView_->browser_accessibility_manager_.get()) |
1803 return self; | 1815 return self; |
1804 NSPoint pointInWindow = [[self window] convertScreenToBase:point]; | 1816 NSPoint pointInWindow = [[self window] convertScreenToBase:point]; |
1805 NSPoint localPoint = [self convertPoint:pointInWindow fromView:nil]; | 1817 NSPoint localPoint = [self convertPoint:pointInWindow fromView:nil]; |
1806 localPoint.y = NSHeight([self bounds]) - localPoint.y; | 1818 localPoint.y = NSHeight([self bounds]) - localPoint.y; |
1807 BrowserAccessibilityCocoa* root = renderWidgetHostView_-> | 1819 BrowserAccessibilityCocoa* root = renderWidgetHostView_-> |
1808 browser_accessibility_manager_-> | 1820 browser_accessibility_manager_-> |
1809 GetRoot()->toBrowserAccessibilityCocoa(); | 1821 GetRoot()->toBrowserAccessibilityCocoa(); |
1810 id obj = [root accessibilityHitTest:localPoint]; | 1822 id obj = [root accessibilityHitTest:localPoint]; |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2562 if (!string) return NO; | 2574 if (!string) return NO; |
2563 | 2575 |
2564 // If the user is currently using an IME, confirm the IME input, | 2576 // If the user is currently using an IME, confirm the IME input, |
2565 // and then insert the text from the service, the same as TextEdit and Safari. | 2577 // and then insert the text from the service, the same as TextEdit and Safari. |
2566 [self confirmComposition]; | 2578 [self confirmComposition]; |
2567 [self insertText:string]; | 2579 [self insertText:string]; |
2568 return YES; | 2580 return YES; |
2569 } | 2581 } |
2570 | 2582 |
2571 @end | 2583 @end |
OLD | NEW |