[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

aroben at apple.com aroben at apple.com
Wed Dec 22 13:52:18 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 1cbffefbcd90f6b82431c67ce951886b14d42775
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 28 17:43:31 2010 +0000

    Tell the UI client when a key event is not handled
    
    When the web process receives an event, it sends a
    WebPageProxyMessage::DidReceiveEvent message back to the UI process.
    That message is now sent after handling the event, and includes a
    boolean signifying whether or not the event was actually handled.
    
    Every time WebPageProxy receives a key event, it adds it to a queue.
    When it receives a WebPageProxyMessage::DidReceiveEvent for a key
    event, the event is removed from the queue. If the event was not
    handled, we tell the UI client.
    
    Fixes <http://webkit.org/b/46660> <rdar://problem/8483465> Need API to
    tell a WebKit2 client application that a key event was not handled
    
    Reviewed by Kenneth Rohde Christiansen and Sam Weinig.
    
    WebKit2:
    
    * Shared/NativeWebKeyboardEvent.h: Added. This class wraps a
    WebKeyboardEvent and the native event that was used to construct it.
    (WebKit::NativeWebKeyboardEvent::nativeEvent): Simple getter.
    
    * Shared/WebEvent.h: Made isKeyboardEventType public for
    WebPageProxy's benefit.
    
    * Shared/mac/NativeWebKeyboardEventMac.mm: Added.
    (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent):
    * Shared/qt/NativeWebKeyboardEventQt.cpp: Added.
    (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent):
    * Shared/win/NativeWebKeyboardEventWin.cpp: Added.
    (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent):
    The constructor creates a WebKeyboardEvent and stores the native
    event.
    
    * UIProcess/API/C/WKNativeEvent.h: Added.
    
    * UIProcess/API/C/WKPage.h: Added WKPageDidNotHandleKeyEventCallback
    and WKPageUIClient::didNotHandleKeyEvent.
    
    * UIProcess/API/mac/WKView.mm:
    (-[WKView keyUp:]):
    (-[WKView keyDown:]):
    * UIProcess/win/WebView.cpp:
    (WebKit::WebView::onKeyEvent):
    * UIProcess/API/qt/qwkpage.cpp:
    (QWKPagePrivate::keyPressEvent):
    (QWKPagePrivate::keyReleaseEvent):
    Changed to use NativeWebKeyboardEvent.
    
    (QWKPage::QWKPage): Updated for addition of didNotHandleKeyEvent.
    
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::handleKeyboardEvent): Changed to take a
    NativeWebKeyboardEvent and to add it to m_keyEventQueue.
    (WebKit::WebPageProxy::didReceiveMessage): Changed to expect a boolean
    parameter in WebPageProxyMessage::DidReceiveEvent.
    (WebKit::WebPageProxy::didReceiveEvent): Added a boolean "handled"
    parameter. If the event was a keyboard event, we remove it from
    m_keyEventQueue, and if it wasn't handled by WebCore, we tell the UI
    client.
    
    * UIProcess/WebPageProxy.h: Added m_keyEventQueue.
    
    * UIProcess/WebUIClient.cpp:
    (WebKit::WebUIClient::didNotHandleKeyEvent):
    * UIProcess/WebUIClient.h:
    Added. Just calls through to the WKPageUIClient.
    
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::handleMouseEvent):
    (WebKit::WebPage::mouseEvent):
    (WebKit::handleWheelEvent):
    (WebKit::WebPage::wheelEvent):
    (WebKit::handleKeyEvent):
    (WebKit::WebPage::keyEvent):
    (WebKit::handleTouchEvent):
    (WebKit::WebPage::touchEvent):
    Moved code from the *Event functions into new helper handle*Event
    functions, and changed to pass a boolean to
    WebPageProxyMessage::DidReceiveEvent signaling whether the event was
    handled or not.
    
    * WebKit2.pro:
    * WebKit2.xcodeproj/project.pbxproj:
    * win/WebKit2.vcproj:
    * win/WebKit2Generated.make:
    Added WKNativeEvent.h and NativeWebKeyboardEvent.
    
    WebKitTools:
    
    Update for the addition of WKPageUIClient::didNotHandleKeyEvent
    
    * MiniBrowser/mac/BrowserWindowController.m:
    (-[BrowserWindowController awakeFromNib]):
    * MiniBrowser/win/BrowserView.cpp:
    (BrowserView::create):
    * WebKitTestRunner/TestController.cpp:
    (WTR::createOtherPage):
    (WTR::TestController::initialize):
    
    Conflicts:
    
    	WebKit2/WebKit2.xcodeproj/project.pbxproj
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68538 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 8d14783..b9e3ed6 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,92 @@
+2010-09-28  Adam Roben  <aroben at apple.com>
+
+        Tell the UI client when a key event is not handled
+
+        When the web process receives an event, it sends a
+        WebPageProxyMessage::DidReceiveEvent message back to the UI process.
+        That message is now sent after handling the event, and includes a
+        boolean signifying whether or not the event was actually handled.
+
+        Every time WebPageProxy receives a key event, it adds it to a queue.
+        When it receives a WebPageProxyMessage::DidReceiveEvent for a key
+        event, the event is removed from the queue. If the event was not
+        handled, we tell the UI client.
+
+        Fixes <http://webkit.org/b/46660> <rdar://problem/8483465> Need API to
+        tell a WebKit2 client application that a key event was not handled
+
+        Reviewed by Kenneth Rohde Christiansen and Sam Weinig.
+
+        * Shared/NativeWebKeyboardEvent.h: Added. This class wraps a
+        WebKeyboardEvent and the native event that was used to construct it.
+        (WebKit::NativeWebKeyboardEvent::nativeEvent): Simple getter.
+
+        * Shared/WebEvent.h: Made isKeyboardEventType public for
+        WebPageProxy's benefit.
+
+        * Shared/mac/NativeWebKeyboardEventMac.mm: Added.
+        (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent):
+        * Shared/qt/NativeWebKeyboardEventQt.cpp: Added.
+        (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent):
+        * Shared/win/NativeWebKeyboardEventWin.cpp: Added.
+        (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent):
+        The constructor creates a WebKeyboardEvent and stores the native
+        event.
+
+        * UIProcess/API/C/WKNativeEvent.h: Added.
+
+        * UIProcess/API/C/WKPage.h: Added WKPageDidNotHandleKeyEventCallback
+        and WKPageUIClient::didNotHandleKeyEvent.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView keyUp:]):
+        (-[WKView keyDown:]):
+        * UIProcess/win/WebView.cpp:
+        (WebKit::WebView::onKeyEvent):
+        * UIProcess/API/qt/qwkpage.cpp:
+        (QWKPagePrivate::keyPressEvent):
+        (QWKPagePrivate::keyReleaseEvent):
+        Changed to use NativeWebKeyboardEvent.
+
+        (QWKPage::QWKPage): Updated for addition of didNotHandleKeyEvent.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::handleKeyboardEvent): Changed to take a
+        NativeWebKeyboardEvent and to add it to m_keyEventQueue.
+        (WebKit::WebPageProxy::didReceiveMessage): Changed to expect a boolean
+        parameter in WebPageProxyMessage::DidReceiveEvent.
+        (WebKit::WebPageProxy::didReceiveEvent): Added a boolean "handled"
+        parameter. If the event was a keyboard event, we remove it from
+        m_keyEventQueue, and if it wasn't handled by WebCore, we tell the UI
+        client.
+
+        * UIProcess/WebPageProxy.h: Added m_keyEventQueue.
+
+        * UIProcess/WebUIClient.cpp:
+        (WebKit::WebUIClient::didNotHandleKeyEvent):
+        * UIProcess/WebUIClient.h:
+        Added. Just calls through to the WKPageUIClient.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::handleMouseEvent):
+        (WebKit::WebPage::mouseEvent):
+        (WebKit::handleWheelEvent):
+        (WebKit::WebPage::wheelEvent):
+        (WebKit::handleKeyEvent):
+        (WebKit::WebPage::keyEvent):
+        (WebKit::handleTouchEvent):
+        (WebKit::WebPage::touchEvent):
+        Moved code from the *Event functions into new helper handle*Event
+        functions, and changed to pass a boolean to
+        WebPageProxyMessage::DidReceiveEvent signaling whether the event was
+        handled or not.
+
+        * WebKit2.pro:
+        * WebKit2.xcodeproj/project.pbxproj:
+        * win/WebKit2.vcproj:
+        * win/WebKit2Generated.make:
+        Added WKNativeEvent.h and NativeWebKeyboardEvent.
+
 2010-09-28  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Adam Roben.
diff --git a/WebKit2/Shared/NativeWebKeyboardEvent.h b/WebKit2/Shared/NativeWebKeyboardEvent.h
new file mode 100644
index 0000000..b9598d9
--- /dev/null
+++ b/WebKit2/Shared/NativeWebKeyboardEvent.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NativeWebKeyboardEvent_h
+#define NativeWebKeyboardEvent_h
+
+#include "WebEvent.h"
+
+#if PLATFORM(MAC)
+#ifdef __OBJC__
+ at class NSView;
+#else
+class NSView;
+#endif
+#elif PLATFORM(QT)
+#include <QKeyEvent>
+#endif
+
+namespace WebKit {
+
+class NativeWebKeyboardEvent : public WebKeyboardEvent {
+public:
+#if PLATFORM(MAC)
+    NativeWebKeyboardEvent(NSEvent *, NSView *);
+#elif PLATFORM(WIN)
+    NativeWebKeyboardEvent(HWND, UINT message, WPARAM, LPARAM);
+#elif PLATFORM(QT)
+    explicit NativeWebKeyboardEvent(QKeyEvent*);
+#endif
+
+#if PLATFORM(MAC)
+    NSEvent *nativeEvent() const { return m_nativeEvent.get(); }
+#elif PLATFORM(WIN)
+    const MSG* nativeEvent() const { return &m_nativeEvent; }
+#elif PLATFORM(QT)
+    const QKeyEvent* nativeEvent() const { return &m_nativeEvent; }
+#endif
+
+private:
+#if PLATFORM(MAC)
+    RetainPtr<NSEvent> m_nativeEvent;
+#elif PLATFORM(WIN)
+    MSG m_nativeEvent;
+#elif PLATFORM(QT)
+    QKeyEvent m_nativeEvent;
+#endif
+};
+
+} // namespace WebKit
+
+#endif // NativeWebKeyboardEvent_h
diff --git a/WebKit2/Shared/WebEvent.h b/WebKit2/Shared/WebEvent.h
index 188703b..79fe67e 100644
--- a/WebKit2/Shared/WebEvent.h
+++ b/WebKit2/Shared/WebEvent.h
@@ -318,12 +318,12 @@ public:
         return true;
     }
 
-private:
     static bool isKeyboardEventType(Type type)
     {
         return type == RawKeyDown || type == KeyDown || type == KeyUp || type == Char;
     }
 
+private:
     String m_text;
     String m_unmodifiedText;
     String m_keyIdentifier;
diff --git a/WebKit2/Shared/mac/NativeWebKeyboardEventMac.mm b/WebKit2/Shared/mac/NativeWebKeyboardEventMac.mm
new file mode 100644
index 0000000..d69082d
--- /dev/null
+++ b/WebKit2/Shared/mac/NativeWebKeyboardEventMac.mm
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "NativeWebKeyboardEvent.h"
+
+#import "WebEventFactory.h"
+
+namespace WebKit {
+
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(NSEvent *event, NSView *view)
+    : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(event, view))
+    , m_nativeEvent(event)
+{
+}
+
+} // namespace WebKit
diff --git a/WebKit2/Shared/qt/NativeWebKeyboardEventQt.cpp b/WebKit2/Shared/qt/NativeWebKeyboardEventQt.cpp
new file mode 100644
index 0000000..d0d247c
--- /dev/null
+++ b/WebKit2/Shared/qt/NativeWebKeyboardEventQt.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "NativeWebKeyboardEvent.h"
+
+#include "WebEventFactoryQt.h"
+
+namespace WebKit {
+
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(QKeyEvent* event)
+    : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(event))
+    , m_nativeEvent(*event)
+{
+}
+
+} // namespace WebKit
diff --git a/WebKit2/Shared/win/NativeWebKeyboardEventWin.cpp b/WebKit2/Shared/win/NativeWebKeyboardEventWin.cpp
new file mode 100644
index 0000000..d947b87
--- /dev/null
+++ b/WebKit2/Shared/win/NativeWebKeyboardEventWin.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "NativeWebKeyboardEvent.h"
+
+#include "WebEventFactory.h"
+
+namespace WebKit {
+
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+    : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(hwnd, message, wParam, lParam))
+    , m_nativeEvent()
+{
+    m_nativeEvent.hwnd = hwnd;
+    m_nativeEvent.message = message;
+    m_nativeEvent.wParam = wParam;
+    m_nativeEvent.lParam = lParam;
+}
+
+} // namespace WebKit
diff --git a/WebKit2/UIProcess/API/C/WKNativeEvent.h b/WebKit2/UIProcess/API/C/WKNativeEvent.h
new file mode 100644
index 0000000..e15f4c5
--- /dev/null
+++ b/WebKit2/UIProcess/API/C/WKNativeEvent.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKNativeEvent_h
+#define WKNativeEvent_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __APPLE__
+#ifdef __OBJC__
+ at class NSEvent;
+#else
+struct NSEvent;
+#endif
+typedef NSEvent *WKNativeEventPtr;
+#elif defined(WIN32) || defined(_WIN32)
+typedef const struct tagMSG* WKNativeEventPtr;
+#else
+typedef const void* WKNativeEventPtr;
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKNativeEvent_h */
diff --git a/WebKit2/UIProcess/API/C/WKPage.h b/WebKit2/UIProcess/API/C/WKPage.h
index 1112fff..94d8a8b 100644
--- a/WebKit2/UIProcess/API/C/WKPage.h
+++ b/WebKit2/UIProcess/API/C/WKPage.h
@@ -28,6 +28,7 @@
 
 #include <WebKit2/WKBase.h>
 #include <WebKit2/WKEvent.h>
+#include <WebKit2/WKNativeEvent.h>
 
 #ifndef __cplusplus
 #include <stdbool.h>
@@ -136,6 +137,7 @@ typedef WKStringRef (*WKPageRunJavaScriptPromptCallback)(WKPageRef page, WKStrin
 typedef void (*WKPageSetStatusTextCallback)(WKPageRef page, WKStringRef text, const void *clientInfo);
 typedef void (*WKPageMouseDidMoveOverElementCallback)(WKPageRef page, WKEventModifiers modifiers, WKTypeRef userData, const void *clientInfo);
 typedef void (*WKPageContentsSizeChangedCallback)(WKPageRef page, int width, int height, WKFrameRef frame, const void *clientInfo);
+typedef void (*WKPageDidNotHandleKeyEventCallback)(WKPageRef page, WKNativeEventPtr event, const void *clientInfo);
 
 struct WKPageUIClient {
     int                                                                 version;
@@ -149,6 +151,7 @@ struct WKPageUIClient {
     WKPageSetStatusTextCallback                                         setStatusText;
     WKPageMouseDidMoveOverElementCallback                               mouseDidMoveOverElement;
     WKPageContentsSizeChangedCallback                                   contentsSizeChanged;
+    WKPageDidNotHandleKeyEventCallback                                  didNotHandleKeyEvent;
 };
 typedef struct WKPageUIClient WKPageUIClient;
 
diff --git a/WebKit2/UIProcess/API/mac/WKView.mm b/WebKit2/UIProcess/API/mac/WKView.mm
index 0751272..a89059f 100644
--- a/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/WebKit2/UIProcess/API/mac/WKView.mm
@@ -31,6 +31,7 @@
 // Implementation
 #import "ChunkedUpdateDrawingAreaProxy.h"
 #import "LayerBackedDrawingAreaProxy.h"
+#import "NativeWebKeyboardEvent.h"
 #import "PageClientImpl.h"
 #import "RunLoop.h"
 #import "WebContext.h"
@@ -272,11 +273,19 @@ EVENT_HANDLER(otherMouseUp, Mouse)
 EVENT_HANDLER(otherMouseMoved, Mouse)
 EVENT_HANDLER(otherMouseDragged, Mouse)
 EVENT_HANDLER(scrollWheel, Wheel)
-EVENT_HANDLER(keyUp, Keyboard)
-EVENT_HANDLER(keyDown, Keyboard)
 
 #undef EVENT_HANDLER
 
+- (void)keyUp:(NSEvent *)theEvent
+{
+    _data->_page->handleKeyboardEvent(NativeWebKeyboardEvent(theEvent, self));
+}
+
+- (void)keyDown:(NSEvent *)theEvent
+{
+    _data->_page->handleKeyboardEvent(NativeWebKeyboardEvent(theEvent, self));
+}
+
 - (void)_updateActiveState
 {
     _data->_page->setActive([[self window] isKeyWindow]);
diff --git a/WebKit2/UIProcess/API/qt/qwkpage.cpp b/WebKit2/UIProcess/API/qt/qwkpage.cpp
index 4060813..5c816f3 100644
--- a/WebKit2/UIProcess/API/qt/qwkpage.cpp
+++ b/WebKit2/UIProcess/API/qt/qwkpage.cpp
@@ -25,6 +25,7 @@
 
 #include "ClientImpl.h"
 #include "LocalizedStrings.h"
+#include "NativeWebKeyboardEvent.h"
 #include "WebContext.h"
 #include "WebEventFactoryQt.h"
 #include "WebPlatformStrategies.h"
@@ -105,14 +106,12 @@ void QWKPagePrivate::paint(QPainter* painter, QRect area)
 
 void QWKPagePrivate::keyPressEvent(QKeyEvent* ev)
 {
-    WebKeyboardEvent keyboardEvent = WebEventFactory::createWebKeyboardEvent(ev);
-    page->handleKeyboardEvent(keyboardEvent);
+    page->handleKeyboardEvent(NativeWebKeyboardEvent(ev));
 }
 
 void QWKPagePrivate::keyReleaseEvent(QKeyEvent* ev)
 {
-    WebKeyboardEvent keyboardEvent = WebEventFactory::createWebKeyboardEvent(ev);
-    page->handleKeyboardEvent(keyboardEvent);
+    page->handleKeyboardEvent(NativeWebKeyboardEvent(ev));
 }
 
 void QWKPagePrivate::mouseMoveEvent(QGraphicsSceneMouseEvent* ev)
@@ -271,7 +270,8 @@ QWKPage::QWKPage(WKPageNamespaceRef namespaceRef)
         0,  /* runJavaScriptPrompt */
         0,  /* setStatusText */
         0,  /* mouseDidMoveOverElement */
-        0   /* contentsSizeChanged */
+        0,  /* contentsSizeChanged */
+        0   /* didNotHandleKeyEvent */
     };
     WKPageSetPageUIClient(pageRef(), &uiClient);
 }
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index ce2776e..71066e6 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -27,6 +27,7 @@
 
 #include "DrawingAreaProxy.h"
 #include "MessageID.h"
+#include "NativeWebKeyboardEvent.h"
 #include "PageClient.h"
 #include "WebBackForwardList.h"
 #include "WebBackForwardListItem.h"
@@ -396,11 +397,13 @@ void WebPageProxy::handleWheelEvent(const WebWheelEvent& event)
     process()->send(Messages::WebPage::WheelEvent(event), m_pageID);
 }
 
-void WebPageProxy::handleKeyboardEvent(const WebKeyboardEvent& event)
+void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event)
 {
     if (!isValid())
         return;
 
+    m_keyEventQueue.append(event);
+
     process()->responsivenessTimer()->start();
     process()->send(Messages::WebPage::KeyEvent(event), m_pageID);
 }
@@ -698,9 +701,10 @@ void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::M
             break;
         case WebPageProxyMessage::DidReceiveEvent: {
             uint32_t type;
-            if (!arguments->decode(type))
+            bool handled;
+            if (!arguments->decode(CoreIPC::Out(type, handled)))
                 return;
-            didReceiveEvent((WebEvent::Type)type);
+            didReceiveEvent((WebEvent::Type)type, handled);
             break;
         }
         case WebPageProxyMessage::TakeFocus: {
@@ -1230,7 +1234,7 @@ void WebPageProxy::setCursor(const WebCore::Cursor& cursor)
     m_pageClient->setCursor(cursor);
 }
 
-void WebPageProxy::didReceiveEvent(WebEvent::Type type)
+void WebPageProxy::didReceiveEvent(WebEvent::Type type, bool handled)
 {
     switch (type) {
         case WebEvent::MouseMove:
@@ -1246,6 +1250,18 @@ void WebPageProxy::didReceiveEvent(WebEvent::Type type)
             process()->responsivenessTimer()->stop();
             break;
     }
+
+    if (!WebKeyboardEvent::isKeyboardEventType(type))
+        return;
+
+    NativeWebKeyboardEvent event = m_keyEventQueue.first();
+    ASSERT(type == event.type());
+    m_keyEventQueue.removeFirst();
+
+    if (handled)
+        return;
+
+    m_uiClient.didNotHandleKeyEvent(this, event);
 }
 
 void WebPageProxy::didRunJavaScriptInMainFrame(const String& resultString, uint64_t callbackID)
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index e171bf5..1a98235 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -63,6 +63,7 @@ struct WKContextStatistics;
 namespace WebKit {
 
 class DrawingAreaProxy;
+class NativeWebKeyboardEvent;
 class PageClient;
 class PlatformCertificateInfo;
 class WebBackForwardList;
@@ -144,7 +145,7 @@ public:
 
     void handleMouseEvent(const WebMouseEvent&);
     void handleWheelEvent(const WebWheelEvent&);
-    void handleKeyboardEvent(const WebKeyboardEvent&);
+    void handleKeyboardEvent(const NativeWebKeyboardEvent&);
 #if ENABLE(TOUCH_EVENTS)
     void handleTouchEvent(const WebTouchEvent&);
 #endif
@@ -254,7 +255,7 @@ private:
     void setToolTip(const String&);
     void setCursor(const WebCore::Cursor&);
 
-    void didReceiveEvent(WebEvent::Type);
+    void didReceiveEvent(WebEvent::Type, bool handled);
 
     void didRunJavaScriptInMainFrame(const String&, uint64_t);
     void didGetRenderTreeExternalRepresentation(const String&, uint64_t);
@@ -304,6 +305,8 @@ private:
     bool m_closed;
 
     uint64_t m_pageID;
+
+    Deque<NativeWebKeyboardEvent> m_keyEventQueue;
 };
 
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/WebUIClient.cpp b/WebKit2/UIProcess/WebUIClient.cpp
index ec3c525..9fbe53f 100644
--- a/WebKit2/UIProcess/WebUIClient.cpp
+++ b/WebKit2/UIProcess/WebUIClient.cpp
@@ -25,6 +25,7 @@
 
 #include "WebUIClient.h"
 
+#include "NativeWebKeyboardEvent.h"
 #include "WKAPICast.h"
 #include "WebPageProxy.h"
 #include <WebCore/IntSize.h>
@@ -128,4 +129,11 @@ void WebUIClient::contentsSizeChanged(WebPageProxy* page, const IntSize& size, W
     m_pageUIClient.contentsSizeChanged(toRef(page), size.width(), size.height(), toRef(frame), m_pageUIClient.clientInfo);
 }
 
+void WebUIClient::didNotHandleKeyEvent(WebPageProxy* page, const NativeWebKeyboardEvent& event)
+{
+    if (!m_pageUIClient.didNotHandleKeyEvent)
+        return;
+    m_pageUIClient.didNotHandleKeyEvent(toRef(page), event.nativeEvent(), m_pageUIClient.clientInfo);
+}
+
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/WebUIClient.h b/WebKit2/UIProcess/WebUIClient.h
index 4e0595c..6148c6c 100644
--- a/WebKit2/UIProcess/WebUIClient.h
+++ b/WebKit2/UIProcess/WebUIClient.h
@@ -38,6 +38,7 @@ class IntSize;
 namespace WebKit {
 
 class APIObject;
+class NativeWebKeyboardEvent;
 class WebFrameProxy;
 class WebPageProxy;
 
@@ -55,6 +56,7 @@ public:
     void setStatusText(WebPageProxy*, const String&);
     void mouseDidMoveOverElement(WebPageProxy*, WebEvent::Modifiers, APIObject*);
     void contentsSizeChanged(WebPageProxy*, const WebCore::IntSize&, WebFrameProxy*);
+    void didNotHandleKeyEvent(WebPageProxy*, const NativeWebKeyboardEvent&);
 
 private:
     WKPageUIClient m_pageUIClient;
diff --git a/WebKit2/UIProcess/win/WebView.cpp b/WebKit2/UIProcess/win/WebView.cpp
index fa897d6..b47d371 100644
--- a/WebKit2/UIProcess/win/WebView.cpp
+++ b/WebKit2/UIProcess/win/WebView.cpp
@@ -27,6 +27,7 @@
 
 #include "ChunkedUpdateDrawingAreaProxy.h"
 #include "RunLoop.h"
+#include "NativeWebKeyboardEvent.h"
 #include "WebEditCommandProxy.h"
 #include "WebEventFactory.h"
 #include "WebPageNamespace.h"
@@ -333,8 +334,7 @@ LRESULT WebView::onWheelEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
 
 LRESULT WebView::onKeyEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled)
 {
-    WebKeyboardEvent keyboardEvent = WebEventFactory::createWebKeyboardEvent(hWnd, message, wParam, lParam);
-    m_page->handleKeyboardEvent(keyboardEvent);
+    m_page->handleKeyboardEvent(NativeWebKeyboardEvent(hWnd, message, wParam, lParam));
 
     handled = true;
     return 0;
diff --git a/WebKit2/WebKit2.pro b/WebKit2/WebKit2.pro
index 5c88ce3..c038c70 100644
--- a/WebKit2/WebKit2.pro
+++ b/WebKit2/WebKit2.pro
@@ -179,6 +179,7 @@ HEADERS += \
     Shared/ImmutableDictionary.h \
     Shared/MutableArray.h \
     Shared/MutableDictionary.h \
+    Shared/NativeWebKeyboardEvent.h \
     Shared/NotImplemented.h \
     Shared/qt/MappedMemory.h \
     Shared/qt/PlatformCertificateInfo.h \
@@ -201,6 +202,7 @@ HEADERS += \
     UIProcess/API/C/WKContextPrivate.h \
     UIProcess/API/C/WKFrame.h \
     UIProcess/API/C/WKFramePolicyListener.h \
+    UIProcess/API/C/WKNativeEvent.h \
     UIProcess/API/C/WKNavigationData.h \
     UIProcess/API/C/WKPage.h \
     UIProcess/API/C/WKPageNamespace.h \
@@ -310,6 +312,7 @@ SOURCES += \
     Shared/MutableArray.cpp \
     Shared/MutableDictionary.cpp \
     Shared/qt/MappedMemoryPool.cpp \
+    Shared/qt/NativeWebKeyboardEventQt.cpp \
     Shared/qt/UpdateChunk.cpp \
     Shared/qt/WebCoreArgumentCodersQt.cpp \
     Shared/qt/WebEventFactoryQt.cpp \
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index cbe54b4..770d923 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -396,7 +396,9 @@
 		BCF69FA31176D01400471A52 /* WebNavigationData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF69FA11176D01400471A52 /* WebNavigationData.cpp */; };
 		BCF69FA91176D1CB00471A52 /* WKNavigationData.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF69FA71176D1CB00471A52 /* WKNavigationData.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		BCF69FAA1176D1CB00471A52 /* WKNavigationData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF69FA81176D1CB00471A52 /* WKNavigationData.cpp */; };
+		C02BFF1E1251502E009CCBEA /* NativeWebKeyboardEventMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = C02BFF1D1251502E009CCBEA /* NativeWebKeyboardEventMac.mm */; };
 		C06C6095124C144B0001682F /* WebPageCreationParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C06C6093124C14430001682F /* WebPageCreationParameters.cpp */; };
+		C09AE5E9125257C20025825D /* WKNativeEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C09AE5E8125257C20025825D /* WKNativeEvent.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		C0CE72A01247E71D00BC0EC4 /* WebPageMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0CE729E1247E71D00BC0EC4 /* WebPageMessageReceiver.cpp */; };
 		C0CE72A11247E71D00BC0EC4 /* WebPageMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = C0CE729F1247E71D00BC0EC4 /* WebPageMessages.h */; };
 		C0CE72AD1247E78D00BC0EC4 /* HandleMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = C0CE72AC1247E78D00BC0EC4 /* HandleMessage.h */; };
@@ -835,9 +837,12 @@
 		BCF69FA11176D01400471A52 /* WebNavigationData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebNavigationData.cpp; sourceTree = "<group>"; };
 		BCF69FA71176D1CB00471A52 /* WKNavigationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigationData.h; sourceTree = "<group>"; };
 		BCF69FA81176D1CB00471A52 /* WKNavigationData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKNavigationData.cpp; sourceTree = "<group>"; };
+		C02BFF1512514FD8009CCBEA /* NativeWebKeyboardEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeWebKeyboardEvent.h; sourceTree = "<group>"; };
+		C02BFF1D1251502E009CCBEA /* NativeWebKeyboardEventMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NativeWebKeyboardEventMac.mm; sourceTree = "<group>"; };
 		C06C6093124C14430001682F /* WebPageCreationParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageCreationParameters.cpp; sourceTree = "<group>"; };
 		C06C6094124C14430001682F /* WebPageCreationParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageCreationParameters.h; sourceTree = "<group>"; };
 		C08FDE87124A851C007645BD /* messages_unittest.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = messages_unittest.py; sourceTree = "<group>"; };
+		C09AE5E8125257C20025825D /* WKNativeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNativeEvent.h; sourceTree = "<group>"; };
 		C0CE72581247E4DA00BC0EC4 /* WebPage.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebPage.messages.in; sourceTree = "<group>"; };
 		C0CE729E1247E71D00BC0EC4 /* WebPageMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageMessageReceiver.cpp; sourceTree = "<group>"; };
 		C0CE729F1247E71D00BC0EC4 /* WebPageMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageMessages.h; sourceTree = "<group>"; };
@@ -1085,6 +1090,7 @@
 				BCC8049E122F0D6B00103529 /* MutableArray.h */,
 				BCB0AEE8122F53E300B1341E /* MutableDictionary.cpp */,
 				BCB0AEE7122F53E300B1341E /* MutableDictionary.h */,
+				C02BFF1512514FD8009CCBEA /* NativeWebKeyboardEvent.h */,
 				BCC57161115ADB42001CCAF9 /* NotImplemented.h */,
 				BCB0B0DF12305AB100B1341E /* UserMessageCoders.h */,
 				1A0F29C9120B37160053D1B9 /* VisitedLinkTable.cpp */,
@@ -1328,6 +1334,7 @@
 				BCD01397110FA420003B8A67 /* WKFrame.h */,
 				BCB9F6A41123DD0D00A137E0 /* WKFramePolicyListener.cpp */,
 				BCB9F6A31123DD0D00A137E0 /* WKFramePolicyListener.h */,
+				C09AE5E8125257C20025825D /* WKNativeEvent.h */,
 				BCF69FA81176D1CB00471A52 /* WKNavigationData.cpp */,
 				BCF69FA71176D1CB00471A52 /* WKNavigationData.h */,
 				BCD597D4112B56DC00EC8C23 /* WKPage.cpp */,
@@ -1394,6 +1401,7 @@
 			children = (
 				1A043D90124FF02B00FFBFB5 /* BackingStoreMac.mm */,
 				1A6F9FB611E1408500DB1371 /* CommandLineMac.cpp */,
+				C02BFF1D1251502E009CCBEA /* NativeWebKeyboardEventMac.mm */,
 				BCF505E61243047B005955AE /* PlatformCertificateInfo.mm */,
 				BCF505E51243047B005955AE /* PlatformCertificateInfo.h */,
 				BC9E95D211449B0300870E71 /* UpdateChunk.cpp */,
@@ -1878,6 +1886,7 @@
 				1A043DC1124FF87500FFBFB5 /* PluginProxy.h in Headers */,
 				1A043F6A12514D8B00FFBFB5 /* WebProcessConnectionMessages.h in Headers */,
 				1A8EF4CB1252403700F7067F /* PluginControllerProxy.h in Headers */,
+				C09AE5E9125257C20025825D /* WKNativeEvent.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2167,6 +2176,7 @@
 				1A043DC2124FF87500FFBFB5 /* PluginProxy.cpp in Sources */,
 				1A043F6912514D8B00FFBFB5 /* WebProcessConnectionMessageReceiver.cpp in Sources */,
 				1A8EF4CC1252403700F7067F /* PluginControllerProxy.cpp in Sources */,
+				C02BFF1E1251502E009CCBEA /* NativeWebKeyboardEventMac.mm in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 4cc0935..d264eb5 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -452,61 +452,71 @@ private:
     const WebEvent* m_previousCurrentEvent;
 };
 
-void WebPage::mouseEvent(const WebMouseEvent& mouseEvent)
+static bool handleMouseEvent(const WebMouseEvent& mouseEvent, Page* page)
 {
-    CurrentEvent currentEvent(mouseEvent);
-
-    WebProcess::shared().connection()->send(WebPageProxyMessage::DidReceiveEvent, m_pageID, CoreIPC::In(static_cast<uint32_t>(mouseEvent.type())));
-
-    if (!m_mainFrame->coreFrame()->view())
-        return;
+    Frame* frame = page->mainFrame();
+    if (!frame->view())
+        return false;
 
     PlatformMouseEvent platformMouseEvent = platform(mouseEvent);
-    
+
     switch (platformMouseEvent.eventType()) {
         case WebCore::MouseEventPressed:
-            m_mainFrame->coreFrame()->eventHandler()->handleMousePressEvent(platformMouseEvent);
-            break;
+            return frame->eventHandler()->handleMousePressEvent(platformMouseEvent);
         case WebCore::MouseEventReleased:
-            m_mainFrame->coreFrame()->eventHandler()->handleMouseReleaseEvent(platformMouseEvent);
-            break;
+            return frame->eventHandler()->handleMouseReleaseEvent(platformMouseEvent);
         case WebCore::MouseEventMoved:
-            m_mainFrame->coreFrame()->eventHandler()->mouseMoved(platformMouseEvent);
-            break;
+            return frame->eventHandler()->mouseMoved(platformMouseEvent);
         default:
             ASSERT_NOT_REACHED();
-            break;
+            return false;
     }
 }
 
+void WebPage::mouseEvent(const WebMouseEvent& mouseEvent)
+{
+    CurrentEvent currentEvent(mouseEvent);
+
+    bool handled = handleMouseEvent(mouseEvent, m_page.get());
+
+    WebProcess::shared().connection()->send(WebPageProxyMessage::DidReceiveEvent, m_pageID, CoreIPC::In(static_cast<uint32_t>(mouseEvent.type()), handled));
+}
+
+static bool handleWheelEvent(const WebWheelEvent& wheelEvent, Page* page)
+{
+    Frame* frame = page->mainFrame();
+    if (!frame->view())
+        return false;
+
+    PlatformWheelEvent platformWheelEvent = platform(wheelEvent);
+    return frame->eventHandler()->handleWheelEvent(platformWheelEvent);
+}
+
 void WebPage::wheelEvent(const WebWheelEvent& wheelEvent)
 {
     CurrentEvent currentEvent(wheelEvent);
 
-    WebProcess::shared().connection()->send(WebPageProxyMessage::DidReceiveEvent, m_pageID, CoreIPC::In(static_cast<uint32_t>(wheelEvent.type())));
-    if (!m_mainFrame->coreFrame()->view())
-        return;
+    bool handled = handleWheelEvent(wheelEvent, m_page.get());
+    WebProcess::shared().connection()->send(WebPageProxyMessage::DidReceiveEvent, m_pageID, CoreIPC::In(static_cast<uint32_t>(wheelEvent.type()), handled));
+}
 
-    PlatformWheelEvent platformWheelEvent = platform(wheelEvent);
-    m_mainFrame->coreFrame()->eventHandler()->handleWheelEvent(platformWheelEvent);
+static bool handleKeyEvent(const WebKeyboardEvent& keyboardEvent, Page* page)
+{
+    if (!page->mainFrame()->view())
+        return false;
+
+    return page->focusController()->focusedOrMainFrame()->eventHandler()->keyEvent(platform(keyboardEvent));
 }
 
 void WebPage::keyEvent(const WebKeyboardEvent& keyboardEvent)
 {
     CurrentEvent currentEvent(keyboardEvent);
 
-    WebProcess::shared().connection()->send(WebPageProxyMessage::DidReceiveEvent, m_pageID, CoreIPC::In(static_cast<uint32_t>(keyboardEvent.type())));
-
-    if (!m_mainFrame->coreFrame()->view())
-        return;
+    bool handled = handleKeyEvent(keyboardEvent, m_page.get());
+    if (!handled)
+        handled = performDefaultBehaviorForKeyEvent(keyboardEvent);
 
-    PlatformKeyboardEvent platformKeyboardEvent = platform(keyboardEvent);
-    if (m_page->focusController()->focusedOrMainFrame()->eventHandler()->keyEvent(platformKeyboardEvent))
-        return;
-
-    bool handled = performDefaultBehaviorForKeyEvent(keyboardEvent);
-    // FIXME: Communicate back to the UI process that the event was handled.
-    (void)handled;
+    WebProcess::shared().connection()->send(WebPageProxyMessage::DidReceiveEvent, m_pageID, CoreIPC::In(static_cast<uint32_t>(keyboardEvent.type()), handled));
 }
 
 void WebPage::validateMenuItem(const String& commandName)
@@ -529,16 +539,22 @@ void WebPage::executeEditCommand(const String& commandName)
 }
 
 #if ENABLE(TOUCH_EVENTS)
+static bool handleTouchEvent(const WebTouchEvent& touchEvent, Page* page)
+{
+    Frame* frame = page->mainFrame();
+    if (!frame->view())
+        return false;
+
+    return frame->eventHandler()->handleTouchEvent(platform(touchEvent));
+}
+
 void WebPage::touchEvent(const WebTouchEvent& touchEvent)
 {
     CurrentEvent currentEvent(touchEvent);
-    WebProcess::shared().connection()->send(WebPageProxyMessage::DidReceiveEvent, m_pageID, CoreIPC::In(static_cast<uint32_t>(touchEvent.type())));
-            
-    if (!m_mainFrame->coreFrame()->view())
-        return;
 
-    PlatformTouchEvent platformTouchEvent = platform(touchEvent);
-    m_mainFrame->coreFrame()->eventHandler()->handleTouchEvent(platformTouchEvent);
+    bool handled = handleTouchEvent(touchEvent, m_page.get());
+
+    WebProcess::shared().connection()->send(WebPageProxyMessage::DidReceiveEvent, m_pageID, CoreIPC::In(static_cast<uint32_t>(touchEvent.type()), handled));
 }
 #endif
 
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index d4dc098..29636ba 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -437,6 +437,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\Shared\NativeWebKeyboardEvent.h"
+				>
+			</File>
+			<File
 				RelativePath="..\Shared\NotImplemented.h"
 				>
 			</File>
@@ -764,6 +768,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\Shared\win\NativeWebKeyboardEventWin.cpp"
+					>
+				</File>
+				<File
 					RelativePath="..\Shared\win\PlatformCertificateInfo.cpp"
 					>
 				</File>
@@ -1603,6 +1611,10 @@
 						>
 					</File>
 					<File
+						RelativePath="..\UIProcess\API\C\WKNativeEvent.h"
+						>
+					</File>
+					<File
 						RelativePath="..\UIProcess\API\C\WKNavigationData.cpp"
 						>
 					</File>
diff --git a/WebKit2/win/WebKit2Generated.make b/WebKit2/win/WebKit2Generated.make
index b1e44a9..6256b2f 100644
--- a/WebKit2/win/WebKit2Generated.make
+++ b/WebKit2/win/WebKit2Generated.make
@@ -30,6 +30,7 @@ all:
     xcopy /y /d "..\UIProcess\API\C\WKFormSubmissionListener.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\C\WKFrame.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\C\WKFramePolicyListener.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
+    xcopy /y /d "..\UIProcess\API\C\WKNativeEvent.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\C\WKNavigationData.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\C\WKPage.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\C\WKPageNamespace.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 9c87f91..985c26f 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,20 @@
+2010-09-28  Adam Roben  <aroben at apple.com>
+
+        Update for the addition of WKPageUIClient::didNotHandleKeyEvent
+
+        Fixes <http://webkit.org/b/46660> <rdar://problem/8483465> Need API to
+        tell a WebKit2 client application that a key event was not handled
+
+        Reviewed by Kenneth Rohde Christiansen and Sam Weinig.
+
+        * MiniBrowser/mac/BrowserWindowController.m:
+        (-[BrowserWindowController awakeFromNib]):
+        * MiniBrowser/win/BrowserView.cpp:
+        (BrowserView::create):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::createOtherPage):
+        (WTR::TestController::initialize):
+
 2010-09-28  Simon Fraser  <simon.fraser at apple.com>
 
         Unreviewed.
diff --git a/WebKitTools/MiniBrowser/mac/BrowserWindowController.m b/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
index 06de900..cb4c56a 100644
--- a/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
+++ b/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
@@ -537,7 +537,8 @@ static void contentsSizeChanged(WKPageRef page, int width, int height, WKFrameRe
         runJavaScriptPrompt,
         setStatusText,
         mouseDidMoveOverElement,
-        contentsSizeChanged
+        contentsSizeChanged,
+        0           /* didNotHandleKeyEvent */
     };
     WKPageSetPageUIClient(_webView.pageRef, &uiClient);
 }
diff --git a/WebKitTools/MiniBrowser/win/BrowserView.cpp b/WebKitTools/MiniBrowser/win/BrowserView.cpp
index f6a7070..76848fa 100644
--- a/WebKitTools/MiniBrowser/win/BrowserView.cpp
+++ b/WebKitTools/MiniBrowser/win/BrowserView.cpp
@@ -109,7 +109,8 @@ void BrowserView::create(RECT webViewRect, BrowserWindow* parentWindow)
         runJavaScriptPrompt,
         setStatusText,
         mouseDidMoveOverElement,
-        contentsSizeChanged
+        contentsSizeChanged,
+        0               /* didNotHandleKeyEvent */
     };
 
     WKPageSetPageUIClient(WKViewGetPage(m_webView), &uiClient);
diff --git a/WebKitTools/WebKitTestRunner/TestController.cpp b/WebKitTools/WebKitTestRunner/TestController.cpp
index 842dc81..fc2e28d 100644
--- a/WebKitTools/WebKitTestRunner/TestController.cpp
+++ b/WebKitTools/WebKitTestRunner/TestController.cpp
@@ -85,6 +85,7 @@ static WKPageRef createOtherPage(WKPageRef oldPage, const void*)
         0,
         0,
         0,
+        0,
         0
     };
     WKPageSetPageUIClient(newPage, &otherPageUIClient);
@@ -165,6 +166,7 @@ void TestController::initialize(int argc, const char* argv[])
         0,
         0,
         0,
+        0,
         0
     };
     WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list