Title: [107915] trunk
Revision
107915
Author
[email protected]
Date
2012-02-16 02:31:01 -0800 (Thu, 16 Feb 2012)

Log Message

[Qt] Move event conversion functions from WebCore to WebKit
https://bugs.webkit.org/show_bug.cgi?id=78788

Reviewed by Kenneth Rohde Christiansen.

.:

* Source/api.pri: Add new files to the build.

Source/WebCore:

Move QtWidgets dependent mouse event constructors out of WebCore
into WebKit, similar to the web event conversions of WebKit2.

* Target.pri:
* platform/PlatformMouseEvent.h:
(PlatformMouseEvent):
* platform/PlatformWheelEvent.h:
(PlatformWheelEvent):

Source/WebKit/qt:

Move QtWidgets dependent mouse event constructors out of WebCore
into WebKit, similar to the web event conversions of WebKit2.

* Api/qwebpage.cpp:
(QWebPagePrivate::mouseMoveEvent):
(QWebPagePrivate::mousePressEvent):
(QWebPagePrivate::mouseDoubleClickEvent):
(QWebPagePrivate::mouseTripleClickEvent):
(QWebPagePrivate::mouseReleaseEvent):
(QWebPagePrivate::wheelEvent):
(QWebPage::swallowContextMenuEvent):
* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::postProgressFinishedNotification):
* WebCoreSupport/WebEventConversion.cpp: Added.
(WebCore):
(WebCore::mouseEventModifiersFromQtKeyboardModifiers):
(WebCore::mouseEventTypeAndMouseButtonFromQEvent):
(WebKitPlatformMouseEvent):
(WebCore::WebKitPlatformMouseEvent::WebKitPlatformMouseEvent):
(WebCore::convertMouseEvent):
(WebKitPlatformWheelEvent):
(WebCore::WebKitPlatformWheelEvent::applyDelta):
(WebCore::WebKitPlatformWheelEvent::WebKitPlatformWheelEvent):
(WebCore::convertWheelEvent):
* WebCoreSupport/WebEventConversion.h: Added.
(WebCore):

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (107914 => 107915)


--- trunk/ChangeLog	2012-02-16 10:28:39 UTC (rev 107914)
+++ trunk/ChangeLog	2012-02-16 10:31:01 UTC (rev 107915)
@@ -1,3 +1,12 @@
+2012-02-16  Simon Hausmann  <[email protected]>
+
+        [Qt] Move event conversion functions from WebCore to WebKit
+        https://bugs.webkit.org/show_bug.cgi?id=78788
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        * Source/api.pri: Add new files to the build.
+
 2012-02-14  Raphael Kubo da Costa  <[email protected]>
 
         [CMake] Remove unused PkgConfig module import from FindCFLite.cmake.

Modified: trunk/Source/WebCore/ChangeLog (107914 => 107915)


--- trunk/Source/WebCore/ChangeLog	2012-02-16 10:28:39 UTC (rev 107914)
+++ trunk/Source/WebCore/ChangeLog	2012-02-16 10:31:01 UTC (rev 107915)
@@ -1,5 +1,21 @@
 2012-02-16  Simon Hausmann  <[email protected]>
 
+        [Qt] Move event conversion functions from WebCore to WebKit
+        https://bugs.webkit.org/show_bug.cgi?id=78788
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Move QtWidgets dependent mouse event constructors out of WebCore
+        into WebKit, similar to the web event conversions of WebKit2.
+
+        * Target.pri:
+        * platform/PlatformMouseEvent.h:
+        (PlatformMouseEvent):
+        * platform/PlatformWheelEvent.h:
+        (PlatformWheelEvent):
+
+2012-02-16  Simon Hausmann  <[email protected]>
+
         Unreviewed prospective Qt 4.8/Mac build fix.
 
         Cast the PlatformWidget from QObject* to QWidget* to gain access

Modified: trunk/Source/WebCore/Target.pri (107914 => 107915)


--- trunk/Source/WebCore/Target.pri	2012-02-16 10:28:39 UTC (rev 107914)
+++ trunk/Source/WebCore/Target.pri	2012-02-16 10:31:01 UTC (rev 107915)
@@ -2828,7 +2828,6 @@
     platform/qt/MIMETypeRegistryQt.cpp \
     platform/qt/PasteboardQt.cpp \
     platform/qt/PlatformKeyboardEventQt.cpp \
-    platform/qt/PlatformMouseEventQt.cpp \
     platform/qt/PlatformScreenQt.cpp \
     platform/qt/PlatformTouchEventQt.cpp \
     platform/qt/PlatformTouchPointQt.cpp \
@@ -2844,7 +2843,6 @@
     platform/text/qt/TextBoundariesQt.cpp \
     platform/text/qt/TextBreakIteratorInternalICUQt.cpp \
     platform/text/qt/TextCodecQt.cpp \
-    platform/qt/WheelEventQt.cpp \
     platform/qt/WidgetQt.cpp
 
 !contains(DEFINES, WTF_USE_LIBXML2=1) {

Modified: trunk/Source/WebCore/platform/PlatformMouseEvent.h (107914 => 107915)


--- trunk/Source/WebCore/platform/PlatformMouseEvent.h	2012-02-16 10:28:39 UTC (rev 107914)
+++ trunk/Source/WebCore/platform/PlatformMouseEvent.h	2012-02-16 10:31:01 UTC (rev 107915)
@@ -40,13 +40,6 @@
 typedef struct _Evas_Event_Mouse_Move Evas_Event_Mouse_Move;
 #endif
 
-#if PLATFORM(QT)
-QT_BEGIN_NAMESPACE
-class QInputEvent;
-class QGraphicsSceneMouseEvent;
-QT_END_NAMESPACE
-#endif
-
 #if PLATFORM(WIN)
 typedef struct HWND__* HWND;
 typedef unsigned UINT;
@@ -122,11 +115,6 @@
         int eventNumber() const { return m_eventNumber; }
 #endif
 
-#if PLATFORM(QT)
-        PlatformMouseEvent(QInputEvent*, int clickCount);
-        PlatformMouseEvent(QGraphicsSceneMouseEvent*, int clickCount);
-#endif
-
 #if PLATFORM(WIN)
         PlatformMouseEvent(HWND, UINT, WPARAM, LPARAM, bool didActivateWebView = false);
         void setClickCount(int count) { m_clickCount = count; }

Modified: trunk/Source/WebCore/platform/PlatformWheelEvent.h (107914 => 107915)


--- trunk/Source/WebCore/platform/PlatformWheelEvent.h	2012-02-16 10:28:39 UTC (rev 107914)
+++ trunk/Source/WebCore/platform/PlatformWheelEvent.h	2012-02-16 10:31:01 UTC (rev 107915)
@@ -37,13 +37,6 @@
 typedef struct _Evas_Event_Mouse_Wheel Evas_Event_Mouse_Wheel;
 #endif
 
-#if PLATFORM(QT)
-QT_BEGIN_NAMESPACE
-class QWheelEvent;
-class QGraphicsSceneWheelEvent;
-QT_END_NAMESPACE
-#endif
-
 #if PLATFORM(WIN)
 typedef struct HWND__* HWND;
 typedef unsigned WPARAM;
@@ -161,12 +154,6 @@
         bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas; }
 #endif
 
-#if PLATFORM(QT)
-        PlatformWheelEvent(QWheelEvent*);
-        PlatformWheelEvent(QGraphicsSceneWheelEvent*);
-        void applyDelta(int delta, Qt::Orientation);
-#endif
-
 #if PLATFORM(WIN)
         PlatformWheelEvent(HWND, WPARAM, LPARAM, bool isMouseHWheel);
         PlatformWheelEvent(HWND, const FloatSize& delta, const FloatPoint& location);

Modified: trunk/Source/WebKit/qt/Api/qwebpage.cpp (107914 => 107915)


--- trunk/Source/WebKit/qt/Api/qwebpage.cpp	2012-02-16 10:28:39 UTC (rev 107914)
+++ trunk/Source/WebKit/qt/Api/qwebpage.cpp	2012-02-16 10:31:01 UTC (rev 107915)
@@ -112,6 +112,7 @@
 #endif // Q_OS_WIN32
 #include "TextIterator.h"
 #include "UtilsQt.h"
+#include "WebEventConversion.h"
 #include "WindowFeatures.h"
 #include "WorkerThread.h"
 
@@ -678,7 +679,7 @@
     if (!frame->view())
         return;
 
-    bool accepted = frame->eventHandler()->mouseMoved(PlatformMouseEvent(ev, 0));
+    bool accepted = frame->eventHandler()->mouseMoved(convertMouseEvent(ev, 0));
     ev->setAccepted(accepted);
 }
 
@@ -703,7 +704,7 @@
 
     bool accepted = false;
     adjustPointForClicking(ev);
-    PlatformMouseEvent mev(ev, 1);
+    PlatformMouseEvent mev = convertMouseEvent(ev, 1);
     // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton
     if (mev.button() != NoButton)
         accepted = frame->eventHandler()->handleMousePressEvent(mev);
@@ -726,7 +727,7 @@
         return;
 
     bool accepted = false;
-    PlatformMouseEvent mev(ev, 2);
+    PlatformMouseEvent mev = convertMouseEvent(ev, 2);
     // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton
     if (mev.button() != NoButton)
         accepted = frame->eventHandler()->handleMousePressEvent(mev);
@@ -744,7 +745,7 @@
         return;
 
     bool accepted = false;
-    PlatformMouseEvent mev(ev, 3);
+    PlatformMouseEvent mev = convertMouseEvent(ev, 3);
     // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton
     if (mev.button() != NoButton)
         accepted = frame->eventHandler()->handleMousePressEvent(mev);
@@ -783,7 +784,7 @@
 
     bool accepted = false;
     adjustPointForClicking(ev);
-    PlatformMouseEvent mev(ev, 0);
+    PlatformMouseEvent mev = convertMouseEvent(ev, 0);
     // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton
     if (mev.button() != NoButton)
         accepted = frame->eventHandler()->handleMouseReleaseEvent(mev);
@@ -853,7 +854,7 @@
     if (!frame->view())
         return;
 
-    WebCore::PlatformWheelEvent pev(ev);
+    PlatformWheelEvent pev = convertWheelEvent(ev);
     bool accepted = frame->eventHandler()->handleWheelEvent(pev);
     ev->setAccepted(accepted);
 }
@@ -3240,14 +3241,14 @@
     if (!RenderThemeQt::useMobileTheme()) {
         if (QWebFrame* webFrame = frameAt(event->pos())) {
             Frame* frame = QWebFramePrivate::core(webFrame);
-            if (Scrollbar* scrollbar = frame->view()->scrollbarAtPoint(PlatformMouseEvent(event, 1).position()))
-                return scrollbar->contextMenu(PlatformMouseEvent(event, 1));
+            if (Scrollbar* scrollbar = frame->view()->scrollbarAtPoint(convertMouseEvent(event, 1).position()))
+                return scrollbar->contextMenu(convertMouseEvent(event, 1));
         }
     }
 #endif
 
     WebCore::Frame* focusedFrame = d->page->focusController()->focusedOrMainFrame();
-    focusedFrame->eventHandler()->sendContextMenuEvent(PlatformMouseEvent(event, 1));
+    focusedFrame->eventHandler()->sendContextMenuEvent(convertMouseEvent(event, 1));
     ContextMenu *menu = d->page->contextMenuController()->contextMenu();
     // If the website defines its own handler then sendContextMenuEvent takes care of
     // calling/showing it and the context menu pointer will be zero. This is the case

Modified: trunk/Source/WebKit/qt/ChangeLog (107914 => 107915)


--- trunk/Source/WebKit/qt/ChangeLog	2012-02-16 10:28:39 UTC (rev 107914)
+++ trunk/Source/WebKit/qt/ChangeLog	2012-02-16 10:31:01 UTC (rev 107915)
@@ -1,3 +1,37 @@
+2012-02-16  Simon Hausmann  <[email protected]>
+
+        [Qt] Move event conversion functions from WebCore to WebKit
+        https://bugs.webkit.org/show_bug.cgi?id=78788
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Move QtWidgets dependent mouse event constructors out of WebCore
+        into WebKit, similar to the web event conversions of WebKit2.
+
+        * Api/qwebpage.cpp:
+        (QWebPagePrivate::mouseMoveEvent):
+        (QWebPagePrivate::mousePressEvent):
+        (QWebPagePrivate::mouseDoubleClickEvent):
+        (QWebPagePrivate::mouseTripleClickEvent):
+        (QWebPagePrivate::mouseReleaseEvent):
+        (QWebPagePrivate::wheelEvent):
+        (QWebPage::swallowContextMenuEvent):
+        * WebCoreSupport/FrameLoaderClientQt.cpp:
+        (WebCore::FrameLoaderClientQt::postProgressFinishedNotification):
+        * WebCoreSupport/WebEventConversion.cpp: Added.
+        (WebCore):
+        (WebCore::mouseEventModifiersFromQtKeyboardModifiers):
+        (WebCore::mouseEventTypeAndMouseButtonFromQEvent):
+        (WebKitPlatformMouseEvent):
+        (WebCore::WebKitPlatformMouseEvent::WebKitPlatformMouseEvent):
+        (WebCore::convertMouseEvent):
+        (WebKitPlatformWheelEvent):
+        (WebCore::WebKitPlatformWheelEvent::applyDelta):
+        (WebCore::WebKitPlatformWheelEvent::WebKitPlatformWheelEvent):
+        (WebCore::convertWheelEvent):
+        * WebCoreSupport/WebEventConversion.h: Added.
+        (WebCore):
+
 2012-02-16  Adenilson Cavalcanti  <[email protected]>
 
         [Qt][WK2] Split QWebPermissionRequest into QWebSecurityOrigin

Modified: trunk/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp (107914 => 107915)


--- trunk/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp	2012-02-16 10:28:39 UTC (rev 107914)
+++ trunk/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp	2012-02-16 10:31:01 UTC (rev 107915)
@@ -73,6 +73,7 @@
 #include "V8DOMWindow.h"
 #endif
 #include "ViewportArguments.h"
+#include "WebEventConversion.h"
 
 #include "qwebframe.h"
 #include "qwebframe_p.h"
@@ -606,7 +607,7 @@
             QPoint localPos = view->mapFromGlobal(QCursor::pos());
             if (view->rect().contains(localPos)) {
                 QMouseEvent event(QEvent::MouseMove, localPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier);
-                m_frame->eventHandler()->mouseMoved(PlatformMouseEvent(&event, 0));
+                m_frame->eventHandler()->mouseMoved(convertMouseEvent(&event, 0));
             }
         }
     }

Added: trunk/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp (0 => 107915)


--- trunk/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp	                        (rev 0)
+++ trunk/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp	2012-02-16 10:31:01 UTC (rev 107915)
@@ -0,0 +1,237 @@
+/*
+    Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+    Copyright (C) 2006 Zack Rusin <[email protected]>
+    Copyright (C) 2011 Research In Motion Limited.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "WebEventConversion.h"
+
+#include "PlatformMouseEvent.h"
+#include "PlatformWheelEvent.h"
+#include <QApplication>
+#include <QGraphicsSceneMouseEvent>
+#include <QWheelEvent>
+#include <wtf/CurrentTime.h>
+
+namespace WebCore {
+
+static void mouseEventModifiersFromQtKeyboardModifiers(Qt::KeyboardModifiers keyboardModifiers, unsigned& modifiers)
+{
+    modifiers = 0;
+    if (keyboardModifiers & Qt::ShiftModifier)
+        modifiers |= PlatformEvent::ShiftKey;
+    if (keyboardModifiers & Qt::ControlModifier)
+        modifiers |= PlatformEvent::CtrlKey;
+    if (keyboardModifiers & Qt::AltModifier)
+        modifiers |= PlatformEvent::AltKey;
+    if (keyboardModifiers & Qt::MetaModifier)
+        modifiers |= PlatformEvent::MetaKey;
+}
+
+static void mouseEventTypeAndMouseButtonFromQEvent(const QEvent* event, PlatformEvent::Type& mouseEventType, MouseButton& mouseButton)
+{
+    enum { MouseEvent, GraphicsSceneMouseEvent } frameworkMouseEventType;
+    switch (event->type()) {
+    case QEvent::MouseButtonDblClick:
+    case QEvent::MouseButtonPress:
+        frameworkMouseEventType = MouseEvent;
+        mouseEventType = PlatformEvent::MousePressed;
+        break;
+    case QEvent::MouseButtonRelease:
+        frameworkMouseEventType = MouseEvent;
+        mouseEventType = PlatformEvent::MouseReleased;
+        break;
+    case QEvent::MouseMove:
+        frameworkMouseEventType = MouseEvent;
+        mouseEventType = PlatformEvent::MouseMoved;
+        break;
+    case QEvent::GraphicsSceneMouseDoubleClick:
+    case QEvent::GraphicsSceneMousePress:
+        frameworkMouseEventType = GraphicsSceneMouseEvent;
+        mouseEventType = PlatformEvent::MousePressed;
+        break;
+    case QEvent::GraphicsSceneMouseRelease:
+        frameworkMouseEventType = GraphicsSceneMouseEvent;
+        mouseEventType = PlatformEvent::MouseReleased;
+        break;
+    case QEvent::GraphicsSceneMouseMove:
+        frameworkMouseEventType = GraphicsSceneMouseEvent;
+        mouseEventType = PlatformEvent::MouseMoved;
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+        frameworkMouseEventType = MouseEvent;
+        mouseEventType = PlatformEvent::MouseMoved;
+        break;
+    }
+
+    Qt::MouseButtons mouseButtons;
+    switch (frameworkMouseEventType) {
+    case MouseEvent: {
+        const QMouseEvent* mouseEvent = static_cast<const QMouseEvent*>(event);
+        mouseButtons = mouseEventType == PlatformEvent::MouseMoved ? mouseEvent->buttons() : mouseEvent->button();
+        break;
+    }
+    case GraphicsSceneMouseEvent: {
+        const QGraphicsSceneMouseEvent* mouseEvent = static_cast<const QGraphicsSceneMouseEvent*>(event);
+        mouseButtons = mouseEventType == PlatformEvent::MouseMoved ? mouseEvent->buttons() : mouseEvent->button();
+        break;
+    }
+    }
+
+    if (mouseButtons & Qt::LeftButton)
+        mouseButton = LeftButton;
+    else if (mouseButtons & Qt::RightButton)
+        mouseButton = RightButton;
+    else if (mouseButtons & Qt::MidButton)
+        mouseButton = MiddleButton;
+    else
+        mouseButton = NoButton;
+}
+
+class WebKitPlatformMouseEvent : public PlatformMouseEvent {
+public:
+    WebKitPlatformMouseEvent(QGraphicsSceneMouseEvent*, int clickCount);
+    WebKitPlatformMouseEvent(QInputEvent*, int clickCount);
+};
+
+WebKitPlatformMouseEvent::WebKitPlatformMouseEvent(QGraphicsSceneMouseEvent* event, int clickCount)
+{
+    m_timestamp = WTF::currentTime();
+
+    // FIXME: Why don't we handle a context menu event here as we do in PlatformMouseEvent(QInputEvent*, int)?
+    // See <https://bugs.webkit.org/show_bug.cgi?id=60728>.
+    PlatformEvent::Type type;
+    mouseEventTypeAndMouseButtonFromQEvent(event, type, m_button);
+
+    m_type = type;
+    m_position = IntPoint(event->pos().toPoint());
+    m_globalPosition = IntPoint(event->screenPos());
+
+    m_clickCount = clickCount;
+    mouseEventModifiersFromQtKeyboardModifiers(event->modifiers(), m_modifiers);
+}
+
+WebKitPlatformMouseEvent::WebKitPlatformMouseEvent(QInputEvent* event, int clickCount)
+{
+    m_timestamp = WTF::currentTime();
+
+    bool isContextMenuEvent = false;
+#ifndef QT_NO_CONTEXTMENU
+    if (event->type() == QEvent::ContextMenu) {
+        isContextMenuEvent = true;
+        m_type = PlatformEvent::MousePressed;
+        QContextMenuEvent* ce = static_cast<QContextMenuEvent*>(event);
+        m_position = IntPoint(ce->pos());
+        m_globalPosition = IntPoint(ce->globalPos());
+        m_button = RightButton;
+    }
+#endif
+    if (!isContextMenuEvent) {
+        PlatformEvent::Type type;
+        mouseEventTypeAndMouseButtonFromQEvent(event, type, m_button);
+        QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
+
+        m_type = type;
+        m_position = IntPoint(mouseEvent->pos());
+        m_globalPosition = IntPoint(mouseEvent->globalPos());
+    }
+
+    m_clickCount = clickCount;
+    mouseEventModifiersFromQtKeyboardModifiers(event->modifiers(), m_modifiers);
+}
+
+PlatformMouseEvent convertMouseEvent(QInputEvent* event, int clickCount)
+{
+    return WebKitPlatformMouseEvent(event, clickCount);
+}
+
+PlatformMouseEvent convertMouseEvent(QGraphicsSceneMouseEvent* event, int clickCount)
+{
+    return WebKitPlatformMouseEvent(event, clickCount);
+}
+
+class WebKitPlatformWheelEvent : public PlatformWheelEvent {
+public:
+    WebKitPlatformWheelEvent(QGraphicsSceneWheelEvent*);
+    WebKitPlatformWheelEvent(QWheelEvent*);
+
+private:
+    void applyDelta(int delta, Qt::Orientation);
+};
+
+void WebKitPlatformWheelEvent::applyDelta(int delta, Qt::Orientation orientation)
+{
+    // A delta that is not mod 120 indicates a device that is sending
+    // fine-resolution scroll events, so use the delta as number of wheel ticks
+    // and number of pixels to scroll.See also webkit.org/b/29601
+    bool fullTick = !(delta % 120);
+
+    if (orientation == Qt::Horizontal) {
+        m_deltaX = (fullTick) ? delta / 120.0f : delta;
+        m_deltaY = 0;
+    } else {
+        m_deltaX = 0;
+        m_deltaY = (fullTick) ? delta / 120.0f : delta;
+    }
+
+    m_wheelTicksX = m_deltaX;
+    m_wheelTicksY = m_deltaY;
+
+    // Use the same single scroll step as QTextEdit
+    // (in QTextEditPrivate::init [h,v]bar->setSingleStep)
+    static const float cDefaultQtScrollStep = 20.f;
+    m_deltaX *= (fullTick) ? QApplication::wheelScrollLines() * cDefaultQtScrollStep : 1;
+    m_deltaY *= (fullTick) ? QApplication::wheelScrollLines() * cDefaultQtScrollStep : 1;
+}
+
+WebKitPlatformWheelEvent::WebKitPlatformWheelEvent(QGraphicsSceneWheelEvent* e)
+{
+    m_timestamp = WTF::currentTime();
+    mouseEventModifiersFromQtKeyboardModifiers(e->modifiers(), &m_modifiers);
+    m_position = e->pos().toPoint();
+    m_globalPosition = e->screenPos();
+    m_granularity = ScrollByPixelWheelEvent;
+    m_directionInvertedFromDevice = false;
+    applyDelta(e->delta(), e->orientation());
+}
+
+WebKitPlatformWheelEvent::WebKitPlatformWheelEvent(QWheelEvent* e)
+{
+    m_timestamp = WTF::currentTime();
+    mouseEventModifiersFromQtKeyboardModifiers(e->modifiers(), &m_modifiers);
+    m_position = e->pos();
+    m_globalPosition = e->globalPos();
+    m_granularity = ScrollByPixelWheelEvent;
+    m_directionInvertedFromDevice = false;
+    applyDelta(e->delta(), e->orientation());
+}
+
+
+PlatformWheelEvent convertWheelEvent(QWheelEvent* event)
+{
+    return WebKitPlatformWheelEvent(event);
+}
+
+PlatformWheelEvent convertWheelEvent(QGraphicsSceneWheelEvent* event)
+{
+    return WebKitPlatformWheelEvent(event);
+}
+
+}

Added: trunk/Source/WebKit/qt/WebCoreSupport/WebEventConversion.h (0 => 107915)


--- trunk/Source/WebKit/qt/WebCoreSupport/WebEventConversion.h	                        (rev 0)
+++ trunk/Source/WebKit/qt/WebCoreSupport/WebEventConversion.h	2012-02-16 10:31:01 UTC (rev 107915)
@@ -0,0 +1,41 @@
+/*
+    Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+    Copyright (C) 2006 Zack Rusin <[email protected]>
+    Copyright (C) 2011 Research In Motion Limited.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include <qglobal.h>
+
+QT_BEGIN_NAMESPACE
+class QInputEvent;
+class QGraphicsSceneMouseEvent;
+class QWheelEvent;
+class QGraphicsSceneWheelEvent;
+QT_END_NAMESPACE
+
+namespace WebCore {
+
+class PlatformMouseEvent;
+class PlatformWheelEvent;
+
+PlatformMouseEvent convertMouseEvent(QInputEvent*, int clickCount);
+PlatformMouseEvent convertMouseEvent(QGraphicsSceneMouseEvent*, int clickCount);
+PlatformWheelEvent convertWheelEvent(QWheelEvent*);
+PlatformWheelEvent convertWheelEvent(QGraphicsSceneWheelEvent*);
+
+}

Modified: trunk/Source/api.pri (107914 => 107915)


--- trunk/Source/api.pri	2012-02-16 10:28:39 UTC (rev 107914)
+++ trunk/Source/api.pri	2012-02-16 10:31:01 UTC (rev 107915)
@@ -61,7 +61,8 @@
     $$PWD/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp \
     $$PWD/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.cpp \
     $$PWD/WebKit/qt/WebCoreSupport/TextCheckerClientQt.cpp \
-    $$PWD/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp
+    $$PWD/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp \
+    $$PWD/WebKit/qt/WebCoreSupport/WebEventConversion.cpp
 
 HEADERS += \
     $$PWD/WebKit/qt/WebCoreSupport/InitWebCoreQt.h \
@@ -77,7 +78,8 @@
     $$PWD/WebKit/qt/WebCoreSupport/PopupMenuQt.h \
     $$PWD/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h \
     $$PWD/WebKit/qt/WebCoreSupport/TextCheckerClientQt.h \
-    $$PWD/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.h
+    $$PWD/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.h \
+    $$PWD/WebKit/qt/WebCoreSupport/WebEventConversion.h
 
 INCLUDEPATH += \
     $$PWD/WebKit/qt/Api \
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to