Fixed a bug where WKView changed the cursor when the mouse was moving over other...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Apr 2011 05:35:19 +0000 (05:35 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Apr 2011 05:35:19 +0000 (05:35 +0000)
Reviewed by Sam Weinig.

* UIProcess/API/mac/WKView.mm:
(-[WKView mouseMoved:]): If getting this message because this view is the first responder,
ignore it unless it is inside the visible rect.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@83812 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/WKView.mm

index 371cdcdef7aeade95ef1053e68ea38170032c26e..322f6ca0cd95827a42bd580c771bdcd56b8f9b49 100644 (file)
@@ -1,3 +1,13 @@
+2011-04-13  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Fixed a bug where WKView changed the cursor when the mouse was moving over other views.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView mouseMoved:]): If getting this message because this view is the first responder,
+        ignore it unless it is inside the visible rect.
+
 2011-04-13  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by Geoff Garen.
index 3a6b3463164c45dff388012bd0be471b4a8a3016..a584e969a4f72dd5a7656474f66ea3adc5a27a6f 100644 (file)
@@ -935,7 +935,6 @@ static void speakString(WKStringRef string, WKErrorRef error, void*)
 
 EVENT_HANDLER(mouseEntered, Mouse)
 EVENT_HANDLER(mouseExited, Mouse)
-EVENT_HANDLER(mouseMoved, Mouse)
 EVENT_HANDLER(otherMouseDown, Mouse)
 EVENT_HANDLER(otherMouseDragged, Mouse)
 EVENT_HANDLER(otherMouseMoved, Mouse)
@@ -948,6 +947,16 @@ EVENT_HANDLER(scrollWheel, Wheel)
 
 #undef EVENT_HANDLER
 
+- (void)mouseMoved:(NSEvent *)event
+{
+    // When a view is first responder, it gets mouse moved events even when the mouse is outside its visible rect.
+    if (self == [[self window] firstResponder] && !NSPointInRect([self convertPoint:[event locationInWindow] fromView:nil], [self visibleRect]))
+        return;
+
+    WebMouseEvent webEvent = WebEventFactory::createWebMouseEvent(event, self);
+    _data->_page->handleMouseEvent(webEvent);
+}
+
 - (void)_mouseHandler:(NSEvent *)event
 {
     NSInputManager *currentInputManager = [NSInputManager currentInputManager];