summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2023-01-10 09:44:27 +0100
committerPeter Varga <pvarga@inf.u-szeged.hu>2023-01-12 08:04:35 +0000
commitc69b00df8513237dc5a14f399eeb9b6d624d84f3 (patch)
tree56a1e316138f6782d56c3cf015906fc651923af4
parentc105706beae51fd785275206061b9fe1303658ed (diff)
Avoid scaling mouse movement properties on High DPI screens
ui::TranslateAndScaleWebInputEvent() scales movementX/Y if the input event is not raw. It is not exactly clear what is the expected behavior and browsers handle movementX/Y scaling differently. W3C states that currentEvent.movementX = currentEvent.screenX - previousEvent.screenX which is not true with scaling. This is a workaround for https://crbug.com/907309 This fixes tst_QWebEnginePage::mouseMovementProperties auto test with QT_SCALE_FACTOR=2. Pick-to: 6.5 Change-Id: I6d1fd591ec2bbeb22c448772c367b59509244491 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--src/core/render_widget_host_view_qt_delegate_client.cpp1
-rw-r--r--src/core/web_event_factory.cpp1
2 files changed, 2 insertions, 0 deletions
diff --git a/src/core/render_widget_host_view_qt_delegate_client.cpp b/src/core/render_widget_host_view_qt_delegate_client.cpp
index 7078b82f8..1b30e9953 100644
--- a/src/core/render_widget_host_view_qt_delegate_client.cpp
+++ b/src/core/render_widget_host_view_qt_delegate_client.cpp
@@ -410,6 +410,7 @@ void RenderWidgetHostViewQtDelegateClient::handlePointerEvent(T *event)
webEvent.movement_x = event->globalPosition().x() - m_previousMousePosition.x();
webEvent.movement_y = event->globalPosition().y() - m_previousMousePosition.y();
+ webEvent.is_raw_movement_event = true;
if (m_rwhv->IsMouseLocked())
QCursor::setPos(m_previousMousePosition);
diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp
index 007492843..508a4b557 100644
--- a/src/core/web_event_factory.cpp
+++ b/src/core/web_event_factory.cpp
@@ -1444,6 +1444,7 @@ WebMouseEvent WebEventFactory::toWebMouseEvent(QHoverEvent *ev)
webKitEvent.SetPositionInWidget(ev->position().x(), ev->position().y());
webKitEvent.movement_x = ev->position().x() - ev->oldPos().x();
webKitEvent.movement_y = ev->position().y() - ev->oldPos().y();
+ webKitEvent.is_raw_movement_event = true;
webKitEvent.pointer_type = WebPointerProperties::PointerType::kMouse;
return webKitEvent;