diff options
-rw-r--r-- | Source/WebCore/platform/qt/PlatformKeyboardEventQt.cpp | 1 | ||||
-rw-r--r-- | Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/Source/WebCore/platform/qt/PlatformKeyboardEventQt.cpp b/Source/WebCore/platform/qt/PlatformKeyboardEventQt.cpp index 470612c63..fc4b726fd 100644 --- a/Source/WebCore/platform/qt/PlatformKeyboardEventQt.cpp +++ b/Source/WebCore/platform/qt/PlatformKeyboardEventQt.cpp @@ -602,6 +602,7 @@ static String keyTextForKeyEvent(const QKeyEvent* event) if (event->text().isNull()) return ASCIILiteral("\t"); break; + case Qt::Key_Return: case Qt::Key_Enter: if (event->text().isNull()) return ASCIILiteral("\r"); diff --git a/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index e5abf6b79..fe0332042 100644 --- a/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -2322,6 +2322,20 @@ void tst_QWebPage::inputMethods() inputValue2 = page->mainFrame()->evaluateJavaScript("document.getElementById('input5').value").toString(); QCOMPARE(inputValue2, QString("\n\nthird line")); + // Return Key without key text + page->mainFrame()->evaluateJavaScript("var inputEle = document.getElementById('input5'); inputEle.value = ''; inputEle.focus(); inputEle.select();"); + inputValue2 = page->mainFrame()->evaluateJavaScript("document.getElementById('input5').value").toString(); + QCOMPARE(inputValue2, QString("")); + + QKeyEvent keyReturn(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier); + page->event(&keyReturn); + page->event(&eventText); + page->event(&eventText2); + qApp->processEvents(); + + inputValue2 = page->mainFrame()->evaluateJavaScript("document.getElementById('input5').value").toString(); + QCOMPARE(inputValue2, QString("\n\nthird line")); + // END - Newline test for textarea delete container; |