summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJüri Valdmann <juri.valdmann@qt.io>2019-10-28 16:37:42 +0100
committerJüri Valdmann <juri.valdmann@qt.io>2019-10-30 09:57:12 +0100
commit24bb272ac83fe42ad4cab58a9e97bdf2a53d2be8 (patch)
tree9f96f8310224dc0d97c34d6a3479587f1b34b474
parent196a8061a4f00a6df6b160f6859eaa199e7e2e3c (diff)
Fix handling of autorepeating KeyRelease events
A regression in 5.10 has resulted in the web events generated for autorepeating keys not conforming to the spec. Restore the correct behavior from 5.9. Fixes: QTBUG-77208 Change-Id: Ia2f07fd4a8ee78c4599b36aceb235c245a49d566 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
-rw-r--r--src/core/render_widget_host_view_qt.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index e86f05d60..e721cba3b 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -1311,6 +1311,14 @@ void RenderWidgetHostViewQt::handleKeyEvent(QKeyEvent *ev)
}
}
+ // Ignore autorepeating KeyRelease events so that the generated web events
+ // conform to the spec, which requires autorepeat to result in a sequence of
+ // keypress events and only one final keyup event:
+ // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Auto-repeat_handling
+ // https://w3c.github.io/uievents/#dom-keyboardevent-repeat
+ if (ev->type() == QEvent::KeyRelease && ev->isAutoRepeat())
+ return;
+
content::NativeWebKeyboardEvent webEvent = WebEventFactory::toWebKeyboardEvent(ev);
if (webEvent.GetType() == blink::WebInputEvent::kRawKeyDown && !m_editCommand.empty()) {
ui::LatencyInfo latency;