summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Ligman <joseph.ligman@nokia.com>2009-10-09 17:31:50 +0000
committerSimon Hausmann <simon.hausmann@nokia.com>2009-10-11 22:28:47 +0200
commit3e584d5dfaa778ccaeaeb572aecbc979f5a7ef3e (patch)
tree89e57887b169c40456fba782f01caeceec59e24f
parent997ca7464c26e4ca20fa6c593e84db86afe660f1 (diff)
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-09 Joe Ligman <joseph.ligman@nokia.com> Reviewed by Simon Hausmann. [Qt] Added pure virtual methods setInputMethodEnabled and setInputMethodHint to QWebPageClient https://bugs.webkit.org/show_bug.cgi?id=30023 * platform/qt/QWebPageClient.h: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49397 268f45cc-cd09-0410-ab3c-d52691b4dbfc Signed-off-by: Simon Hausmann <simon.hausmann@nokia.com>
-rw-r--r--src/3rdparty/webkit/WebCore/ChangeLog10
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h4
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp19
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp18
-rw-r--r--src/3rdparty/webkit/WebKit/qt/ChangeLog26
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp26
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp18
7 files changed, 116 insertions, 5 deletions
diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog
index 4f7dd4f928..493a64d1e5 100644
--- a/src/3rdparty/webkit/WebCore/ChangeLog
+++ b/src/3rdparty/webkit/WebCore/ChangeLog
@@ -1,3 +1,13 @@
+2009-10-09 Joe Ligman <joseph.ligman@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Added pure virtual methods setInputMethodEnabled and setInputMethodHint to QWebPageClient
+
+ https://bugs.webkit.org/show_bug.cgi?id=30023
+
+ * platform/qt/QWebPageClient.h:
+
2009-10-07 Janne Koskinen <janne.p.koskinen@digia.com>
Reviewed by Simon Hausmann.
diff --git a/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h b/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h
index 1fc29a0268..37941ebeab 100644
--- a/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h
+++ b/src/3rdparty/webkit/WebCore/platform/qt/QWebPageClient.h
@@ -33,6 +33,10 @@ public:
virtual void scroll(int dx, int dy, const QRect&) = 0;
virtual void update(const QRect&) = 0;
+ virtual void setInputMethodEnabled(bool enable) = 0;
+#if QT_VERSION >= 0x040600
+ virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable) = 0;
+#endif
inline void resetCursor()
{
if (!cursor().bitmap() && cursor().shape() == m_lastCursor.shape())
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp
index 2a0ee20467..b11890de0c 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 882f3d75ac..b06b93a6f2 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();
diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog
index 99ddaa557c..85d0e4f782 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 5d5df97bc8..34241f0e23 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 8f9a740f0d..bdcc27ff83 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