From 1f90c16845dfda2639712354ded1121b5c999ef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Wed, 31 Oct 2018 15:30:08 +0100 Subject: Don't use Qt::Key fallback for WebKeyboardEvent.text Fixes: QTBUG-71454 Change-Id: I80a530bea69da2e8bfe0b99206f590c0ea389796 Reviewed-by: Alexandru Croitor --- src/core/web_event_factory.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index 04d4930ec..680e1a44c 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -174,14 +174,6 @@ static QString qtTextForKeyEvent(const QKeyEvent *ev, int qtKey, Qt::KeyboardMod if ((qtModifiers & Qt::ControlModifier) && keyboardDriver() == KeyboardDriver::Xkb) text.clear(); - if (!text.isEmpty() || qtKey >= Qt::Key_Escape) - return text; - - QChar ch(qtKey); - if (!(qtModifiers & Qt::ShiftModifier)) // No way to check for caps lock - ch = ch.toLower(); - - text.append(ch); return text; } @@ -1493,6 +1485,12 @@ content::NativeWebKeyboardEvent WebEventFactory::toWebKeyboardEvent(QKeyEvent *e webKitEvent.dom_key = domKeyForQtKey(qtKey); else if (!qtText.isEmpty()) webKitEvent.dom_key = ui::DomKey::FromCharacter(qtText.toUcs4().first()); + else { + QChar ch(qtKey); + if (!(qtModifiers & Qt::ShiftModifier)) // No way to check for caps lock + ch = ch.toLower(); + webKitEvent.dom_key = ui::DomKey::FromCharacter(ch.unicode()); + } // The dom_code field should contain the USB keycode of the *physical* key // that was pressed. Physical meaning independent of layout and modifiers. -- cgit v1.2.1