[Qt] Handle Return key without key text
authorallan.jensen@digia.com <allan.jensen@digia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Jun 2013 11:55:52 +0000 (11:55 +0000)
committerallan.jensen@digia.com <allan.jensen@digia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Jun 2013 11:55:52 +0000 (11:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=117239

Reviewed by Andreas Kling.

Source/WebCore:

Test added to tst_qwebpage.cpp.

* platform/qt/PlatformKeyboardEventQt.cpp:
(WebCore::keyTextForKeyEvent):

Source/WebKit/qt:

Test for QKeyEvent(Return_Key) without key text.

* tests/qwebpage/tst_qwebpage.cpp:
(tst_QWebPage::inputMethods):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@151213 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp

index ef1f585..2842503 100644 (file)
@@ -1,3 +1,15 @@
+2013-06-05  Allan Sandfeld Jensen  <allan.jensen@digia.com>
+
+        [Qt] Handle Return key without key text
+        https://bugs.webkit.org/show_bug.cgi?id=117239
+
+        Reviewed by Andreas Kling.
+
+        Test added to tst_qwebpage.cpp.
+
+        * platform/qt/PlatformKeyboardEventQt.cpp:
+        (WebCore::keyTextForKeyEvent):
+
 2013-06-05  Gwang Yoon Hwang  <ryumiel@company100.net>
 
         Coordinated Graphics: Unify messages related object's lifecycles into CoordinatedGraphicsState.
index 5123a8d..af2297a 100644 (file)
@@ -587,6 +587,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");
index 4f366a7..0039df6 100644 (file)
@@ -1,3 +1,15 @@
+2013-06-05  Allan Sandfeld Jensen  <allan.jensen@digia.com>
+
+        [Qt] Handle Return key without key text
+        https://bugs.webkit.org/show_bug.cgi?id=117239
+
+        Reviewed by Andreas Kling.
+
+        Test for QKeyEvent(Return_Key) without key text.
+
+        * tests/qwebpage/tst_qwebpage.cpp:
+        (tst_QWebPage::inputMethods):
+
 2013-06-03  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r151109.
index e430898..96c2a65 100644 (file)
@@ -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;