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

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 79160)
+++ chrome/browser/renderer_host/render_widget_host_view_mac.mm (working copy)
@@ -1420,6 +1420,7 @@
takesFocusOnlyOnMouseDown_ = NO;
closeOnDeactivate_ = NO;
focusedPluginIdentifier_ = -1;
+ mouseEventWasIgnored_ = NO;
Mark Mentovai 2011/03/24 18:44:40 Is NO really the right thing to initialize this to
Alexei Svitkine (slow) 2011/03/24 19:04:56 Done.
}
return self;
}
@@ -1437,6 +1438,36 @@
}
- (void)mouseEvent:(NSEvent*)theEvent {
+ // Use hitTest to check whether we're the frontmost view for this mouse
Mark Mentovai 2011/03/24 18:44:40 s/we're/this is/
Alexei Svitkine (slow) 2011/03/24 19:04:56 Done.
+ // location. If this is not the frontmost view, don't handle the event
+ // here - let the frontmost view handle it.
+ NSView* contentView = [[self window] contentView];
+ if ([contentView hitTest:[theEvent locationInWindow]] != self) {
+ // 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;
+ }
+
+ // If the previous event was ignored as a result of the hitTest, send a mouse
+ // event to the host view.
+ if (mouseEventWasIgnored_) {
+ 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_)

Powered by Google App Engine
This is Rietveld 408576698