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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 95113004: [Mac] Don't ignore mouse events outside of the view while dragging. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improved comments and TEST= Created 7 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/renderer_host/render_widget_host_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 #include <QuartzCore/QuartzCore.h> 8 #include <QuartzCore/QuartzCore.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 2080 matching lines...) Expand 10 before | Expand all | Expand 10 after
2091 NSView* view = [contentView hitTest:[theEvent locationInWindow]]; 2091 NSView* view = [contentView hitTest:[theEvent locationInWindow]];
2092 // Traverse the superview hierarchy as the hitTest will return the frontmost 2092 // Traverse the superview hierarchy as the hitTest will return the frontmost
2093 // view, such as an NSTextView, while nonWebContentView may be specified by 2093 // view, such as an NSTextView, while nonWebContentView may be specified by
2094 // its parent view. 2094 // its parent view.
2095 while (view) { 2095 while (view) {
2096 if ([view respondsToSelector:nonWebContentViewSelector] && 2096 if ([view respondsToSelector:nonWebContentViewSelector] &&
2097 [view performSelector:nonWebContentViewSelector]) { 2097 [view performSelector:nonWebContentViewSelector]) {
2098 // The cursor is over a nonWebContentView - ignore this mouse event. 2098 // The cursor is over a nonWebContentView - ignore this mouse event.
2099 return YES; 2099 return YES;
2100 } 2100 }
2101 if ([view isKindOfClass:[self class]] && ![view isEqual:self]) { 2101 if ([view isKindOfClass:[self class]] && ![view isEqual:self] &&
2102 !hasOpenMouseDown_) {
2102 // The cursor is over an overlapping render widget. This check is done by 2103 // The cursor is over an overlapping render widget. This check is done by
2103 // both views so the one that's returned by -hitTest: will end up 2104 // both views so the one that's returned by -hitTest: will end up
2104 // processing the event. 2105 // processing the event.
2106 // Note that while dragging, we only get events for the render view where
2107 // drag started, even if mouse is actually over another view or outside
2108 // the window. Cocoa does this for us. We should handle these events and
2109 // not ignore (since there is no other render view to handle them). Thus
2110 // the |!hasOpenMouseDown_| check above.
2105 return YES; 2111 return YES;
2106 } 2112 }
2107 view = [view superview]; 2113 view = [view superview];
2108 } 2114 }
2109 return NO; 2115 return NO;
2110 } 2116 }
2111 2117
2112 - (void)mouseEvent:(NSEvent*)theEvent { 2118 - (void)mouseEvent:(NSEvent*)theEvent {
2113 TRACE_EVENT0("browser", "RenderWidgetHostViewCocoa::mouseEvent"); 2119 TRACE_EVENT0("browser", "RenderWidgetHostViewCocoa::mouseEvent");
2114 if (delegate_ && [delegate_ respondsToSelector:@selector(handleEvent:)]) { 2120 if (delegate_ && [delegate_ respondsToSelector:@selector(handleEvent:)]) {
(...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after
3925 return YES; 3931 return YES;
3926 } 3932 }
3927 3933
3928 - (BOOL)isOpaque { 3934 - (BOOL)isOpaque {
3929 if (renderWidgetHostView_->use_core_animation_) 3935 if (renderWidgetHostView_->use_core_animation_)
3930 return YES; 3936 return YES;
3931 return [super isOpaque]; 3937 return [super isOpaque];
3932 } 3938 }
3933 3939
3934 @end 3940 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698