summaryrefslogtreecommitdiffstats
path: root/src/core/render_widget_host_view_qt.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-08-31 14:37:56 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-09-22 08:47:28 +0000
commit75fcb640fae72446b26d7978a5df3c058e0ab67f (patch)
tree3467a5d3eb1f31337b81ab8976a07cac0e694541 /src/core/render_widget_host_view_qt.cpp
parent06e3d201299ab803f4dc41f35201830c74242d19 (diff)
Adapt to forced scroll-wheel latching
Handle that Chromium now requires all wheel events to be phases despite them not being phased on the majority of platforms. Change-Id: Iabd5630652c0d8fd67563db3d63ef1f2f528c35c Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'src/core/render_widget_host_view_qt.cpp')
-rw-r--r--src/core/render_widget_host_view_qt.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index 15881674c..737f42439 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -332,6 +332,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost *widget
, m_cursorPosition(0)
, m_emptyPreviousSelection(true)
, m_wheelAckPending(false)
+ , m_mouseWheelPhaseHandler(this)
{
host()->SetView(this);
#ifndef QT_NO_ACCESSIBILITY
@@ -1421,8 +1422,10 @@ void RenderWidgetHostViewQt::handleWheelEvent(QWheelEvent *ev)
{
if (!m_wheelAckPending) {
Q_ASSERT(m_pendingWheelEvents.isEmpty());
- m_wheelAckPending = true;
- host()->ForwardWheelEvent(WebEventFactory::toWebWheelEvent(ev, dpiScale()));
+ blink::WebMouseWheelEvent webEvent = WebEventFactory::toWebWheelEvent(ev, dpiScale());
+ m_wheelAckPending = (webEvent.phase != blink::WebMouseWheelEvent::kPhaseEnded);
+ m_mouseWheelPhaseHandler.AddPhaseIfNeededAndScheduleEndEvent(webEvent, false);
+ host()->ForwardWheelEvent(webEvent);
return;
}
if (!m_pendingWheelEvents.isEmpty()) {
@@ -1433,16 +1436,26 @@ void RenderWidgetHostViewQt::handleWheelEvent(QWheelEvent *ev)
m_pendingWheelEvents.append(WebEventFactory::toWebWheelEvent(ev, dpiScale()));
}
-void RenderWidgetHostViewQt::WheelEventAck(const blink::WebMouseWheelEvent &/*event*/, content::InputEventAckState /*ack_result*/)
+void RenderWidgetHostViewQt::WheelEventAck(const blink::WebMouseWheelEvent &event, content::InputEventAckState /*ack_result*/)
{
+ if (event.phase == blink::WebMouseWheelEvent::kPhaseEnded)
+ return;
+ Q_ASSERT(m_wheelAckPending);
m_wheelAckPending = false;
- if (!m_pendingWheelEvents.isEmpty()) {
- m_wheelAckPending = true;
- host()->ForwardWheelEvent(m_pendingWheelEvents.takeFirst());
+ while (!m_pendingWheelEvents.isEmpty() && !m_wheelAckPending) {
+ blink::WebMouseWheelEvent webEvent = m_pendingWheelEvents.takeFirst();
+ m_wheelAckPending = (webEvent.phase != blink::WebMouseWheelEvent::kPhaseEnded);
+ m_mouseWheelPhaseHandler.AddPhaseIfNeededAndScheduleEndEvent(webEvent, false);
+ host()->ForwardWheelEvent(webEvent);
}
// TODO: We could forward unhandled wheelevents to our parent.
}
+content::MouseWheelPhaseHandler *RenderWidgetHostViewQt::GetMouseWheelPhaseHandler()
+{
+ return &m_mouseWheelPhaseHandler;
+}
+
void RenderWidgetHostViewQt::clearPreviousTouchMotionState()
{
m_previousTouchPoints.clear();