WebKit fails IETC composition event types
authorbashi@chromium.org <bashi@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Jan 2012 10:41:29 +0000 (10:41 +0000)
committerbashi@chromium.org <bashi@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Jan 2012 10:41:29 +0000 (10:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=76690

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105605 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/chromium/fast/events/ime-composition-events-001-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/editing/Editor.cpp

index 1f6f411..3a2645d 100644 (file)
@@ -1,3 +1,12 @@
+2012-01-19  Kenichi Ishibashi  <bashi@chromium.org>
+
+        WebKit fails IETC composition event types
+        https://bugs.webkit.org/show_bug.cgi?id=76690
+
+        Reviewed by Ryosuke Niwa.
+
+        * platform/chromium/fast/events/ime-composition-events-001-expected.txt: Updated.
+
 2012-01-23  Andrey Kosyakov  <caseq@chromium.org>
 
         Unreviewed follow-up to r105596, added missing test resources.
index 61ddee6..15ab407 100644 (file)
@@ -4,15 +4,18 @@ To test manually, enable an IME, input CJK characters, and see this page doesn't
 
 
 SUCCESS: INPUT - compositionstart - "1"
+SUCCESS: INPUT - compositionupdate - "1"
 SUCCESS: INPUT - compositionupdate - "2"
 SUCCESS: INPUT - compositionupdate - "3"
 SUCCESS: INPUT - compositionend - "4"
 SUCCESS: INPUT - textInput - "4"
 SUCCESS: INPUT - compositionstart - "5"
+SUCCESS: INPUT - compositionupdate - "5"
 SUCCESS: INPUT - compositionupdate - "6"
 SUCCESS: INPUT - compositionupdate - "7"
 SUCCESS: INPUT - compositionend - ""
 SUCCESS: INPUT - textInput - "8"
 SUCCESS: INPUT - compositionstart - "9"
+SUCCESS: INPUT - compositionupdate - "9"
 SUCCESS: INPUT - compositionend - "9"
 SUCCESS: INPUT - textInput - "9"
index babe1f5..17900fc 100644 (file)
@@ -1,3 +1,24 @@
+2012-01-19  Kenichi Ishibashi  <bashi@chromium.org>
+
+        WebKit fails IETC composition event types
+        https://bugs.webkit.org/show_bug.cgi?id=76690
+
+        Reviewed by Ryosuke Niwa.
+
+        Dispatches at least one compositionupdate event.
+        The spec(*) says that a composition session includes one or more
+        compositionupdate event(s).
+        Other major browsers (Firefox and IE) don't populate the data attribute
+        of the compositionstart event, but we set the given text in the data
+        attribute to minimize the effect of this change.
+
+        (*) http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#events-compositionevents
+
+        Updated existing test: fast/fast/events/ime-composition-events-001.html.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::setComposition):
+
 2012-01-22  Mario Sanchez Prada  <msanchez@igalia.com>
 
         [GTK] Refactor GTK's accessibilitity code to be more modular
index fe283e1..e7ff107 100644 (file)
@@ -1457,8 +1457,11 @@ void Editor::setComposition(const String& text, const Vector<CompositionUnderlin
         // We check the composition status and choose an appropriate composition event since this
         // function is used for three purposes:
         // 1. Starting a new composition.
-        //    Send a compositionstart event when this function creates a new composition node, i.e.
+        //    Send a compositionstart and a compositionupdate event when this function creates
+        //    a new composition node, i.e.
         //    m_compositionNode == 0 && !text.isEmpty().
+        //    Sending a compositionupdate event at this time ensures that at least one
+        //    compositionupdate event is dispatched.
         // 2. Updating the existing composition node.
         //    Send a compositionupdate event when this function updates the existing composition
         //    node, i.e. m_compositionNode != 0 && !text.isEmpty().
@@ -1469,8 +1472,10 @@ void Editor::setComposition(const String& text, const Vector<CompositionUnderlin
         if (!m_compositionNode) {
             // We should send a compositionstart event only when the given text is not empty because this
             // function doesn't create a composition node when the text is empty.
-            if (!text.isEmpty())
-                event = CompositionEvent::create(eventNames().compositionstartEvent, m_frame->domWindow(), text);
+            if (!text.isEmpty()) {
+                target->dispatchEvent(CompositionEvent::create(eventNames().compositionstartEvent, m_frame->domWindow(), text));
+                event = CompositionEvent::create(eventNames().compositionupdateEvent, m_frame->domWindow(), text);
+            }
         } else {
             if (!text.isEmpty())
                 event = CompositionEvent::create(eventNames().compositionupdateEvent, m_frame->domWindow(), text);