Title: [136126] trunk/Source/WebKit2
Revision
136126
Author
michael.brun...@digia.com
Date
2012-11-29 06:17:30 -0800 (Thu, 29 Nov 2012)

Log Message

[Qt][WK2] Commit the preedit string in the input method when focus is about to be moved.
https://bugs.webkit.org/show_bug.cgi?id=97774

Reviewed by Kenneth Rohde Christiansen.

Implements the handler for willSetInputMethodState in WebKit2 in Qt.
This is needed to tell the input method instance in Qt to commit its
preedit content when the focus has moved to another node to prevent a
bug where the old preedit string was kept as the preedit string and
the editor moved focus back to the old node when continuing to enter
text via the input method.

This behavior is analog to the behavior of the QtQuick text input
elements.

* UIProcess/API/qt/raw/qrawwebview.cpp:
(QRawWebViewPrivate::handleWillSetInputMethodState):
* UIProcess/API/qt/raw/qrawwebview_p_p.h:
(QRawWebViewPrivate):
* UIProcess/PageClient.h:
(PageClient):
* UIProcess/WebPageProxy.h:
(WebPageProxy):
* UIProcess/WebPageProxy.messages.in:
* UIProcess/qt/QtPageClient.cpp:
(WebKit::QtPageClient::handleWillSetInputMethodState):
(WebKit):
* UIProcess/qt/QtPageClient.h:
(QtPageClient):
* UIProcess/qt/QtWebPageEventHandler.cpp:
(WebKit::QtWebPageEventHandler::handleWillSetInputMethodState):
(WebKit):
* UIProcess/qt/QtWebPageEventHandler.h:
(QtWebPageEventHandler):
* UIProcess/qt/WebPageProxyQt.cpp:
(WebKit::WebPageProxy::willSetInputMethodState):
(WebKit):
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::willSetInputMethodState):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (136125 => 136126)


--- trunk/Source/WebKit2/ChangeLog	2012-11-29 13:34:34 UTC (rev 136125)
+++ trunk/Source/WebKit2/ChangeLog	2012-11-29 14:17:30 UTC (rev 136126)
@@ -1,3 +1,45 @@
+2012-11-29  Michael BrĂ¼ning  <michael.brun...@digia.com>
+
+        [Qt][WK2] Commit the preedit string in the input method when focus is about to be moved.
+        https://bugs.webkit.org/show_bug.cgi?id=97774
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Implements the handler for willSetInputMethodState in WebKit2 in Qt.
+        This is needed to tell the input method instance in Qt to commit its
+        preedit content when the focus has moved to another node to prevent a
+        bug where the old preedit string was kept as the preedit string and
+        the editor moved focus back to the old node when continuing to enter
+        text via the input method.
+
+        This behavior is analog to the behavior of the QtQuick text input
+        elements.
+
+        * UIProcess/API/qt/raw/qrawwebview.cpp:
+        (QRawWebViewPrivate::handleWillSetInputMethodState):
+        * UIProcess/API/qt/raw/qrawwebview_p_p.h:
+        (QRawWebViewPrivate):
+        * UIProcess/PageClient.h:
+        (PageClient):
+        * UIProcess/WebPageProxy.h:
+        (WebPageProxy):
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/qt/QtPageClient.cpp:
+        (WebKit::QtPageClient::handleWillSetInputMethodState):
+        (WebKit):
+        * UIProcess/qt/QtPageClient.h:
+        (QtPageClient):
+        * UIProcess/qt/QtWebPageEventHandler.cpp:
+        (WebKit::QtWebPageEventHandler::handleWillSetInputMethodState):
+        (WebKit):
+        * UIProcess/qt/QtWebPageEventHandler.h:
+        (QtWebPageEventHandler):
+        * UIProcess/qt/WebPageProxyQt.cpp:
+        (WebKit::WebPageProxy::willSetInputMethodState):
+        (WebKit):
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        (WebKit::WebEditorClient::willSetInputMethodState):
+
 2012-11-28  Jocelyn Turcotte  <jocelyn.turco...@digia.com>
 
         [Qt] The WebView should be flickable only using touch events

Modified: trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp (136125 => 136126)


--- trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp	2012-11-29 13:34:34 UTC (rev 136125)
+++ trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp	2012-11-29 14:17:30 UTC (rev 136126)
@@ -130,6 +130,11 @@
     notImplemented();
 }
 
+void QRawWebViewPrivate::handleWillSetInputMethodState()
+{
+    notImplemented();
+}
+
 #if ENABLE(GESTURE_EVENTS)
 void QRawWebViewPrivate::doneWithGestureEvent(const WebKit::WebGestureEvent& event, bool wasEventHandled)
 {

Modified: trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h (136125 => 136126)


--- trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h	2012-11-29 13:34:34 UTC (rev 136125)
+++ trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h	2012-11-29 14:17:30 UTC (rev 136126)
@@ -71,6 +71,7 @@
 #endif // USE(ACCELERATED_COMPOSITING)
 
     virtual void updateTextInputState();
+    virtual void handleWillSetInputMethodState();
 #if ENABLE(GESTURE_EVENTS)
     virtual void doneWithGestureEvent(const WebKit::WebGestureEvent& event, bool wasEventHandled);
 #endif

Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (136125 => 136126)


--- trunk/Source/WebKit2/UIProcess/PageClient.h	2012-11-29 13:34:34 UTC (rev 136125)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h	2012-11-29 14:17:30 UTC (rev 136126)
@@ -127,6 +127,7 @@
     virtual void handleAuthenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password) = 0;
     virtual void handleCertificateVerificationRequest(const String& hostname, bool& ignoreErrors) = 0;
     virtual void handleProxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password) = 0;
+    virtual void handleWillSetInputMethodState() = 0;
 #endif // PLATFORM(QT).
 
 #if PLATFORM(QT) || PLATFORM(EFL)

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (136125 => 136126)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2012-11-29 13:34:34 UTC (rev 136125)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2012-11-29 14:17:30 UTC (rev 136126)
@@ -895,6 +895,9 @@
 #endif
 
     void editorStateChanged(const EditorState&);
+#if PLATFORM(QT)
+    void willSetInputMethodState();
+#endif
 
     // Back/Forward list management
     void backForwardAddItem(uint64_t itemID);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (136125 => 136126)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2012-11-29 13:34:34 UTC (rev 136125)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2012-11-29 14:17:30 UTC (rev 136126)
@@ -205,7 +205,9 @@
 #if PLATFORM(WIN)
     DidChangeCompositionSelection(bool hasChanged)
 #endif
-
+#if PLATFORM(QT)
+    WillSetInputMethodState()
+#endif
     # Find messages
     DidCountStringMatches(WTF::String string, uint32_t matchCount)
     SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, float contentImageScaleFactor, WebKit::ShareableBitmap::Handle contentImageHandle, bool fadeOut, bool animate)

Modified: trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp (136125 => 136126)


--- trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp	2012-11-29 13:34:34 UTC (rev 136125)
+++ trunk/Source/WebKit2/UIProcess/qt/QtPageClient.cpp	2012-11-29 14:17:30 UTC (rev 136126)
@@ -256,6 +256,12 @@
     m_eventHandler->updateTextInputState();
 }
 
+void QtPageClient::handleWillSetInputMethodState()
+{
+    ASSERT(m_eventHandler);
+    m_eventHandler->handleWillSetInputMethodState();
+}
+
 #if ENABLE(GESTURE_EVENTS)
 void QtPageClient::doneWithGestureEvent(const WebGestureEvent& event, bool wasEventHandled)
 {

Modified: trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h (136125 => 136126)


--- trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h	2012-11-29 13:34:34 UTC (rev 136125)
+++ trunk/Source/WebKit2/UIProcess/qt/QtPageClient.h	2012-11-29 14:17:30 UTC (rev 136126)
@@ -103,6 +103,7 @@
     virtual void pageTransitionViewportReady();
     virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&);
     virtual void updateTextInputState();
+    virtual void handleWillSetInputMethodState();
     virtual void doneWithGestureEvent(const WebGestureEvent&, bool wasEventHandled);
 #if ENABLE(TOUCH_EVENTS)
     virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled);

Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp (136125 => 136126)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp	2012-11-29 13:34:34 UTC (rev 136125)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp	2012-11-29 14:17:30 UTC (rev 136126)
@@ -435,6 +435,12 @@
     setInputPanelVisible(editor.isContentEditable);
 }
 
+void QtWebPageEventHandler::handleWillSetInputMethodState()
+{
+    if (qApp->inputMethod()->isVisible())
+        qApp->inputMethod()->commit();
+}
+
 void QtWebPageEventHandler::doneWithGestureEvent(const WebGestureEvent& event, bool wasEventHandled)
 {
     if (event.type() != WebEvent::GestureSingleTap)

Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h (136125 => 136126)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h	2012-11-29 13:34:34 UTC (rev 136125)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h	2012-11-29 14:17:30 UTC (rev 136126)
@@ -89,6 +89,7 @@
     void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled);
 #endif
     void handleInputEvent(const QInputEvent*);
+    void handleWillSetInputMethodState();
     void resetGestureRecognizers();
 
     PageViewportControllerClientQt* viewportController() { return m_viewportController; }

Modified: trunk/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp (136125 => 136126)


--- trunk/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp	2012-11-29 13:34:34 UTC (rev 136125)
+++ trunk/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp	2012-11-29 14:17:30 UTC (rev 136126)
@@ -171,4 +171,9 @@
     process()->send(Messages::WebPage::HidePopupMenu(), m_pageID);
 }
 
+void WebPageProxy::willSetInputMethodState()
+{
+    m_pageClient->handleWillSetInputMethodState();
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp (136125 => 136126)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp	2012-11-29 13:34:34 UTC (rev 136125)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp	2012-11-29 14:17:30 UTC (rev 136126)
@@ -469,7 +469,11 @@
 
 void WebEditorClient::willSetInputMethodState()
 {
+#if PLATFORM(QT)
+    m_page->send(Messages::WebPageProxy::WillSetInputMethodState());
+#else
     notImplemented();
+#endif
 }
 
 void WebEditorClient::setInputMethodState(bool)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to