Skip to content

Instantly share code, notes, and snippets.

@bbandix
Created December 2, 2011 15:09
Show Gist options
  • Save bbandix/1423575 to your computer and use it in GitHub Desktop.
Save bbandix/1423575 to your computer and use it in GitHub Desktop.
timestamps for custom events
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index f187a18..0577961 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,5 +1,20 @@
2011-12-02 Andras Becsi <andras.becsi@nokia.com>
+ [Qt][WK2] Set event timestamps on custom input events
+
+ Reviewed by NOBODY (OOPS!).
+
+ Since r101791 WebEventFactoryQt uses input event timestamps for WebEvents,
+ thus set the timestamp on the custom events as well.
+
+ * UIProcess/qt/QtWebPageEventHandler.cpp:
+ (QtWebPageEventHandler::handleHoverLeaveEvent):
+ (QtWebPageEventHandler::handleHoverMoveEvent):
+ * UIProcess/qt/WebPopupMenuProxyQtDesktop.cpp:
+ (WebKit::WebPopupMenuProxyQtDesktop::showPopupMenu):
+
+2011-12-02 Andras Becsi <andras.becsi@nokia.com>
+
[Qt] [WK2] Use input event timestamps in WebEvents if available
https://bugs.webkit.org/show_bug.cgi?id=73647
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
index 19d32f4..6b1fb5d 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
@@ -192,6 +192,7 @@ bool QtWebPageEventHandler::handleHoverLeaveEvent(QHoverEvent* ev)
// To get the correct behavior of mouseout, we need to turn the Leave event of our webview into a mouse move
// to a very far region.
QHoverEvent fakeEvent(QEvent::HoverMove, QPoint(INT_MIN, INT_MIN), ev->oldPos());
+ fakeEvent.setTimestamp(ev->timestamp());
return handleHoverMoveEvent(&fakeEvent);
}
@@ -199,6 +200,7 @@ bool QtWebPageEventHandler::handleHoverMoveEvent(QHoverEvent* ev)
{
QMouseEvent me(QEvent::MouseMove, ev->pos(), Qt::NoButton, Qt::NoButton, Qt::NoModifier);
me.setAccepted(ev->isAccepted());
+ me.setTimestamp(ev->timestamp());
return handleMouseMoveEvent(&me);
}
diff --git a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQtDesktop.cpp b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQtDesktop.cpp
index 71598a0..94fda6d 100644
--- a/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQtDesktop.cpp
+++ b/Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQtDesktop.cpp
@@ -34,6 +34,7 @@
#include <QMouseEvent>
#include <QStandardItemModel>
#include "WebPopupItem.h"
+#include <wtf/CurrentTime.h>
using namespace WebCore;
@@ -68,6 +69,7 @@ void WebPopupMenuProxyQtDesktop::showPopupMenu(const IntRect& rect, WebCore::Tex
QMouseEvent event(QEvent::MouseButtonPress, QCursor::pos(), Qt::LeftButton,
Qt::LeftButton, Qt::NoModifier);
+ event.setTimestamp(static_cast<qint64>(WTF::currentTimeMS()));
QCoreApplication::sendEvent(this, &event);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment