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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/surface/io_surface_support_mac.h" 9 #include "app/surface/io_surface_support_mac.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 self = [super initWithFrame:NSZeroRect]; 1413 self = [super initWithFrame:NSZeroRect];
1414 if (self) { 1414 if (self) {
1415 editCommand_helper_.reset(new RWHVMEditCommandHelper); 1415 editCommand_helper_.reset(new RWHVMEditCommandHelper);
1416 editCommand_helper_->AddEditingSelectorsToClass([self class]); 1416 editCommand_helper_->AddEditingSelectorsToClass([self class]);
1417 1417
1418 renderWidgetHostView_.reset(r); 1418 renderWidgetHostView_.reset(r);
1419 canBeKeyView_ = YES; 1419 canBeKeyView_ = YES;
1420 takesFocusOnlyOnMouseDown_ = NO; 1420 takesFocusOnlyOnMouseDown_ = NO;
1421 closeOnDeactivate_ = NO; 1421 closeOnDeactivate_ = NO;
1422 focusedPluginIdentifier_ = -1; 1422 focusedPluginIdentifier_ = -1;
1423 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.
1423 } 1424 }
1424 return self; 1425 return self;
1425 } 1426 }
1426 1427
1427 - (void)setCanBeKeyView:(BOOL)can { 1428 - (void)setCanBeKeyView:(BOOL)can {
1428 canBeKeyView_ = can; 1429 canBeKeyView_ = can;
1429 } 1430 }
1430 1431
1431 - (void)setTakesFocusOnlyOnMouseDown:(BOOL)b { 1432 - (void)setTakesFocusOnlyOnMouseDown:(BOOL)b {
1432 takesFocusOnlyOnMouseDown_ = b; 1433 takesFocusOnlyOnMouseDown_ = b;
1433 } 1434 }
1434 1435
1435 - (void)setCloseOnDeactivate:(BOOL)b { 1436 - (void)setCloseOnDeactivate:(BOOL)b {
1436 closeOnDeactivate_ = b; 1437 closeOnDeactivate_ = b;
1437 } 1438 }
1438 1439
1439 - (void)mouseEvent:(NSEvent*)theEvent { 1440 - (void)mouseEvent:(NSEvent*)theEvent {
1441 // 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.
1442 // location. If this is not the frontmost view, don't handle the event
1443 // here - let the frontmost view handle it.
1444 NSView* contentView = [[self window] contentView];
1445 if ([contentView hitTest:[theEvent locationInWindow]] != self) {
1446 // If this is the first such event, send a mouse exit to the host view.
1447 if (!mouseEventWasIgnored_ && renderWidgetHostView_->render_widget_host_) {
1448 WebMouseEvent exitEvent =
1449 WebInputEventFactory::mouseEvent(theEvent, self);
1450 exitEvent.type = WebInputEvent::MouseLeave;
1451 exitEvent.button = WebMouseEvent::ButtonNone;
1452 renderWidgetHostView_->render_widget_host_->ForwardMouseEvent(exitEvent);
1453 }
1454 mouseEventWasIgnored_ = YES;
1455 return;
1456 }
1457
1458 // If the previous event was ignored as a result of the hitTest, send a mouse
1459 // event to the host view.
1460 if (mouseEventWasIgnored_) {
1461 if (renderWidgetHostView_->render_widget_host_) {
1462 WebMouseEvent enterEvent =
1463 WebInputEventFactory::mouseEvent(theEvent, self);
1464 enterEvent.type = WebInputEvent::MouseMove;
1465 enterEvent.button = WebMouseEvent::ButtonNone;
1466 renderWidgetHostView_->render_widget_host_->ForwardMouseEvent(enterEvent);
1467 }
1468 mouseEventWasIgnored_ = NO;
1469 }
1470
1440 // TODO(rohitrao): Probably need to handle other mouse down events here. 1471 // TODO(rohitrao): Probably need to handle other mouse down events here.
1441 if ([theEvent type] == NSLeftMouseDown && takesFocusOnlyOnMouseDown_) { 1472 if ([theEvent type] == NSLeftMouseDown && takesFocusOnlyOnMouseDown_) {
1442 if (renderWidgetHostView_->render_widget_host_) 1473 if (renderWidgetHostView_->render_widget_host_)
1443 renderWidgetHostView_->render_widget_host_->OnMouseActivate(); 1474 renderWidgetHostView_->render_widget_host_->OnMouseActivate();
1444 1475
1445 // Manually take focus after the click but before forwarding it to the 1476 // Manually take focus after the click but before forwarding it to the
1446 // renderer. 1477 // renderer.
1447 [[self window] makeFirstResponder:self]; 1478 [[self window] makeFirstResponder:self];
1448 } 1479 }
1449 1480
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after
2863 if (!string) return NO; 2894 if (!string) return NO;
2864 2895
2865 // If the user is currently using an IME, confirm the IME input, 2896 // If the user is currently using an IME, confirm the IME input,
2866 // and then insert the text from the service, the same as TextEdit and Safari. 2897 // and then insert the text from the service, the same as TextEdit and Safari.
2867 [self confirmComposition]; 2898 [self confirmComposition];
2868 [self insertText:string]; 2899 [self insertText:string];
2869 return YES; 2900 return YES;
2870 } 2901 }
2871 2902
2872 @end 2903 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698