Changeset 82238 in webkit


Ignore:
Timestamp:
Mar 29, 2011 6:04:25 AM (13 years ago)
Author:
alexis.menard@openbossa.org
Message:

2011-03-29 Janne Koskinen <janne.p.koskinen@digia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Enterkey to go to Newline does not work in the text area(in HTML form)
https://bugs.webkit.org/show_bug.cgi?id=33179

Fixed newline generation from Qt::Key_Enter when editting text area using InputMethods.

  • WebCoreSupport/EditorClientQt.cpp: (WebCore::EditorClientQt::handleInputMethodKeydown):
  • tests/qwebpage/tst_qwebpage.cpp: (tst_QWebPage::inputMethods):
Location:
trunk/Source/WebKit/qt
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/qt/ChangeLog

    r82235 r82238  
     12011-03-29  Janne Koskinen  <janne.p.koskinen@digia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Enterkey to go to Newline does not work in the text area(in HTML form)
     6        https://bugs.webkit.org/show_bug.cgi?id=33179
     7
     8        Fixed newline generation from Qt::Key_Enter when editting text area using InputMethods.
     9
     10        * WebCoreSupport/EditorClientQt.cpp:
     11        (WebCore::EditorClientQt::handleInputMethodKeydown):
     12        * tests/qwebpage/tst_qwebpage.cpp:
     13        (tst_QWebPage::inputMethods):
     14
    1152011-03-29  Andreas Kling  <kling@webkit.org>
    216
  • trunk/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp

    r82059 r82238  
    531531}
    532532
    533 void EditorClientQt::handleInputMethodKeydown(KeyboardEvent*)
    534 {
     533void EditorClientQt::handleInputMethodKeydown(KeyboardEvent* event)
     534{
     535    const PlatformKeyboardEvent* kevent = event->keyEvent();
     536    if (kevent->type() == PlatformKeyboardEvent::RawKeyDown) {
     537        QWebPage::WebAction action = QWebPagePrivate::editorActionForKeyEvent(kevent->qtEvent());
     538        switch (action) {
     539        case QWebPage::InsertParagraphSeparator:
     540        case QWebPage::InsertLineSeparator:
     541            m_page->triggerAction(action);
     542            break;
     543        default:
     544            break;
     545        }
     546    }
    535547}
    536548
  • trunk/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp

    r82142 r82238  
    21242124
    21252125    QVERIFY(!viewEventSpy.contains(QEvent::RequestSoftwareInputPanel));
     2126
     2127    // START - Newline test for textarea
     2128    qApp->processEvents();
     2129    page->mainFrame()->setHtml("<html><body>" \
     2130                                            "<textarea rows='5' cols='1' id='input5' value=''/>" \
     2131                                            "</body></html>");
     2132    page->mainFrame()->evaluateJavaScript("var inputEle = document.getElementById('input5'); inputEle.focus(); inputEle.select();");
     2133    QKeyEvent keyEnter(QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier);
     2134    page->event(&keyEnter);
     2135    QList<QInputMethodEvent::Attribute> attribs;
     2136
     2137    QInputMethodEvent eventText("\n", attribs);
     2138    page->event(&eventText);
     2139
     2140    QInputMethodEvent eventText2("third line", attribs);
     2141    page->event(&eventText2);
     2142    qApp->processEvents();
     2143
     2144    QString inputValue2 = page->mainFrame()->evaluateJavaScript("document.getElementById('input5').value").toString();
     2145    QCOMPARE(inputValue2, QString("\n\nthird line"));
     2146    // END - Newline test for textarea
     2147
    21262148    delete container;
    21272149}
Note: See TracChangeset for help on using the changeset viewer.