From 44349923bc43665de3f3adefe817cbfd85ebd04d Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 18 Jun 2010 11:33:59 +0200 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( 85a48bdb52a81a9d18477a347fba5f6c930af416 ) Backported: * https://bugs.webkit.org/show_bug.cgi?id=37719 -- Some HTML5 Input tags not treated as needing an input method. * https://bugs.webkit.org/show_bug.cgi?id=40107 -- Impossible to set input method hints based HTML5 input types --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 32 +++++++++ .../webkit/WebCore/html/HTMLInputElement.cpp | 6 +- .../webkit/WebCore/html/HTMLInputElement.h | 4 ++ src/3rdparty/webkit/WebKit/qt/ChangeLog | 27 ++++++++ .../WebKit/qt/WebCoreSupport/EditorClientQt.cpp | 32 +++++---- .../qgraphicswebview/resources/input_types.html | 8 +++ .../qgraphicswebview/tst_qgraphicswebview.cpp | 75 ++++++++++++++++++++++ .../qgraphicswebview/tst_qgraphicswebview.qrc | 6 ++ .../qt/tests/qwebview/resources/input_types.html | 8 +++ .../WebKit/qt/tests/qwebview/tst_qwebview.cpp | 61 ++++++++++++++++++ .../WebKit/qt/tests/qwebview/tst_qwebview.qrc | 1 + 12 files changed, 248 insertions(+), 14 deletions(-) create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/resources/input_types.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/input_types.html diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index cbc163c..3595474 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - aa3f786bdba4dc153620ae7f98e4b0e41770d1d1 + 85a48bdb52a81a9d18477a347fba5f6c930af416 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index f01220e..63af196 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,35 @@ +2010-06-10 Raine Makelainen + + Reviewed by Kenneth Rohde Christiansen. + + Impossible to set input method hints based HTML5 input types + https://bugs.webkit.org/show_bug.cgi?id=40107 + + Helper methods for checking "tel", "number", "email", + and "url" input element types. + + * html/HTMLInputElement.h: + (WebCore::HTMLInputElement::isTelephoneField): + (WebCore::HTMLInputElement::isNumberField): + (WebCore::HTMLInputElement::isEmailField): + (WebCore::HTMLInputElement::isUrlField): + +2010-04-22 Ray Rischpater + + Reviewed by Darin Adler. + + In HTMLInputElement.cpp, shouldUseInputMethod does not return true for + some text input types (TELEPHONE, NUMBER, URL, and EMAIL). Addressed + this by changing shouldUseInputMethod to use internal methods to + check that the field is a text field that isn't a password field. + + No new tests. + + Fixes + + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::shouldUseInputMethod): + 2010-04-06 Abhinav Mithal Reviewed by Laszlo Gombos. diff --git a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp index 652bc40..5746281 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp @@ -347,7 +347,11 @@ void HTMLInputElement::aboutToUnload() bool HTMLInputElement::shouldUseInputMethod() const { - return m_type == TEXT || m_type == SEARCH || m_type == ISINDEX; + // The reason IME's are disabled for the password field is because IMEs + // can access the underlying password and display it in clear text -- + // e.g. you can use it to access the stored password for any site + // with only trivial effort. + return isTextField() && inputType() != PASSWORD; } void HTMLInputElement::handleFocusEvent() diff --git a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h index 0e2da32..50e9c00 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h @@ -109,6 +109,10 @@ public: virtual bool isSearchField() const { return m_type == SEARCH; } virtual bool isInputTypeHidden() const { return m_type == HIDDEN; } virtual bool isPasswordField() const { return m_type == PASSWORD; } + bool isTelephoneField() const { return m_type == TELEPHONE; } + bool isNumberField() const { return m_type == NUMBER; } + bool isEmailField() const { return m_type == EMAIL; } + bool isUrlField() const { return m_type == URL; } bool checked() const { return m_checked; } void setChecked(bool, bool sendChangeEvent = false); diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 5d37901..4d3b4d1 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,30 @@ +2010-06-10 Raine Makelainen + + Reviewed by Kenneth Rohde Christiansen. + + Impossible to set input method hints based HTML5 input types + https://bugs.webkit.org/show_bug.cgi?id=40107 + + EditorClientQt to set input method hints for "number", "tel", + "email", and "url" HTML input elements. + + Tests for HTML input elements and input method hints added for + QGraphicsWebView and QWebView. + + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::setInputMethodState): + * tests/qgraphicswebview/resources/input_types.html: Added. + * tests/qgraphicswebview/tst_qgraphicswebview.cpp: + (GraphicsWebView::GraphicsWebView): + (GraphicsWebView::fireMouseClick): + (tst_QGraphicsWebView::focusInputTypes): + * tests/qgraphicswebview/tst_qgraphicswebview.qrc: Added. + * tests/qwebview/resources/input_types.html: Added. + * tests/qwebview/tst_qwebview.cpp: + (WebView::fireMouseClick): + (tst_QWebView::focusInputTypes): + * tests/qwebview/tst_qwebview.qrc: + 2010-05-19 Denis Dzyubenko Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp index 27cc2f5..f2bfc50 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp @@ -601,20 +601,28 @@ void EditorClientQt::setInputMethodState(bool active) QWebPageClient* webPageClient = m_page->d->client; if (webPageClient) { #if QT_VERSION >= 0x040600 - bool isPasswordField = false; - if (!active) { - // Setting the Qt::WA_InputMethodEnabled attribute true and Qt::ImhHiddenText flag - // for password fields. The Qt platform is responsible for determining which widget - // will receive input method events for password fields. - Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame(); - if (frame && frame->document() && frame->document()->focusedNode()) { - if (frame->document()->focusedNode()->hasTagName(HTMLNames::inputTag)) { - HTMLInputElement* inputElement = static_cast(frame->document()->focusedNode()); - active = isPasswordField = inputElement->isPasswordField(); - } + HTMLInputElement* inputElement = 0; + Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame(); + if (frame && frame->document() && frame->document()->focusedNode()) + if (frame->document()->focusedNode()->hasTagName(HTMLNames::inputTag)) + inputElement = static_cast(frame->document()->focusedNode()); + + if (inputElement) { + if (!active) { + // Setting the Qt::WA_InputMethodEnabled attribute true and Qt::ImhHiddenText flag + // for password fields. The Qt platform is responsible for determining which widget + // will receive input method events for password fields. + active = inputElement->isPasswordField(); + webPageClient->setInputMethodHint(Qt::ImhHiddenText, active); + } else { + // Set input method hints for "number", "tel", "email", and "url" input elements. + webPageClient->setInputMethodHint(Qt::ImhDialableCharactersOnly, inputElement->isTelephoneField()); + webPageClient->setInputMethodHint(Qt::ImhDigitsOnly, inputElement->isNumberField()); + webPageClient->setInputMethodHint(Qt::ImhEmailCharactersOnly, inputElement->isEmailField()); + webPageClient->setInputMethodHint(Qt::ImhUrlCharactersOnly, inputElement->isUrlField()); } } - webPageClient->setInputMethodHint(Qt::ImhHiddenText, isPasswordField); + #if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN) // disables auto-uppercase and predictive text for mobile devices webPageClient->setInputMethodHint(Qt::ImhNoAutoUppercase, true); diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/resources/input_types.html b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/resources/input_types.html new file mode 100644 index 0000000..18ab314 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/resources/input_types.html @@ -0,0 +1,8 @@ + +
+
+
+
+
+
" + \ No newline at end of file diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp index a52e167..5efd8a5 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp @@ -19,6 +19,7 @@ #include +#include #include #include #include @@ -54,6 +55,7 @@ class tst_QGraphicsWebView : public QObject private slots: void qgraphicswebview(); void crashOnViewlessWebPages(); + void focusInputTypes(); }; void tst_QGraphicsWebView::qgraphicswebview() @@ -97,6 +99,29 @@ private slots: } }; +class GraphicsWebView : public QGraphicsWebView +{ + Q_OBJECT + +public: + GraphicsWebView(QGraphicsItem* parent = 0): QGraphicsWebView(parent) + { + } + + void fireMouseClick(QPointF point) { + QGraphicsSceneMouseEvent presEv(QEvent::GraphicsSceneMousePress); + presEv.setPos(point); + presEv.setButton(Qt::LeftButton); + presEv.setButtons(Qt::LeftButton); + QGraphicsSceneMouseEvent relEv(QEvent::GraphicsSceneMouseRelease); + relEv.setPos(point); + relEv.setButton(Qt::LeftButton); + relEv.setButtons(Qt::LeftButton); + QGraphicsWebView::sceneEvent(&presEv); + QGraphicsWebView::sceneEvent(&relEv); + } +}; + void tst_QGraphicsWebView::crashOnViewlessWebPages() { QGraphicsScene scene; @@ -125,6 +150,56 @@ void tst_QGraphicsWebView::crashOnViewlessWebPages() QVERIFY(::waitForSignal(page, SIGNAL(loadFinished(bool)))); } +void tst_QGraphicsWebView::focusInputTypes() +{ + QWebPage* page = new QWebPage; + GraphicsWebView* webView = new GraphicsWebView; + webView->setPage( page ); + QGraphicsView* view = new QGraphicsView; + QGraphicsScene* scene = new QGraphicsScene(view); + view->setScene(scene); + scene->addItem(webView); + view->setGeometry(QRect(0,0,500,500)); + QCoreApplication::processEvents(); + QUrl url("qrc:///resources/input_types.html"); + page->mainFrame()->load(url); + page->mainFrame()->setFocus(); + + QVERIFY(waitForSignal(page, SIGNAL(loadFinished(bool)))); + + // 'text' type + webView->fireMouseClick(QPointF(20.0, 10.0)); +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN) + QVERIFY(webView->inputMethodHints() & Qt::ImhNoAutoUppercase); + QVERIFY(webView->inputMethodHints() & Qt::ImhNoPredictiveText); +#else + QVERIFY(webView->inputMethodHints() == Qt::ImhNone); +#endif + + // 'password' field + webView->fireMouseClick(QPointF(20.0, 60.0)); + QVERIFY(webView->inputMethodHints() & Qt::ImhHiddenText); + + // 'tel' field + webView->fireMouseClick(QPointF(20.0, 110.0)); + QVERIFY(webView->inputMethodHints() & Qt::ImhDialableCharactersOnly); + + // 'number' field + webView->fireMouseClick(QPointF(20.0, 160.0)); + QVERIFY(webView->inputMethodHints() & Qt::ImhDigitsOnly); + + // 'email' field + webView->fireMouseClick(QPointF(20.0, 210.0)); + QVERIFY(webView->inputMethodHints() & Qt::ImhEmailCharactersOnly); + + // 'url' field + webView->fireMouseClick(QPointF(20.0, 260.0)); + QVERIFY(webView->inputMethodHints() & Qt::ImhUrlCharactersOnly); + + delete webView; + delete view; +} + QTEST_MAIN(tst_QGraphicsWebView) #include "tst_qgraphicswebview.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc new file mode 100644 index 0000000..c91bb9c --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc @@ -0,0 +1,6 @@ + + + resources/input_types.html + + + diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/input_types.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/input_types.html new file mode 100644 index 0000000..18ab314 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/input_types.html @@ -0,0 +1,8 @@ + +
+
+
+
+
+
" + \ No newline at end of file diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp index 27daf38..d466ab5 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp @@ -46,10 +46,25 @@ private slots: void reusePage_data(); void reusePage(); + void focusInputTypes(); void crashTests(); }; +class WebView : public QWebView +{ + Q_OBJECT + +public: + void fireMouseClick(QPoint point) { + QMouseEvent presEv(QEvent::MouseButtonPress, point, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); + QMouseEvent relEv(QEvent::MouseButtonRelease, point, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); + QWebView::mousePressEvent(&presEv); + QWebView::mousePressEvent(&relEv); + } + +}; + // This will be called before the first test function is executed. // It is only called once. void tst_QWebView::initTestCase() @@ -191,6 +206,52 @@ void tst_QWebView::crashTests() } +void tst_QWebView::focusInputTypes() +{ + QWebPage* page = new QWebPage; + WebView* webView = new WebView; + webView->setPage( page ); + + QCoreApplication::processEvents(); + QUrl url("qrc:///resources/input_types.html"); + page->mainFrame()->load(url); + page->mainFrame()->setFocus(); + + QVERIFY(waitForSignal(page, SIGNAL(loadFinished(bool)))); + + // 'text' type + webView->fireMouseClick(QPoint(20, 10)); +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN) + QVERIFY(webView->inputMethodHints() & Qt::ImhNoAutoUppercase); + QVERIFY(webView->inputMethodHints() & Qt::ImhNoPredictiveText); +#else + QVERIFY(webView->inputMethodHints() == Qt::ImhNone); +#endif + + // 'password' field + webView->fireMouseClick(QPoint(20, 60)); + QVERIFY(webView->inputMethodHints() & Qt::ImhHiddenText); + + // 'tel' field + webView->fireMouseClick(QPoint(20, 110)); + QVERIFY(webView->inputMethodHints() & Qt::ImhDialableCharactersOnly); + + // 'number' field + webView->fireMouseClick(QPoint(20, 160)); + QVERIFY(webView->inputMethodHints() & Qt::ImhDigitsOnly); + + // 'email' field + webView->fireMouseClick(QPoint(20, 210)); + QVERIFY(webView->inputMethodHints() & Qt::ImhEmailCharactersOnly); + + // 'url' field + webView->fireMouseClick(QPoint(20, 260)); + QVERIFY(webView->inputMethodHints() & Qt::ImhUrlCharactersOnly); + + delete webView; + +} + QTEST_MAIN(tst_QWebView) #include "tst_qwebview.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc index ede34a9..5d71550 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc @@ -2,6 +2,7 @@ data/index.html data/frame_a.html + resources/input_types.html -- cgit v0.12