Title: [152668] trunk
Revision
152668
Author
rn...@webkit.org
Date
2013-07-15 16:28:50 -0700 (Mon, 15 Jul 2013)

Log Message

compositionstart event should contain the text to be replaced
https://bugs.webkit.org/show_bug.cgi?id=118684

Reviewed by Alexey Proskuryakov.

Source/WebCore: 

Merge https://chromium.googlesource.com/chromium/blink/+/9e04f728a95ad7d4783b1d31c3cdc1412dd6cc4d.

DOM3 level 3 specifies compositionstart event's data to be the text to be replaced.
http://www.w3.org/TR/DOM-Level-3-Events/#event-type-compositionstart

According to the author of the Blink change, IE10 on Windows and Firefox22 on Linux confirms
to the specified behavior.

Test: fast/events/ime-composition-events-001.html

* editing/Editor.cpp:
(WebCore::Editor::setComposition):

LayoutTests: 

Add a test case.

* fast/events/ime-composition-events-001-expected.txt:
* fast/events/ime-composition-events-001.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (152667 => 152668)


--- trunk/LayoutTests/ChangeLog	2013-07-15 23:27:35 UTC (rev 152667)
+++ trunk/LayoutTests/ChangeLog	2013-07-15 23:28:50 UTC (rev 152668)
@@ -1,3 +1,15 @@
+2013-07-15  Ryosuke Niwa  <rn...@webkit.org>
+
+        compositionstart event should contain the text to be replaced
+        https://bugs.webkit.org/show_bug.cgi?id=118684
+
+        Reviewed by Alexey Proskuryakov.
+
+        Add a test case.
+
+        * fast/events/ime-composition-events-001-expected.txt:
+        * fast/events/ime-composition-events-001.html:
+
 2013-07-15  Antoine Quint  <grao...@apple.com>
 
         Text with "text-overflow:ellipsis" and an SVG font do not render correctly

Modified: trunk/LayoutTests/fast/events/ime-composition-events-001-expected.txt (152667 => 152668)


--- trunk/LayoutTests/fast/events/ime-composition-events-001-expected.txt	2013-07-15 23:27:35 UTC (rev 152667)
+++ trunk/LayoutTests/fast/events/ime-composition-events-001-expected.txt	2013-07-15 23:28:50 UTC (rev 152668)
@@ -3,19 +3,24 @@
 To test manually, enable an IME, input CJK characters, and see this page doesn't show 'FAILED' lines.
 
 
-SUCCESS: INPUT - compositionstart - "1"
+SUCCESS: INPUT - compositionstart - ""
 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 - compositionstart - ""
 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 - compositionstart - ""
 SUCCESS: INPUT - compositionupdate - "9"
 SUCCESS: INPUT - compositionend - "9"
 SUCCESS: INPUT - textInput - "9"
+SUCCESS: INPUT - compositionstart - "have"
+SUCCESS: INPUT - compositionupdate - "lost"
+SUCCESS: INPUT - compositionend - "made"
+SUCCESS: INPUT - textInput - "made"
+SUCCESS: I made a pen

Modified: trunk/LayoutTests/fast/events/ime-composition-events-001.html (152667 => 152668)


--- trunk/LayoutTests/fast/events/ime-composition-events-001.html	2013-07-15 23:27:35 UTC (rev 152667)
+++ trunk/LayoutTests/fast/events/ime-composition-events-001.html	2013-07-15 23:28:50 UTC (rev 152668)
@@ -57,6 +57,17 @@
         textInputController.setMarkedText('9', 0, 1);
         textInputController.unmarkText();
     }
+
+    // Case 5: Compose a text on selection and commit it.
+    test.value = 'I have a pen';
+    test.selectionStart = 2;
+    test.selectionEnd = 6;
+    textInputController.setMarkedText('lost', 0, 1);
+    textInputController.insertText('made');
+    if (test.value == 'I made a pen')
+        log('SUCCESS: ' + test.value);
+    else
+        log('FAILURE: ' + test.value + ' is not "I made a pen".');
 }
 </script>
 </body>

Modified: trunk/Source/WebCore/ChangeLog (152667 => 152668)


--- trunk/Source/WebCore/ChangeLog	2013-07-15 23:27:35 UTC (rev 152667)
+++ trunk/Source/WebCore/ChangeLog	2013-07-15 23:28:50 UTC (rev 152668)
@@ -1,5 +1,25 @@
 2013-07-15  Ryosuke Niwa  <rn...@webkit.org>
 
+        compositionstart event should contain the text to be replaced
+        https://bugs.webkit.org/show_bug.cgi?id=118684
+
+        Reviewed by Alexey Proskuryakov.
+
+        Merge https://chromium.googlesource.com/chromium/blink/+/9e04f728a95ad7d4783b1d31c3cdc1412dd6cc4d.
+
+        DOM3 level 3 specifies compositionstart event's data to be the text to be replaced.
+        http://www.w3.org/TR/DOM-Level-3-Events/#event-type-compositionstart
+
+        According to the author of the Blink change, IE10 on Windows and Firefox22 on Linux confirms
+        to the specified behavior.
+
+        Test: fast/events/ime-composition-events-001.html
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::setComposition):
+
+2013-07-15  Ryosuke Niwa  <rn...@webkit.org>
+
         xmlDocPtrForString shouldn't upconvert 8-bit string
         https://bugs.webkit.org/show_bug.cgi?id=118693
 

Modified: trunk/Source/WebCore/editing/Editor.cpp (152667 => 152668)


--- trunk/Source/WebCore/editing/Editor.cpp	2013-07-15 23:27:35 UTC (rev 152667)
+++ trunk/Source/WebCore/editing/Editor.cpp	2013-07-15 23:28:50 UTC (rev 152668)
@@ -1541,7 +1541,7 @@
             // 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()) {
-                target->dispatchEvent(CompositionEvent::create(eventNames().compositionstartEvent, m_frame->document()->domWindow(), text));
+                target->dispatchEvent(CompositionEvent::create(eventNames().compositionstartEvent, m_frame->document()->domWindow(), selectedText()));
                 event = CompositionEvent::create(eventNames().compositionupdateEvent, m_frame->document()->domWindow(), text);
             }
         } else {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to