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

Side by Side Diff: ui/views/cocoa/bridged_native_widget.mm

Issue 976403004: MacViews: Fix accessibility hit tests, provide AXTitle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20150303-MacViews-Disable-Touch-Tests
Patch Set: Created 5 years, 9 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/views/cocoa/bridged_native_widget.h" 5 #import "ui/views/cocoa/bridged_native_widget.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 10 matching lines...) Expand all
21 #import "ui/views/cocoa/bridged_content_view.h" 21 #import "ui/views/cocoa/bridged_content_view.h"
22 #import "ui/views/cocoa/views_nswindow_delegate.h" 22 #import "ui/views/cocoa/views_nswindow_delegate.h"
23 #include "ui/views/widget/native_widget_mac.h" 23 #include "ui/views/widget/native_widget_mac.h"
24 #include "ui/views/ime/input_method_bridge.h" 24 #include "ui/views/ime/input_method_bridge.h"
25 #include "ui/views/ime/null_input_method.h" 25 #include "ui/views/ime/null_input_method.h"
26 #include "ui/views/view.h" 26 #include "ui/views/view.h"
27 #include "ui/views/views_delegate.h" 27 #include "ui/views/views_delegate.h"
28 #include "ui/views/widget/widget.h" 28 #include "ui/views/widget/widget.h"
29 #include "ui/views/widget/widget_aura_utils.h" 29 #include "ui/views/widget/widget_aura_utils.h"
30 30
31 // The NSView that hosts the composited CALayer drawing the UI. It fills the
32 // window but is not hittable so that accessibility hit tests always go to the
33 // BridgedContentView.
34 @interface ViewsCompositorSuperview : NSView
35 @end
36
37 @implementation ViewsCompositorSuperview
38 - (NSView*)hitTest:(NSPoint)aPoint {
39 return nil;
40 }
41 @end
42
31 namespace { 43 namespace {
32 44
33 int kWindowPropertiesKey; 45 int kWindowPropertiesKey;
34 46
35 float GetDeviceScaleFactorFromView(NSView* view) { 47 float GetDeviceScaleFactorFromView(NSView* view) {
36 gfx::Display display = 48 gfx::Display display =
37 gfx::Screen::GetScreenFor(view)->GetDisplayNearestWindow(view); 49 gfx::Screen::GetScreenFor(view)->GetDisplayNearestWindow(view);
38 DCHECK(display.is_valid()); 50 DCHECK(display.is_valid());
39 return display.device_scale_factor(); 51 return display.device_scale_factor();
40 } 52 }
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 return; 704 return;
693 } 705 }
694 compositor_widget_->ResetNSView(); 706 compositor_widget_->ResetNSView();
695 compositor_.reset(); 707 compositor_.reset();
696 compositor_widget_.reset(); 708 compositor_widget_.reset();
697 } 709 }
698 710
699 void BridgedNativeWidget::AddCompositorSuperview() { 711 void BridgedNativeWidget::AddCompositorSuperview() {
700 DCHECK(!compositor_superview_); 712 DCHECK(!compositor_superview_);
701 compositor_superview_.reset( 713 compositor_superview_.reset(
702 [[NSView alloc] initWithFrame:[bridged_view_ bounds]]); 714 [[ViewsCompositorSuperview alloc] initWithFrame:[bridged_view_ bounds]]);
703 715
704 // Size and resize automatically with |bridged_view_|. 716 // Size and resize automatically with |bridged_view_|.
705 [compositor_superview_ 717 [compositor_superview_
706 setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; 718 setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
707 719
708 // Enable HiDPI backing when supported (only on 10.7+). 720 // Enable HiDPI backing when supported (only on 10.7+).
709 if ([compositor_superview_ respondsToSelector: 721 if ([compositor_superview_ respondsToSelector:
710 @selector(setWantsBestResolutionOpenGLSurface:)]) { 722 @selector(setWantsBestResolutionOpenGLSurface:)]) {
711 [compositor_superview_ setWantsBestResolutionOpenGLSurface:YES]; 723 [compositor_superview_ setWantsBestResolutionOpenGLSurface:YES];
712 } 724 }
(...skipping 28 matching lines...) Expand all
741 window_, &kWindowPropertiesKey); 753 window_, &kWindowPropertiesKey);
742 if (!properties) { 754 if (!properties) {
743 properties = [NSMutableDictionary dictionary]; 755 properties = [NSMutableDictionary dictionary];
744 objc_setAssociatedObject(window_, &kWindowPropertiesKey, 756 objc_setAssociatedObject(window_, &kWindowPropertiesKey,
745 properties, OBJC_ASSOCIATION_RETAIN); 757 properties, OBJC_ASSOCIATION_RETAIN);
746 } 758 }
747 return properties; 759 return properties;
748 } 760 }
749 761
750 } // namespace views 762 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698