Title: [138806] trunk
Revision
138806
Author
[email protected]
Date
2013-01-04 09:41:40 -0800 (Fri, 04 Jan 2013)

Log Message

[GTK] [WebKit2] Clicking on a word that is selected in an editable area deletes it
https://bugs.webkit.org/show_bug.cgi?id=106045

Patch by Martin Robinson <[email protected]> on 2013-01-04
Reviewed by Carlos Garcia Campos.

Source/WebCore:

Be more selective about when to confirm WebKit compositions. If there is no current
preedit, reseting the GTK+ context shouldn't also do an empty confirmation in WebKit,
as this will trash the current selection. The second part of this patch also makes the
m_composingTextCurrently member more accurately reflect whether or not we are composing
text.

* platform/gtk/GtkInputMethodFilter.cpp:
(WebCore::GtkInputMethodFilter::notifyMouseButtonPress): Only confirm the current WebKit composition
if we have a preedit.
(WebCore::GtkInputMethodFilter::notifyFocusedOut): Ditto.
(WebCore::GtkInputMethodFilter::sendCompositionAndPreeditWithFakeKeyEvents): Don't clear the m_composingTextCurrently
member if we are not sending a confirmed composition.

Tools:

Update test results to confirm that compositions without preedits do not trigger
a composition confirmation.

* TestWebKitAPI/Tests/gtk/InputMethodFilter.cpp:
(TestWebKitAPI::verifyCanceledComposition):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (138805 => 138806)


--- trunk/Source/WebCore/ChangeLog	2013-01-04 17:30:10 UTC (rev 138805)
+++ trunk/Source/WebCore/ChangeLog	2013-01-04 17:41:40 UTC (rev 138806)
@@ -1,3 +1,23 @@
+2013-01-04  Martin Robinson  <[email protected]>
+
+        [GTK] [WebKit2] Clicking on a word that is selected in an editable area deletes it
+        https://bugs.webkit.org/show_bug.cgi?id=106045
+
+        Reviewed by Carlos Garcia Campos.
+
+        Be more selective about when to confirm WebKit compositions. If there is no current
+        preedit, reseting the GTK+ context shouldn't also do an empty confirmation in WebKit,
+        as this will trash the current selection. The second part of this patch also makes the
+        m_composingTextCurrently member more accurately reflect whether or not we are composing
+        text.
+
+        * platform/gtk/GtkInputMethodFilter.cpp:
+        (WebCore::GtkInputMethodFilter::notifyMouseButtonPress): Only confirm the current WebKit composition
+        if we have a preedit.
+        (WebCore::GtkInputMethodFilter::notifyFocusedOut): Ditto.
+        (WebCore::GtkInputMethodFilter::sendCompositionAndPreeditWithFakeKeyEvents): Don't clear the m_composingTextCurrently
+        member if we are not sending a confirmed composition.
+
 2013-01-04  Max Feil  <[email protected]>
 
         [BlackBerry] Handle re-entrant destruction of MediaPlayerPrivate while a dialog is up

Modified: trunk/Source/WebCore/platform/gtk/GtkInputMethodFilter.cpp (138805 => 138806)


--- trunk/Source/WebCore/platform/gtk/GtkInputMethodFilter.cpp	2013-01-04 17:30:10 UTC (rev 138805)
+++ trunk/Source/WebCore/platform/gtk/GtkInputMethodFilter.cpp	2013-01-04 17:41:40 UTC (rev 138806)
@@ -206,8 +206,9 @@
     // Confirming the composition may trigger a selection change, which
     // might trigger further unwanted actions on the context, so we prevent
     // that by setting m_composingTextCurrently to false.
+    if (m_composingTextCurrently)
+        confirmCurrentComposition();
     m_composingTextCurrently = false;
-    confirmCurrentComposition();
     cancelContextComposition();
 }
 
@@ -248,8 +249,8 @@
     if (!m_enabled)
         return;
 
-    m_composingTextCurrently = false;
-    confirmCurrentComposition();
+    if (m_composingTextCurrently)
+        confirmCurrentComposition();
     cancelContextComposition();
     gtk_im_context_focus_out(m_context.get());
     m_enabled = false;
@@ -275,7 +276,8 @@
     sendKeyEventWithCompositionResults(&event->key, resultsToSend, EventFaked);
 
     m_confirmedComposition = String();
-    m_composingTextCurrently = false;
+    if (resultsToSend & Composition)
+        m_composingTextCurrently = false;
 
     event->type = GDK_KEY_RELEASE;
     sendSimpleKeyEvent(&event->key, String(), EventFaked);

Modified: trunk/Tools/ChangeLog (138805 => 138806)


--- trunk/Tools/ChangeLog	2013-01-04 17:30:10 UTC (rev 138805)
+++ trunk/Tools/ChangeLog	2013-01-04 17:41:40 UTC (rev 138806)
@@ -1,3 +1,16 @@
+2013-01-04  Martin Robinson  <[email protected]>
+
+        [GTK] [WebKit2] Clicking on a word that is selected in an editable area deletes it
+        https://bugs.webkit.org/show_bug.cgi?id=106045
+
+        Reviewed by Carlos Garcia Campos.
+
+        Update test results to confirm that compositions without preedits do not trigger
+        a composition confirmation.
+
+        * TestWebKitAPI/Tests/gtk/InputMethodFilter.cpp:
+        (TestWebKitAPI::verifyCanceledComposition):
+
 2013-01-04  Sailesh Agrawal  <[email protected]>
 
         [Mac] [WK2] platform/mac/fast/events/numpad-keycode-mapping.html fails

Modified: trunk/Tools/TestWebKitAPI/Tests/gtk/InputMethodFilter.cpp (138805 => 138806)


--- trunk/Tools/TestWebKitAPI/Tests/gtk/InputMethodFilter.cpp	2013-01-04 17:30:10 UTC (rev 138805)
+++ trunk/Tools/TestWebKitAPI/Tests/gtk/InputMethodFilter.cpp	2013-01-04 17:41:40 UTC (rev 138806)
@@ -260,11 +260,10 @@
 
 static void verifyCanceledComposition(const Vector<String>& events)
 {
-    ASSERT_EQ(4, events.size());
+    ASSERT_EQ(3, events.size());
     ASSERT_EQ(String("sendKeyEventWithCompositionResults type=press keycode=39"), events[0]);
     ASSERT_EQ(String("setPreedit text='' cursorOffset=0"), events[1]);
     ASSERT_EQ(String("sendSimpleKeyEvent type=release keycode=27"), events[2]);
-    ASSERT_EQ(String("confirmCurrentcomposition"), events[3]);
     ASSERT(gSawContextReset);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to