2011-02-04 Darin Adler <darin@apple.com>
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Feb 2011 00:11:01 +0000 (00:11 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Feb 2011 00:11:01 +0000 (00:11 +0000)
        Reviewed by Dan Bernstein.

        WebKit2 doesn't hide mouse pointer on keypress
        https://bugs.webkit.org/show_bug.cgi?id=53821
        rdar://problem/8630895

        * UIProcess/PageClient.h: Renamed didNotHandleKeyEvent to
        doneWithKeyEvent and added a bool wasEventHandled argument.
        * UIProcess/WebPageProxy.cpp:
        (WebKit::WebPageProxy::didReceiveEvent): Changed code to call
        doneWithKeyEvent and call even if event was handled.

        * UIProcess/API/mac/PageClientImpl.h: Updated for above change.
        * UIProcess/API/mac/PageClientImpl.mm:
        (WebKit::PageClientImpl::doneWithKeyEvent): Ditto. But also
        call [NSCursor setHiddenUntilMouseMoves:YES] when a key down
        event was handled. This matches what -[WebHTMLView keyDown:] does.
        * UIProcess/API/qt/qwkpage.cpp:
        (QWKPagePrivate::doneWithKeyEvent): Ditto.
        * UIProcess/API/qt/qwkpage_p.h: Ditto.
        * UIProcess/win/WebView.cpp:
        (WebKit::WebView::doneWithKeyEvent): Ditto.
        * UIProcess/win/WebView.h: Ditto.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
Source/WebKit2/UIProcess/API/qt/qwkpage.cpp
Source/WebKit2/UIProcess/API/qt/qwkpage_p.h
Source/WebKit2/UIProcess/PageClient.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/win/WebView.cpp
Source/WebKit2/UIProcess/win/WebView.h

index 5fe7f7018309ca17020ad50130bf72c639ef7323..ba37eebfbdcc11f1988110db7150eb349e1d5f5e 100644 (file)
@@ -1,3 +1,29 @@
+2011-02-04  Darin Adler  <darin@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        WebKit2 doesn't hide mouse pointer on keypress
+        https://bugs.webkit.org/show_bug.cgi?id=53821
+        rdar://problem/8630895
+
+        * UIProcess/PageClient.h: Renamed didNotHandleKeyEvent to
+        doneWithKeyEvent and added a bool wasEventHandled argument.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didReceiveEvent): Changed code to call
+        doneWithKeyEvent and call even if event was handled.
+
+        * UIProcess/API/mac/PageClientImpl.h: Updated for above change.
+        * UIProcess/API/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::doneWithKeyEvent): Ditto. But also
+        call [NSCursor setHiddenUntilMouseMoves:YES] when a key down
+        event was handled. This matches what -[WebHTMLView keyDown:] does.
+        * UIProcess/API/qt/qwkpage.cpp:
+        (QWKPagePrivate::doneWithKeyEvent): Ditto.
+        * UIProcess/API/qt/qwkpage_p.h: Ditto.
+        * UIProcess/win/WebView.cpp:
+        (WebKit::WebView::doneWithKeyEvent): Ditto.
+        * UIProcess/win/WebView.h: Ditto.
+
 2011-02-04  Steve Falkenburg  <sfalken@apple.com>
 
         Reviewed by Adam Roben.
index 459bd6886b11fa6da00b8d9969ad092f48448ac1..9f7f484600e6bb7b232d50a0feee073b7b05ceeb 100644 (file)
@@ -76,7 +76,7 @@ private:
     virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
     virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
 
-    virtual void didNotHandleKeyEvent(const NativeWebKeyboardEvent&);
+    virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled);
 
     virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*);
     virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);
index bade3a4b81a231ec1183aa9b86103f68e83b92a4..f2046d04e84ded284df19ed538fb424ed282730d 100644 (file)
@@ -308,10 +308,14 @@ FloatRect PageClientImpl::convertToUserSpace(const FloatRect& rect)
     return [m_wkView _convertToUserSpace:rect];
 }
 
-void PageClientImpl::didNotHandleKeyEvent(const NativeWebKeyboardEvent& event)
+void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool wasEventHandled)
 {
     NSEvent* nativeEvent = event.nativeEvent();
-    if ([nativeEvent type] == NSKeyDown) {
+    if ([nativeEvent type] != NSKeyDown)
+        return;
+    if (wasEventHandled)
+        [NSCursor setHiddenUntilMouseMoves:YES];
+    else {
         [m_wkView _setEventBeingResent:nativeEvent];
         [[NSApplication sharedApplication] sendEvent:nativeEvent];
     }
index 10d922fbd7fd07fe73d7d72ac63ac2e43b2e0b64..0d192d69554e822d40b1f47750b1aada0448d079 100644 (file)
@@ -232,7 +232,7 @@ void QWKPagePrivate::selectionChanged(bool, bool, bool, bool)
 {
 }
 
-void QWKPagePrivate::didNotHandleKeyEvent(const NativeWebKeyboardEvent&)
+void QWKPagePrivate::doneWithKeyEvent(const NativeWebKeyboardEvent&, bool)
 {
 }
 
index 47012d2e15dd10d9afe462cf96f69266f51b2858..e20ec9d3813a47d81df028fe8bd182afef17dbbb 100644 (file)
@@ -79,7 +79,7 @@ public:
     virtual void clearAllEditCommands();
     virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
     virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
-    virtual void didNotHandleKeyEvent(const WebKit::NativeWebKeyboardEvent&);
+    virtual void doneWithKeyEvent(const WebKit::NativeWebKeyboardEvent&, bool wasEventHandled);
     virtual void selectionChanged(bool, bool, bool, bool);
     virtual PassRefPtr<WebKit::WebPopupMenuProxy> createPopupMenuProxy(WebKit::WebPageProxy*);
     virtual PassRefPtr<WebKit::WebContextMenuProxy> createContextMenuProxy(WebKit::WebPageProxy*);
index 47d95d8cd5943c2c7c8c60d81e339059dbf0bac8..78f7da0715dbfe4d5725107bd150227435252535 100644 (file)
@@ -109,7 +109,7 @@ public:
     virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&) = 0;
     virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) = 0;
 
-    virtual void didNotHandleKeyEvent(const NativeWebKeyboardEvent&) = 0;
+    virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) = 0;
 
     virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) = 0;
     virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) = 0;
index afedd0b685739d1acac6ea344438e005ae01828d..dbf7e22c11cad47b517c6d96f2e8125c4b18abb2 100644 (file)
@@ -2237,10 +2237,11 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
 
         m_keyEventQueue.removeFirst();
 
+        m_pageClient->doneWithKeyEvent(event, handled);
+
         if (handled)
             break;
 
-        m_pageClient->didNotHandleKeyEvent(event);
         m_uiClient.didNotHandleKeyEvent(this, event);
         break;
     }
index 1815e5a69fe6302404c5547c7b3c526dbedde17c..4313b81f782f2b2284fa61f56549058f0785fc65 100644 (file)
@@ -1003,11 +1003,12 @@ bool WebView::onIMESetContext(WPARAM wparam, LPARAM)
     return false;
 }
 
-void WebView::didNotHandleKeyEvent(const NativeWebKeyboardEvent& event)
+void WebView::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool wasEventHandled)
 {
     // Calling ::DefWindowProcW will ensure that pressing the Alt key will generate a WM_SYSCOMMAND
     // event, e.g. See <http://webkit.org/b/47671>.
-    ::DefWindowProcW(event.nativeEvent()->hwnd, event.nativeEvent()->message, event.nativeEvent()->wParam, event.nativeEvent()->lParam);
+    if (!wasEventHandled)
+        ::DefWindowProcW(event.nativeEvent()->hwnd, event.nativeEvent()->message, event.nativeEvent()->wParam, event.nativeEvent()->lParam);
 }
 
 PassRefPtr<WebPopupMenuProxy> WebView::createPopupMenuProxy(WebPageProxy* page)
index d00027192436945761fdf73fd1bea31a7ba649f3..4f98ed4577c61dbf3bb1ab42119ca0b0938142c4 100644 (file)
@@ -149,7 +149,7 @@ private:
     virtual void setEditCommandState(const WTF::String&, bool, int);
     virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&);
     virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
-    virtual void didNotHandleKeyEvent(const NativeWebKeyboardEvent&);
+    virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled);
     virtual void compositionSelectionChanged(bool);
     virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*);
     virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);