diff options
author | Gunnar Sletta <gunnar@trolltech.com> | 2009-10-19 04:58:20 (GMT) |
---|---|---|
committer | Gunnar Sletta <gunnar@trolltech.com> | 2009-10-19 04:58:20 (GMT) |
commit | 91e133d9eeba0b7ea87a3ddb3f10d2a2b345473d (patch) | |
tree | 499f3a3e0ba67c76da18a33fd331569670578a79 /src/3rdparty/webkit/WebKit | |
parent | 4a0e3170c779a6a37954c3dfcfd0b9f0ce144701 (diff) | |
parent | c3bab81d5966c9bd3a42d9c5cbb9d8ad35a1b330 (diff) | |
download | Qt-91e133d9eeba0b7ea87a3ddb3f10d2a2b345473d.zip Qt-91e133d9eeba0b7ea87a3ddb3f10d2a2b345473d.tar.gz Qt-91e133d9eeba0b7ea87a3ddb3f10d2a2b345473d.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'src/3rdparty/webkit/WebKit')
5 files changed, 103 insertions, 6 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp index 2a0ee20..b11890d 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp @@ -44,6 +44,10 @@ public: virtual void scroll(int dx, int dy, const QRect&); virtual void update(const QRect& dirtyRect); + virtual void setInputMethodEnabled(bool enable); +#if QT_VERSION >= 0x040600 + virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable); +#endif virtual QCursor cursor() const; virtual void updateCursor(const QCursor& cursor); @@ -95,6 +99,21 @@ void QGraphicsWebViewPrivate::update(const QRect & dirtyRect) q->update(QRectF(dirtyRect)); } +void QGraphicsWebViewPrivate::setInputMethodEnabled(bool enable) +{ + q->setAttribute(Qt::WA_InputMethodEnabled, enable); +} + +#if QT_VERSION >= 0x040600 +void QGraphicsWebViewPrivate::setInputMethodHint(Qt::InputMethodHint hint, bool enable) +{ + if (enable) + q->setInputMethodHints(q->inputMethodHints() | hint); + else + q->setInputMethodHints(q->inputMethodHints() & ~hint); +} +#endif + QCursor QGraphicsWebViewPrivate::cursor() const { return q->cursor(); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index 882f3d7..41067f1 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -47,6 +47,10 @@ public: virtual void scroll(int dx, int dy, const QRect&); virtual void update(const QRect& dirtyRect); + virtual void setInputMethodEnabled(bool enable); +#if QT_VERSION >= 0x040600 + virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable); +#endif virtual QCursor cursor() const; virtual void updateCursor(const QCursor& cursor); @@ -72,6 +76,20 @@ void QWebViewPrivate::update(const QRect & dirtyRect) view->update(dirtyRect); } +void QWebViewPrivate::setInputMethodEnabled(bool enable) +{ + view->setAttribute(Qt::WA_InputMethodEnabled, enable); +} +#if QT_VERSION >= 0x040600 +void QWebViewPrivate::setInputMethodHint(Qt::InputMethodHint hint, bool enable) +{ + if (enable) + view->setInputMethodHints(view->inputMethodHints() | hint); + else + view->setInputMethodHints(view->inputMethodHints() & ~hint); +} +#endif + QCursor QWebViewPrivate::cursor() const { return view->cursor(); @@ -119,7 +137,7 @@ void QWebViewPrivate::_q_pageDestroyed() It can be used in various applications to display web content live from the Internet. - The image below shows QWebView previewed in \QD with the Trolltech website. + The image below shows QWebView previewed in \QD with a Nokia website. \image qwebview-url.png diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 99ddaa5..85d0e4f 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,29 @@ +2009-10-09 Joe Ligman <joseph.ligman@nokia.com> + + Reviewed by Simon Hausmann. + + Sets Qt::WA_InputMethodEnabled and Qt::ImhHiddenText for password fields in EditorClientQt + setInputMethodState. This change is needed so widgets such as the s60 software + input panel can receive input method events for password fields. + It's up to the Qt platform to determine which widget will receive input method + events when these flags are set. + Also added implementation for setInputMethodEnabled and setInputMethodHint + to QGraphicsWebViewPrivate and QWebViewPrivate. This change removes the direct + dependency on QWebView and uses QWebPageClient. + Added autotest to tst_qwebpage.cpp + https://bugs.webkit.org/show_bug.cgi?id=30023 + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::setInputMethodEnabled): + (QGraphicsWebViewPrivate::setInputMethodHint): + * Api/qwebview.cpp: + (QWebViewPrivate::setInputMethodEnabled): + (QWebViewPrivate::setInputMethodHint): + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::setInputMethodState): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::inputMethods): + 2009-10-06 Janne Koskinen <janne.p.koskinen@digia.com> Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp index 5d5df97..34241f0 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp @@ -41,6 +41,7 @@ #include "FocusController.h" #include "Frame.h" #include "HTMLElement.h" +#include "HTMLInputElement.h" #include "HTMLNames.h" #include "KeyboardCodes.h" #include "KeyboardEvent.h" @@ -48,6 +49,7 @@ #include "Page.h" #include "Page.h" #include "PlatformKeyboardEvent.h" +#include "QWebPageClient.h" #include "Range.h" #include <stdio.h> @@ -596,10 +598,26 @@ bool EditorClientQt::isEditing() const void EditorClientQt::setInputMethodState(bool active) { - QWidget *view = m_page->view(); - if (view) - view->setAttribute(Qt::WA_InputMethodEnabled, 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<HTMLInputElement*>(frame->document()->focusedNode()); + active = isPasswordField = inputElement->isPasswordField(); + } + } + } + webPageClient->setInputMethodHint(Qt::ImhHiddenText, isPasswordField); +#endif + webPageClient->setInputMethodEnabled(active); + } emit m_page->microFocusChanged(); } diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 8f9a740..bdcc27f 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -1208,7 +1208,8 @@ void tst_QWebPage::frameAt() void tst_QWebPage::inputMethods() { m_view->page()->mainFrame()->setHtml("<html><body>" \ - "<input type='text' id='input1' style='font-family: serif' value='' maxlength='20'/>" \ + "<input type='text' id='input1' style='font-family: serif' value='' maxlength='20'/><br>" \ + "<input type='password'/>" \ "</body></html>"); m_view->page()->mainFrame()->setFocus(); @@ -1291,6 +1292,21 @@ void tst_QWebPage::inputMethods() value = variant.value<QString>(); QCOMPARE(value, QString("QtWebKit")); #endif + + //ImhHiddenText + QMouseEvent evpresPassword(QEvent::MouseButtonPress, inputs.at(1).geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier); + m_view->page()->event(&evpresPassword); + QMouseEvent evrelPassword(QEvent::MouseButtonRelease, inputs.at(1).geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier); + m_view->page()->event(&evrelPassword); + + QVERIFY(m_view->testAttribute(Qt::WA_InputMethodEnabled)); +#if QT_VERSION >= 0x040600 + QVERIFY(m_view->inputMethodHints() & Qt::ImhHiddenText); + + m_view->page()->event(&evpres); + m_view->page()->event(&evrel); + QVERIFY(!(m_view->inputMethodHints() & Qt::ImhHiddenText)); +#endif } // import a little DRT helper function to trigger the garbage collector |