[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 11:57:05 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 820465829be7d11ad79d79b28d7f8ac0e16fa01a
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Aug 12 02:09:17 2010 +0000

    2010-08-11  Joone Hur  <joone at kldp.org>
    
            Reviewed by Martin Robinson.
    
            [GTK] Last Hangul letter is typed again when a composition is finished with mouse press
            https://bugs.webkit.org/show_bug.cgi?id=40518
    
            When a mouse press fires during a IME composition, the current composition character
            can be entered twice at the previous editing position and a new editing position.
            Because the IME commit signal is emitted after the mouse press event.
            This patch allows to prevent the commit signal during a composition when a mouse press fires.
    
            * WebCoreSupport/EditorClientGtk.cpp:
            (WebKit::imContextCommitted):
            (WebKit::EditorClient::handleInputMethodKeydown): Allow to accept the next composition commit.
            (WebKit::EditorClient::handleInputMethodMousePress): Added for handling IME when a mouse press fires.
            (WebKit::EditorClient::EditorClient):  Initialize m_preventNextCompositionCommit
            * WebCoreSupport/EditorClientGtk.h:
            (WebKit::EditorClient::preventNextCompositionCommit): Added for checking whether skipping a commit.
            * webkit/webkitwebview.cpp:
            (webkit_web_view_button_press_event): Call handleInputMethodMousePress()
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65209 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 422abd5..477a1b8 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,25 @@
+2010-08-11  Joone Hur  <joone at kldp.org>
+
+        Reviewed by Martin Robinson.
+
+        [GTK] Last Hangul letter is typed again when a composition is finished with mouse press
+        https://bugs.webkit.org/show_bug.cgi?id=40518
+
+        When a mouse press fires during a IME composition, the current composition character   
+        can be entered twice at the previous editing position and a new editing position.
+        Because the IME commit signal is emitted after the mouse press event. 
+        This patch allows to prevent the commit signal during a composition when a mouse press fires.
+
+        * WebCoreSupport/EditorClientGtk.cpp: 
+        (WebKit::imContextCommitted):
+        (WebKit::EditorClient::handleInputMethodKeydown): Allow to accept the next composition commit.
+        (WebKit::EditorClient::handleInputMethodMousePress): Added for handling IME when a mouse press fires.
+        (WebKit::EditorClient::EditorClient):  Initialize m_preventNextCompositionCommit
+        * WebCoreSupport/EditorClientGtk.h:
+        (WebKit::EditorClient::preventNextCompositionCommit): Added for checking whether skipping a commit.
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_button_press_event): Call handleInputMethodMousePress() 
+
 2010-08-11  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
 
         Reviewed by Martin Robinson.
diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
index cd04782..8a019b4 100644
--- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
@@ -67,6 +67,11 @@ static void imContextCommitted(GtkIMContext* context, const gchar* compositionSt
         return;
     }
 
+    // If this signal fires during a mousepress event when we are in the middle
+    // of a composition, skip this 'commit' because the composition is already confirmed. 
+    if (client->preventNextCompositionCommit()) 
+        return;
+ 
     frame->editor()->confirmComposition(String::fromUTF8(compositionString));
     client->clearPendingComposition();
 }
@@ -670,6 +675,7 @@ void EditorClient::handleInputMethodKeydown(KeyboardEvent* event)
 
     WebKitWebViewPrivate* priv = m_webView->priv;
 
+    m_preventNextCompositionCommit = false;
 
     // Some IM contexts (e.g. 'simple') will act as if they filter every
     // keystroke and just issue a 'commit' signal during handling. In situations
@@ -711,9 +717,32 @@ void EditorClient::handleInputMethodKeydown(KeyboardEvent* event)
     m_treatContextCommitAsKeyEvent = false;
 }
 
+void EditorClient::handleInputMethodMousePress()
+{
+    Frame* targetFrame = core(m_webView)->focusController()->focusedOrMainFrame();
+
+    if (!targetFrame || !targetFrame->editor()->canEdit())
+        return;
+
+    WebKitWebViewPrivate* priv = m_webView->priv;
+
+    // When a mouse press fires, the commit signal happens during a composition.
+    // In this case, if the focused node is changed, the commit signal happens in a diffrent node.
+    // Therefore, we need to confirm the current compositon and ignore the next commit signal. 
+    GOwnPtr<gchar> newPreedit(0);
+    gtk_im_context_get_preedit_string(priv->imContext, &newPreedit.outPtr(), 0, 0);
+    
+    if (g_utf8_strlen(newPreedit.get(), -1)) {
+        targetFrame->editor()->confirmComposition();
+        m_preventNextCompositionCommit = true;
+        gtk_im_context_reset(priv->imContext);
+    } 
+}
+
 EditorClient::EditorClient(WebKitWebView* webView)
     : m_isInRedo(false)
     , m_webView(webView)
+    , m_preventNextCompositionCommit(false)
     , m_treatContextCommitAsKeyEvent(false)
     , m_nativeWidget(gtk_text_view_new())
 {
diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.h b/WebKit/gtk/WebCoreSupport/EditorClientGtk.h
index 2688629..3e881fa 100644
--- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.h
+++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.h
@@ -61,6 +61,7 @@ namespace WebKit {
         ~EditorClient();
         WebKitWebView* webView() { return m_webView; }
         bool treatContextCommitAsKeyEvent() { return m_treatContextCommitAsKeyEvent; }
+        bool preventNextCompositionCommit() { return m_preventNextCompositionCommit; }
         void clearPendingComposition() { m_pendingComposition.set(0); }
         bool hasPendingComposition() { return m_pendingComposition; }
         void addPendingEditorCommand(const char* command) { m_pendingEditorCommands.append(command); }
@@ -112,6 +113,7 @@ namespace WebKit {
 
         virtual void handleKeyboardEvent(WebCore::KeyboardEvent*);
         virtual void handleInputMethodKeydown(WebCore::KeyboardEvent*);
+        virtual void handleInputMethodMousePress();
 
         virtual void textFieldDidBeginEditing(WebCore::Element*);
         virtual void textFieldDidEndEditing(WebCore::Element*);
@@ -135,6 +137,7 @@ namespace WebKit {
 
     private:
         WebKitWebView* m_webView;
+        bool m_preventNextCompositionCommit;
         bool m_treatContextCommitAsKeyEvent;
         GOwnPtr<gchar> m_pendingComposition;
         Vector<const char*> m_pendingEditorCommands;
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index 45ff3db..6de33fd 100644
--- a/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/WebKit/gtk/webkit/webkitwebview.cpp
@@ -665,8 +665,9 @@ static gboolean webkit_web_view_button_press_event(GtkWidget* widget, GdkEventBu
     if (!frame->view())
         return FALSE;
 
-
     gboolean result = frame->eventHandler()->handleMousePressEvent(platformEvent);
+    // Handle the IM context when a mouse press fires
+    static_cast<WebKit::EditorClient*>(core(webView)->editorClient())->handleInputMethodMousePress();
 
 #if PLATFORM(X11)
     /* Copy selection to the X11 selection clipboard */

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list