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

Unified Diff: chrome/browser/renderer_host/render_widget_host_view_mac.mm

Issue 6676094: Fix for "Mouseovers follow the cursor even when there's a find bar in the way" (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_host/render_widget_host_view_mac.mm
===================================================================
--- chrome/browser/renderer_host/render_widget_host_view_mac.mm (revision 79311)
+++ chrome/browser/renderer_host/render_widget_host_view_mac.mm (working copy)
@@ -1417,8 +1417,6 @@
renderWidgetHostView_.reset(r);
canBeKeyView_ = YES;
- takesFocusOnlyOnMouseDown_ = NO;
- closeOnDeactivate_ = NO;
focusedPluginIdentifier_ = -1;
}
return self;
@@ -1437,6 +1435,47 @@
}
- (void)mouseEvent:(NSEvent*)theEvent {
+ // Use hitTest to check whether the mouse is over a nonWebContentView - in
+ // which case the mouse event should not be handled by the render host.
+ const SEL nonWebContentViewSelector = @selector(nonWebContentView);
+ NSView* contentView = [[self window] contentView];
+ NSView* view = [contentView hitTest:[theEvent locationInWindow]];
+ // Traverse the superview hierarchy as the hitTest will return the frontmost
+ // view, such as an NSTextView, while nonWebContentView may be specified by
+ // its parent view.
+ while (view) {
+ if ([view respondsToSelector:nonWebContentViewSelector] &&
+ [view performSelector:nonWebContentViewSelector]) {
+ // The cursor is over a nonWebContentView - ignore this mouse event.
+ // If this is the first such event, send a mouse exit to the host view.
+ if (!mouseEventWasIgnored_ &&
+ renderWidgetHostView_->render_widget_host_) {
+ WebMouseEvent exitEvent =
+ WebInputEventFactory::mouseEvent(theEvent, self);
+ exitEvent.type = WebInputEvent::MouseLeave;
+ exitEvent.button = WebMouseEvent::ButtonNone;
+ renderWidgetHostView_->render_widget_host_->ForwardMouseEvent(
+ exitEvent);
+ }
+ mouseEventWasIgnored_ = YES;
+ return;
+ }
+ view = [view superview];
+ }
+
+ if (mouseEventWasIgnored_) {
+ // If this is the first mouse event after a previous event that was ignored
+ // due to the hitTest, send a mouse enter event to the host view.
+ if (renderWidgetHostView_->render_widget_host_) {
+ WebMouseEvent enterEvent =
+ WebInputEventFactory::mouseEvent(theEvent, self);
+ enterEvent.type = WebInputEvent::MouseMove;
+ enterEvent.button = WebMouseEvent::ButtonNone;
+ renderWidgetHostView_->render_widget_host_->ForwardMouseEvent(enterEvent);
+ }
+ }
+ mouseEventWasIgnored_ = NO;
+
// TODO(rohitrao): Probably need to handle other mouse down events here.
if ([theEvent type] == NSLeftMouseDown && takesFocusOnlyOnMouseDown_) {
if (renderWidgetHostView_->render_widget_host_)
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_mac.h ('k') | chrome/browser/ui/cocoa/find_bar/find_bar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698