Diff
Modified: trunk/Source/WebKit2/ChangeLog (104822 => 104823)
--- trunk/Source/WebKit2/ChangeLog 2012-01-12 14:44:06 UTC (rev 104822)
+++ trunk/Source/WebKit2/ChangeLog 2012-01-12 14:52:57 UTC (rev 104823)
@@ -1,3 +1,22 @@
+2012-01-12 Kenneth Rohde Christiansen <kenn...@webkit.org>
+
+ [Qt] Set the input method hints on the QtQuick item
+ https://bugs.webkit.org/show_bug.cgi?id=76169
+
+ Reviewed by Simon Hausmann.
+
+ Set the input method hints given the HTMLElement type and state.
+
+ * Shared/EditorState.cpp:
+ (WebKit::EditorState::encode):
+ (WebKit::EditorState::decode):
+ * Shared/EditorState.h:
+ (WebKit::EditorState::EditorState):
+ * UIProcess/qt/QtWebPageEventHandler.cpp:
+ (QtWebPageEventHandler::updateTextInputState):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::editorState):
+
2012-01-12 Eunmi Lee <eunmi15....@samsung.com>
[EFL][WK2] Update and show ewk_view with updated webpage.
Modified: trunk/Source/WebKit2/Shared/EditorState.cpp (104822 => 104823)
--- trunk/Source/WebKit2/Shared/EditorState.cpp 2012-01-12 14:44:06 UTC (rev 104822)
+++ trunk/Source/WebKit2/Shared/EditorState.cpp 2012-01-12 14:52:57 UTC (rev 104823)
@@ -47,6 +47,7 @@
encoder->encode(editorRect);
encoder->encode(cursorRect);
encoder->encode(compositionRect);
+ encoder->encode(inputMethodHints);
encoder->encode(selectedText);
encoder->encode(surroundingText);
#endif
@@ -91,6 +92,9 @@
if (!decoder->decode(result.compositionRect))
return false;
+ if (!decoder->decode(result.inputMethodHints))
+ return false;
+
if (!decoder->decode(result.selectedText))
return false;
Modified: trunk/Source/WebKit2/Shared/EditorState.h (104822 => 104823)
--- trunk/Source/WebKit2/Shared/EditorState.h 2012-01-12 14:44:06 UTC (rev 104822)
+++ trunk/Source/WebKit2/Shared/EditorState.h 2012-01-12 14:52:57 UTC (rev 104823)
@@ -45,6 +45,7 @@
#if PLATFORM(QT)
, cursorPosition(0)
, anchorPosition(0)
+ , inputMethodHints(0)
#endif
{
}
@@ -66,6 +67,9 @@
WebCore::IntRect editorRect;
WebCore::IntRect cursorRect;
WebCore::IntRect compositionRect;
+
+ uint64_t inputMethodHints;
+
WTF::String selectedText;
WTF::String surroundingText;
#endif
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp (104822 => 104823)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp 2012-01-12 14:44:06 UTC (rev 104822)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp 2012-01-12 14:52:57 UTC (rev 104823)
@@ -30,9 +30,9 @@
#include <QtQuick/QSGGeometryNode>
#include <QtQuick/QSGMaterial>
-QQuickWebPage::QQuickWebPage(QQuickItem* parent)
- : QQuickItem(parent)
- , d(new QQuickWebPagePrivate(this))
+QQuickWebPage::QQuickWebPage(QQuickWebView* viewportItem)
+ : QQuickItem(viewportItem)
+ , d(new QQuickWebPagePrivate(this, viewportItem))
{
setFlag(ItemHasContents);
@@ -62,8 +62,9 @@
d->setDrawingAreaSize(newGeometry.size().toSize());
}
-QQuickWebPagePrivate::QQuickWebPagePrivate(QQuickWebPage* q)
+QQuickWebPagePrivate::QQuickWebPagePrivate(QQuickWebPage* q, QQuickWebView* viewportItem)
: q(q)
+ , viewportItem(viewportItem)
, webPageProxy(0)
, sgUpdateQueue(q)
, paintingIsInitialized(false)
@@ -76,7 +77,7 @@
void QQuickWebPagePrivate::initialize(WebKit::WebPageProxy* webPageProxy)
{
this->webPageProxy = webPageProxy;
- eventHandler.reset(new QtWebPageEventHandler(toAPI(webPageProxy), q));
+ eventHandler.reset(new QtWebPageEventHandler(toAPI(webPageProxy), q, viewportItem));
}
static float computeEffectiveOpacity(const QQuickItem* item)
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h (104822 => 104823)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h 2012-01-12 14:44:06 UTC (rev 104822)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h 2012-01-12 14:52:57 UTC (rev 104823)
@@ -27,6 +27,7 @@
#include <QtQuick/QQuickItem>
class QQuickWebPagePrivate;
+class QQuickWebView;
class QtWebPageEventHandler;
class QWebPreferences;
@@ -37,7 +38,7 @@
class QWEBKIT_EXPORT QQuickWebPage : public QQuickItem {
Q_OBJECT
public:
- QQuickWebPage(QQuickItem* parent = 0);
+ QQuickWebPage(QQuickWebView* view = 0);
virtual ~QQuickWebPage();
void setContentSize(const QSizeF& size);
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h (104822 => 104823)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h 2012-01-12 14:44:06 UTC (rev 104822)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h 2012-01-12 14:52:57 UTC (rev 104823)
@@ -34,7 +34,7 @@
class QQuickWebPagePrivate {
public:
- QQuickWebPagePrivate(QQuickWebPage* q);
+ QQuickWebPagePrivate(QQuickWebPage* q, QQuickWebView* viewportItem);
~QQuickWebPagePrivate();
void initialize(WebKit::WebPageProxy*);
@@ -47,6 +47,7 @@
QScopedPointer<QtWebPageEventHandler> eventHandler;
QQuickWebPage* const q;
+ QQuickWebView* const viewportItem;
WebKit::WebPageProxy* webPageProxy;
WebKit::QtSGUpdateQueue sgUpdateQueue;
bool paintingIsInitialized;
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp (104822 => 104823)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp 2012-01-12 14:44:06 UTC (rev 104822)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp 2012-01-12 14:52:57 UTC (rev 104823)
@@ -26,6 +26,7 @@
#include "NativeWebWheelEvent.h"
#include "QtViewportInteractionEngine.h"
#include "qquickwebpage_p.h"
+#include "qquickwebview_p.h"
#include <QDrag>
#include <QGraphicsSceneMouseEvent>
#include <QGuiApplication>
@@ -84,12 +85,13 @@
return (DragOperation)result;
}
-QtWebPageEventHandler::QtWebPageEventHandler(WKPageRef pageRef, QQuickWebPage* qmlWebPage)
+QtWebPageEventHandler::QtWebPageEventHandler(WKPageRef pageRef, QQuickWebPage* qmlWebPage, QQuickWebView* qmlWebView)
: m_webPageProxy(toImpl(pageRef))
, m_panGestureRecognizer(this)
, m_pinchGestureRecognizer(this)
, m_tapGestureRecognizer(this)
, m_webPage(qmlWebPage)
+ , m_webView(qmlWebView)
, m_previousClickButton(Qt::NoButton)
, m_clickCount(0)
, m_postponeTextInputStateChanged(false)
@@ -436,6 +438,8 @@
const EditorState& editor = m_webPageProxy->editorState();
+ m_webView->setInputMethodHints(Qt::InputMethodHints(editor.inputMethodHints));
+
// Ignore input method requests not due to a tap gesture.
if (!editor.isContentEditable)
setInputPanelVisible(false);
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h (104822 => 104823)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h 2012-01-12 14:44:06 UTC (rev 104822)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h 2012-01-12 14:52:57 UTC (rev 104823)
@@ -40,7 +40,7 @@
Q_OBJECT
public:
- QtWebPageEventHandler(WKPageRef, QQuickWebPage*);
+ QtWebPageEventHandler(WKPageRef, QQuickWebPage*, QQuickWebView*);
~QtWebPageEventHandler();
bool handleEvent(QEvent*);
@@ -68,6 +68,7 @@
QtPinchGestureRecognizer m_pinchGestureRecognizer;
QtTapGestureRecognizer m_tapGestureRecognizer;
QQuickWebPage* m_webPage;
+ QQuickWebView* m_webView;
private:
bool handleKeyPressEvent(QKeyEvent*);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (104822 => 104823)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2012-01-12 14:44:06 UTC (rev 104822)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2012-01-12 14:52:57 UTC (rev 104823)
@@ -90,6 +90,7 @@
#include <WebCore/FrameLoaderTypes.h>
#include <WebCore/FrameView.h>
#include <WebCore/HTMLFormElement.h>
+#include <WebCore/HTMLInputElement.h>
#include <WebCore/HistoryItem.h>
#include <WebCore/KeyboardEvent.h>
#include <WebCore/MouseEvent.h>
@@ -398,6 +399,29 @@
if (!scope)
return result;
+ if (scope->hasTagName(HTMLNames::inputTag)) {
+ HTMLInputElement* input = static_cast<HTMLInputElement*>(scope);
+ if (input->isTelephoneField())
+ result.inputMethodHints |= Qt::ImhDialableCharactersOnly;
+ else if (input->isNumberField())
+ result.inputMethodHints |= Qt::ImhDigitsOnly;
+ else if (input->isEmailField()) {
+ result.inputMethodHints |= Qt::ImhEmailCharactersOnly;
+ result.inputMethodHints |= Qt::ImhNoAutoUppercase;
+ } else if (input->isURLField()) {
+ result.inputMethodHints |= Qt::ImhUrlCharactersOnly;
+ result.inputMethodHints |= Qt::ImhNoAutoUppercase;
+ } else if (input->isPasswordField()) {
+ // Set ImhHiddenText flag for password fields. The Qt platform
+ // is responsible for determining which widget will receive input
+ // method events for password fields.
+ result.inputMethodHints |= Qt::ImhHiddenText;
+ result.inputMethodHints |= Qt::ImhNoAutoUppercase;
+ result.inputMethodHints |= Qt::ImhNoPredictiveText;
+ result.inputMethodHints |= Qt::ImhSensitiveData;
+ }
+ }
+
if (selectionRoot)
result.editorRect = frame->view()->contentsToWindow(selectionRoot->getRect());