summaryrefslogtreecommitdiffstats
path: root/src/core/web_event_factory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/web_event_factory.cpp')
-rw-r--r--src/core/web_event_factory.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp
index 8c997335c..3193f885a 100644
--- a/src/core/web_event_factory.cpp
+++ b/src/core/web_event_factory.cpp
@@ -1019,12 +1019,14 @@ static ui::DomKey getDomKeyFromQKeyEvent(QKeyEvent *ev)
}
}
-static inline double currentTimeForEvent(const QInputEvent* event)
+static inline double currentTimeForEvent(const QEvent *event)
{
Q_ASSERT(event);
- if (event->timestamp())
- return static_cast<double>(event->timestamp()) / 1000;
+ if (const QInputEvent *inputEvent = static_cast<const QInputEvent *>(event)) {
+ if (inputEvent->timestamp())
+ return static_cast<double>(inputEvent->timestamp()) / 1000;
+ }
static QElapsedTimer timer;
if (!timer.isValid())
@@ -1190,6 +1192,7 @@ WebMouseEvent WebEventFactory::toWebMouseEvent(QMouseEvent *ev, double dpiScale)
webKitEvent.button = mouseButtonForEvent(ev);
webKitEvent.click_count = 0;
+ webKitEvent.pointer_type = WebPointerProperties::PointerType::kMouse;
return webKitEvent;
}
@@ -1204,7 +1207,18 @@ WebMouseEvent WebEventFactory::toWebMouseEvent(QHoverEvent *ev, double dpiScale)
webKitEvent.SetPositionInWidget(ev->pos().x() / dpiScale, ev->pos().y() / dpiScale);
webKitEvent.movement_x = ev->pos().x() - ev->oldPos().x();
webKitEvent.movement_y = ev->pos().y() - ev->oldPos().y();
+ webKitEvent.pointer_type = WebPointerProperties::PointerType::kMouse;
+
+ return webKitEvent;
+}
+WebMouseEvent WebEventFactory::toWebMouseEvent(QEvent *ev)
+{
+ Q_ASSERT(ev->type() == QEvent::Leave || ev->type() == QEvent::HoverLeave);
+
+ WebMouseEvent webKitEvent;
+ webKitEvent.SetTimeStampSeconds(currentTimeForEvent(ev));
+ webKitEvent.SetType(WebInputEvent::kMouseLeave);
return webKitEvent;
}