2011-01-04 Zhe Su <suzhe@chromium.org>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Jan 2011 21:27:04 +0000 (21:27 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Jan 2011 21:27:04 +0000 (21:27 +0000)
        Reviewed by Kenneth Russell.

        1. Remove entry for editing/input/ime-composition-clearpreedit.html test.
        2. Improve fast/events/ime-composition-events-001.html to cover more
           cases. And fix test expectations of chromium port.
        https://bugs.webkit.org/show_bug.cgi?id=51693

        * fast/events/ime-composition-events-001-expected.txt:
        * fast/events/ime-composition-events-001.html:
        * platform/chromium-mac/fast/events/ime-composition-events-001-expected.txt: Removed.
        * platform/chromium-win/fast/events/ime-composition-events-001-expected.txt: Removed.
        * platform/chromium/fast/events/ime-composition-events-001-expected.txt: Added.
        * platform/chromium/test_expectations.txt:
        * platform/qt/fast/events/ime-composition-events-001-expected.txt: Added.
2011-01-04  Zhe Su  <suzhe@chromium.org>

        Reviewed by Kenneth Russell.

        Fix insertText, setMarkedText and unmarkText methods of
        TextInputController to call corresponding methods of WebKit::WebView
        rather than WebKit::WebFrame. This change matches the behavior of
        chromium browser.
        insertText corresponds to WebView::confirmComposition(text)
        setMarkedText corresponds to WebView::setComposition(...)
        unmarkText corresponds to WebView::confirmComposition()
        https://bugs.webkit.org/show_bug.cgi?id=51693

        * DumpRenderTree/chromium/TextInputController.cpp:
        (TextInputController::insertText):
        (TextInputController::setMarkedText):
        (TextInputController::unmarkText):
2011-01-04  Zhe Su  <suzhe@chromium.org>

        Reviewed by Kenneth Russell.

        Changes:
        1. Add WebKit::WebWidget::confirmComposition(const WebString& text)
           This new method corresponds to Editor::confirmComposition(text) and
           Editor::insertText(text). It'll be used by both DumpRenderTree's
           TextInputController and chromium browser.
        2. Fix WebFrameImpl::insertText
           It should call Editor::confirmComposition(text) rather than
           Editor::insertText(text) if there is an ongoing composition.
           It matches the behavior of WebKit Mac port.
        3. Fix WebFrameImpl::setMarkedText
           Editor::confirmComposition(text) shouldn't be called in this
           method, which incorrectly inserts the text.

        https://bugs.webkit.org/show_bug.cgi?id=51693

        * public/WebWidget.h:
        * src/WebFrameImpl.cpp:
        (WebKit::WebFrameImpl::insertText):
        (WebKit::WebFrameImpl::setMarkedText):
        * src/WebPopupMenuImpl.cpp:
        (WebKit::WebPopupMenuImpl::confirmComposition):
        * src/WebPopupMenuImpl.h:
        * src/WebViewImpl.cpp:
        (WebKit::WebViewImpl::confirmComposition):
        * src/WebViewImpl.h:
        * tests/PopupMenuTest.cpp:
        (WebKit::TestWebWidget::confirmComposition):
2011-01-04  Zhe Su  <suzhe@chromium.org>

        Reviewed by Kenneth Russell.

        Fix test LayoutTests/fast/events/ime-composition-events-001.html.

        https://bugs.webkit.org/show_bug.cgi?id=51693

        * Api/qwebpage.cpp:
        (QWebPagePrivate::inputMethodEvent): Calls editor->insertText() to
        insert the commit string when no composition text is available.

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

20 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/events/ime-composition-events-001-expected.txt
LayoutTests/fast/events/ime-composition-events-001.html
LayoutTests/platform/chromium-mac/fast/events/ime-composition-events-001-expected.txt [deleted file]
LayoutTests/platform/chromium-win/fast/events/ime-composition-events-001-expected.txt [deleted file]
LayoutTests/platform/chromium/fast/events/ime-composition-events-001-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/test_expectations.txt
LayoutTests/platform/qt/fast/events/ime-composition-events-001-expected.txt [new file with mode: 0644]
Tools/ChangeLog
Tools/DumpRenderTree/chromium/TextInputController.cpp
WebKit/chromium/ChangeLog
WebKit/chromium/public/WebWidget.h
WebKit/chromium/src/WebFrameImpl.cpp
WebKit/chromium/src/WebPopupMenuImpl.cpp
WebKit/chromium/src/WebPopupMenuImpl.h
WebKit/chromium/src/WebViewImpl.cpp
WebKit/chromium/src/WebViewImpl.h
WebKit/chromium/tests/PopupMenuTest.cpp
WebKit/qt/Api/qwebpage.cpp
WebKit/qt/ChangeLog

index 5a356a5fb47bdd373a855253c58c575d19bcaa98..f0addd5b9fcf18d932ab916e6ac66e02a6206081 100644 (file)
@@ -1,3 +1,20 @@
+2011-01-04  Zhe Su  <suzhe@chromium.org>
+
+        Reviewed by Kenneth Russell.
+
+        1. Remove entry for editing/input/ime-composition-clearpreedit.html test.
+        2. Improve fast/events/ime-composition-events-001.html to cover more
+           cases. And fix test expectations of chromium port.
+        https://bugs.webkit.org/show_bug.cgi?id=51693
+
+        * fast/events/ime-composition-events-001-expected.txt:
+        * fast/events/ime-composition-events-001.html:
+        * platform/chromium-mac/fast/events/ime-composition-events-001-expected.txt: Removed.
+        * platform/chromium-win/fast/events/ime-composition-events-001-expected.txt: Removed.
+        * platform/chromium/fast/events/ime-composition-events-001-expected.txt: Added.
+        * platform/chromium/test_expectations.txt:
+        * platform/qt/fast/events/ime-composition-events-001-expected.txt: Added.
+
 2010-12-31  Antti Koivisto  <antti@apple.com>
 
         Reviewed by Dave Hyatt.
index e5bfc97dead7420f11c9a948f58331bfc3a3f35e..61ddee60f03c17a114fe59791925997fb7efbd74 100644 (file)
@@ -12,3 +12,7 @@ SUCCESS: INPUT - compositionstart - "5"
 SUCCESS: INPUT - compositionupdate - "6"
 SUCCESS: INPUT - compositionupdate - "7"
 SUCCESS: INPUT - compositionend - ""
+SUCCESS: INPUT - textInput - "8"
+SUCCESS: INPUT - compositionstart - "9"
+SUCCESS: INPUT - compositionend - "9"
+SUCCESS: INPUT - textInput - "9"
index c4d70be6308a2915e8ae9fe46828a091423dfc0b..3251c36cb9dd31cc798bb36caec08cc42a9ecc70 100644 (file)
@@ -47,6 +47,16 @@ if (window.layoutTestController) {
     textInputController.setMarkedText('6', 0, 1);
     textInputController.setMarkedText('7', 0, 1);
     textInputController.setMarkedText('', 0, 0);
+
+    // Case 3: Insert a text without composition.
+    textInputController.insertText('8');
+
+    // Case 4: Compose a text and commit it by removing the mark.
+    // Only Mac and Chromium ports support unmarkText.
+    if (textInputController.unmarkText) {
+        textInputController.setMarkedText('9', 0, 1);
+        textInputController.unmarkText();
+    }
 }
 </script>
 </body>
diff --git a/LayoutTests/platform/chromium-mac/fast/events/ime-composition-events-001-expected.txt b/LayoutTests/platform/chromium-mac/fast/events/ime-composition-events-001-expected.txt
deleted file mode 100644 (file)
index e0184cd..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-This tests that calling input-method functions sends Composition Events and Text Events introduced in DOM Level 3.
-
-To test manually, enable an IME, input CJK characters, and see this page doesn't show 'FAILED' lines.
-
-
-SUCCESS: INPUT - compositionend - "1"
-SUCCESS: INPUT - textInput - "1"
-SUCCESS: INPUT - compositionstart - "1"
-SUCCESS: INPUT - compositionend - "2"
-SUCCESS: INPUT - textInput - "2"
-SUCCESS: INPUT - compositionstart - "2"
-SUCCESS: INPUT - compositionend - "3"
-SUCCESS: INPUT - textInput - "3"
-SUCCESS: INPUT - compositionstart - "3"
-SUCCESS: INPUT - compositionend - "3"
-SUCCESS: INPUT - textInput - "3"
-SUCCESS: INPUT - textInput - "4"
-SUCCESS: INPUT - compositionend - "5"
-SUCCESS: INPUT - textInput - "5"
-SUCCESS: INPUT - compositionstart - "5"
-SUCCESS: INPUT - compositionend - "6"
-SUCCESS: INPUT - textInput - "6"
-SUCCESS: INPUT - compositionstart - "6"
-SUCCESS: INPUT - compositionend - "7"
-SUCCESS: INPUT - textInput - "7"
-SUCCESS: INPUT - compositionstart - "7"
-SUCCESS: INPUT - compositionend - ""
-SUCCESS: INPUT - textInput - ""
diff --git a/LayoutTests/platform/chromium-win/fast/events/ime-composition-events-001-expected.txt b/LayoutTests/platform/chromium-win/fast/events/ime-composition-events-001-expected.txt
deleted file mode 100644 (file)
index e0184cd..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-This tests that calling input-method functions sends Composition Events and Text Events introduced in DOM Level 3.
-
-To test manually, enable an IME, input CJK characters, and see this page doesn't show 'FAILED' lines.
-
-
-SUCCESS: INPUT - compositionend - "1"
-SUCCESS: INPUT - textInput - "1"
-SUCCESS: INPUT - compositionstart - "1"
-SUCCESS: INPUT - compositionend - "2"
-SUCCESS: INPUT - textInput - "2"
-SUCCESS: INPUT - compositionstart - "2"
-SUCCESS: INPUT - compositionend - "3"
-SUCCESS: INPUT - textInput - "3"
-SUCCESS: INPUT - compositionstart - "3"
-SUCCESS: INPUT - compositionend - "3"
-SUCCESS: INPUT - textInput - "3"
-SUCCESS: INPUT - textInput - "4"
-SUCCESS: INPUT - compositionend - "5"
-SUCCESS: INPUT - textInput - "5"
-SUCCESS: INPUT - compositionstart - "5"
-SUCCESS: INPUT - compositionend - "6"
-SUCCESS: INPUT - textInput - "6"
-SUCCESS: INPUT - compositionstart - "6"
-SUCCESS: INPUT - compositionend - "7"
-SUCCESS: INPUT - textInput - "7"
-SUCCESS: INPUT - compositionstart - "7"
-SUCCESS: INPUT - compositionend - ""
-SUCCESS: INPUT - textInput - ""
diff --git a/LayoutTests/platform/chromium/fast/events/ime-composition-events-001-expected.txt b/LayoutTests/platform/chromium/fast/events/ime-composition-events-001-expected.txt
new file mode 100644 (file)
index 0000000..61ddee6
--- /dev/null
@@ -0,0 +1,18 @@
+This tests that calling input-method functions sends Composition Events and Text Events introduced in DOM Level 3.
+
+To test manually, enable an IME, input CJK characters, and see this page doesn't show 'FAILED' lines.
+
+
+SUCCESS: INPUT - compositionstart - "1"
+SUCCESS: INPUT - compositionupdate - "2"
+SUCCESS: INPUT - compositionupdate - "3"
+SUCCESS: INPUT - compositionend - "4"
+SUCCESS: INPUT - textInput - "4"
+SUCCESS: INPUT - compositionstart - "5"
+SUCCESS: INPUT - compositionupdate - "6"
+SUCCESS: INPUT - compositionupdate - "7"
+SUCCESS: INPUT - compositionend - ""
+SUCCESS: INPUT - textInput - "8"
+SUCCESS: INPUT - compositionstart - "9"
+SUCCESS: INPUT - compositionend - "9"
+SUCCESS: INPUT - textInput - "9"
index 3a2063e58b244cf06d4553e4728791685a2a2568..40a4ab208078578b91514d26215dcdf9e7e9ad01 100644 (file)
@@ -3043,8 +3043,6 @@ BUGWK51398 MAC : inspector/debugger-expand-scope.html = TIMEOUT
 // WebKit roll 74534:74545
 BUGWK51536 : fast/css/box-shadow.html = FAIL TIMEOUT
 
-BUGCR67960 : editing/input/ime-composition-clearpreedit.html = TEXT
-
 // WebKit roll 74667:74679
 BUGCR68067 LINUX DEBUG : fast/canvas/webgl/tex-image-with-format-and-type.html = TEXT PASS
 
diff --git a/LayoutTests/platform/qt/fast/events/ime-composition-events-001-expected.txt b/LayoutTests/platform/qt/fast/events/ime-composition-events-001-expected.txt
new file mode 100644 (file)
index 0000000..c68ab16
--- /dev/null
@@ -0,0 +1,15 @@
+This tests that calling input-method functions sends Composition Events and Text Events introduced in DOM Level 3.
+
+To test manually, enable an IME, input CJK characters, and see this page doesn't show 'FAILED' lines.
+
+
+SUCCESS: INPUT - compositionstart - "1"
+SUCCESS: INPUT - compositionupdate - "2"
+SUCCESS: INPUT - compositionupdate - "3"
+SUCCESS: INPUT - compositionend - "4"
+SUCCESS: INPUT - textInput - "4"
+SUCCESS: INPUT - compositionstart - "5"
+SUCCESS: INPUT - compositionupdate - "6"
+SUCCESS: INPUT - compositionupdate - "7"
+SUCCESS: INPUT - compositionend - ""
+SUCCESS: INPUT - textInput - "8"
index 2327c54a4d39b62dac1c04a1f7bf43e243a4865c..f5e71e0771d3ef76f9da92f4df0397262d1da7d2 100644 (file)
@@ -1,3 +1,21 @@
+2011-01-04  Zhe Su  <suzhe@chromium.org>
+
+        Reviewed by Kenneth Russell.
+
+        Fix insertText, setMarkedText and unmarkText methods of
+        TextInputController to call corresponding methods of WebKit::WebView
+        rather than WebKit::WebFrame. This change matches the behavior of
+        chromium browser.
+        insertText corresponds to WebView::confirmComposition(text)
+        setMarkedText corresponds to WebView::setComposition(...)
+        unmarkText corresponds to WebView::confirmComposition()
+        https://bugs.webkit.org/show_bug.cgi?id=51693
+
+        * DumpRenderTree/chromium/TextInputController.cpp:
+        (TextInputController::insertText):
+        (TextInputController::setMarkedText):
+        (TextInputController::unmarkText):
+
 2011-01-04  Dihan Wickremasuriya  <dihan.wickremasuriya@nokia.com>
 
         Reviewed by Laszlo Gombos.
index 3603840991aff41a7e885e96407f15a6ebe4f000..c5dbe2956f39c9b84ecdec77928f4a9ae70f1aa0 100644 (file)
@@ -79,17 +79,10 @@ void TextInputController::insertText(const CppArgumentList& arguments, CppVarian
 {
     result->setNull();
 
-    WebFrame* mainFrame = getMainFrame();
-    if (!mainFrame)
-        return;
     if (arguments.size() < 1 || !arguments[0].isString())
         return;
 
-    if (mainFrame->hasMarkedText()) {
-        mainFrame->unmarkText();
-        mainFrame->replaceSelection(WebString());
-    }
-    mainFrame->insertText(WebString::fromUTF8(arguments[0].toString()));
+    testShell->webView()->confirmComposition(WebString::fromUTF8(arguments[0].toString()));
 }
 
 void TextInputController::doCommand(const CppArgumentList& arguments, CppVariant* result)
@@ -108,15 +101,13 @@ void TextInputController::setMarkedText(const CppArgumentList& arguments, CppVar
 {
     result->setNull();
 
-    WebFrame* mainFrame = getMainFrame();
-    if (!mainFrame)
-        return;
-
     if (arguments.size() >= 3 && arguments[0].isString()
         && arguments[1].isNumber() && arguments[2].isNumber()) {
-        mainFrame->setMarkedText(WebString::fromUTF8(arguments[0].toString()),
-                                 arguments[1].toInt32(),
-                                 arguments[2].toInt32());
+        WebVector<WebCompositionUnderline> underlines;
+        testShell->webView()->setComposition(WebString::fromUTF8(arguments[0].toString()),
+                                             underlines,
+                                             arguments[1].toInt32(),
+                                             arguments[1].toInt32() + arguments[2].toInt32());
     }
 }
 
@@ -124,11 +115,7 @@ void TextInputController::unmarkText(const CppArgumentList&, CppVariant* result)
 {
     result->setNull();
 
-    WebFrame* mainFrame = getMainFrame();
-    if (!mainFrame)
-        return;
-
-    mainFrame->unmarkText();
+    testShell->webView()->confirmComposition();
 }
 
 void TextInputController::hasMarkedText(const CppArgumentList&, CppVariant* result)
index 6ef058c33e2b61589ca38a30e4215e780efba2ef..c4a9fae336a7a14679eb665a08bb8d93f467bfc7 100644 (file)
@@ -1,3 +1,35 @@
+2011-01-04  Zhe Su  <suzhe@chromium.org>
+
+        Reviewed by Kenneth Russell.
+
+        Changes:
+        1. Add WebKit::WebWidget::confirmComposition(const WebString& text)
+           This new method corresponds to Editor::confirmComposition(text) and
+           Editor::insertText(text). It'll be used by both DumpRenderTree's
+           TextInputController and chromium browser.
+        2. Fix WebFrameImpl::insertText
+           It should call Editor::confirmComposition(text) rather than
+           Editor::insertText(text) if there is an ongoing composition.
+           It matches the behavior of WebKit Mac port.
+        3. Fix WebFrameImpl::setMarkedText
+           Editor::confirmComposition(text) shouldn't be called in this
+           method, which incorrectly inserts the text.
+
+        https://bugs.webkit.org/show_bug.cgi?id=51693
+
+        * public/WebWidget.h:
+        * src/WebFrameImpl.cpp:
+        (WebKit::WebFrameImpl::insertText):
+        (WebKit::WebFrameImpl::setMarkedText):
+        * src/WebPopupMenuImpl.cpp:
+        (WebKit::WebPopupMenuImpl::confirmComposition):
+        * src/WebPopupMenuImpl.h:
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::confirmComposition):
+        * src/WebViewImpl.h:
+        * tests/PopupMenuTest.cpp:
+        (WebKit::TestWebWidget::confirmComposition):
+
 2011-01-03  Daniel Bates  <dbates@rim.com>
 
         Attempt to fix the Chromium Linux Release build after changeset 74895 <http://trac.webkit.org/changeset/74895>.
index d01027065c9e90c14756e7787ca266df67eaec3b..ccad134f634e84f3fc0b9c644e660fc680f3ef12 100644 (file)
@@ -103,9 +103,18 @@ public:
         int selectionEnd) = 0;
 
     // Called to inform the WebWidget to confirm an ongoing composition.
+    // This method is same as confirmComposition(WebString());
     // Returns true if there is an ongoing composition.
     virtual bool confirmComposition() = 0;
 
+    // Called to inform the WebWidget to confirm an ongoing composition with a
+    // new composition text. If the text is empty then the current composition
+    // text is confirmed. If there is no ongoing composition, then deletes the
+    // current selection and inserts the text. This method has no effect if
+    // there is no ongoing composition and the text is empty.
+    // Returns true if there is an ongoing composition or the text is inserted.
+    virtual bool confirmComposition(const WebString& text) = 0;
+
     // Returns the current text input type of this WebWidget.
     virtual WebTextInputType textInputType() = 0;
 
index a113644ca5869a88560d2ca8f475eea571bd6399..1519d352b948be9b0bc11b36b36cf89684b7cd41 100644 (file)
@@ -1074,7 +1074,12 @@ void WebFrameImpl::replaceSelection(const WebString& text)
 
 void WebFrameImpl::insertText(const WebString& text)
 {
-    frame()->editor()->insertText(text, 0);
+    Editor* editor = frame()->editor();
+
+    if (editor->hasComposition())
+        editor->confirmComposition(text);
+    else
+        editor->insertText(text, 0);
 }
 
 void WebFrameImpl::setMarkedText(
@@ -1082,8 +1087,6 @@ void WebFrameImpl::setMarkedText(
 {
     Editor* editor = frame()->editor();
 
-    editor->confirmComposition(text);
-
     Vector<CompositionUnderline> decorations;
     editor->setComposition(text, decorations, location, length);
 }
index 085a1575e54bf0e7a4ac8e5878a038605892e5d9..63ebed809befb04e80f643136fbd31d7e8c69271 100644 (file)
@@ -253,6 +253,11 @@ bool WebPopupMenuImpl::confirmComposition()
     return false;
 }
 
+bool WebPopupMenuImpl::confirmComposition(const WebString& text)
+{
+    return false;
+}
+
 WebTextInputType WebPopupMenuImpl::textInputType()
 {
     return WebTextInputTypeNone;
index 221ba038f2c4c736d677fabfa322e051f904264c..b8ef7ba8e4b99fee904b8fb6793d6e6629e2ab49 100644 (file)
@@ -73,6 +73,7 @@ public:
         const WebVector<WebCompositionUnderline>& underlines,
         int selectionStart, int selectionEnd);
     virtual bool confirmComposition();
+    virtual bool confirmComposition(const WebString& text);
     virtual WebTextInputType textInputType();
     virtual WebRect caretOrSelectionBounds();
     virtual void setTextDirection(WebTextDirection direction);
index d77a5b3f62f3f97e6435f9c14509ed0b499a1e67..e47c89e8a042ca2ef399ada40637518fb95aeb45 100644 (file)
@@ -1302,12 +1302,17 @@ bool WebViewImpl::setComposition(
 }
 
 bool WebViewImpl::confirmComposition()
+{
+    return confirmComposition(WebString());
+}
+
+bool WebViewImpl::confirmComposition(const WebString& text)
 {
     Frame* focused = focusedWebCoreFrame();
     if (!focused || !m_imeAcceptEvents)
         return false;
     Editor* editor = focused->editor();
-    if (!editor || !editor->hasComposition())
+    if (!editor || (!editor->hasComposition() && !text.length()))
         return false;
 
     // We should verify the parent node of this IME composition node are
@@ -1321,7 +1326,14 @@ bool WebViewImpl::confirmComposition()
             return false;
     }
 
-    editor->confirmComposition();
+    if (editor->hasComposition()) {
+        if (text.length())
+            editor->confirmComposition(String(text));
+        else
+            editor->confirmComposition();
+    } else
+        editor->insertText(String(text), 0);
+
     return true;
 }
 
index 80abf813eebf962165e20e9952bdd69cac02f1da..cc25c8467193734d1c8a68bf39d255c50e9d5609 100644 (file)
@@ -105,6 +105,7 @@ public:
         int selectionStart,
         int selectionEnd);
     virtual bool confirmComposition();
+    virtual bool confirmComposition(const WebString& text);
     virtual WebTextInputType textInputType();
     virtual WebRect caretOrSelectionBounds();
     virtual void setTextDirection(WebTextDirection direction);
index b68980f97faf43ec76303d57583986871b268373..4b6b1238ad9bc9b1054ffb11060d9db3121e7c2b 100644 (file)
@@ -139,6 +139,7 @@ public:
         int selectionStart,
         int selectionEnd) { return true; }
     virtual bool confirmComposition() { return true; }
+    virtual bool confirmComposition(const WebString& text) { return true; }
     virtual WebTextInputType textInputType() { return WebKit::WebTextInputTypeNone; }
     virtual WebRect caretOrSelectionBounds() { return WebRect(); }
     virtual void setTextDirection(WebTextDirection) { }
index d2e2c22199c1bbe555b67e7fc07b067483813929..483c8b660ff651039a0abc49a7dbb4b6f550cf12 100644 (file)
@@ -1096,9 +1096,12 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev)
         setSelectionRange(node, start, start + ev->replacementLength());
         // Commit regardless of whether commitString is empty, to get rid of selection.
         editor->confirmComposition(ev->commitString());
-    } else if (!ev->commitString().isEmpty())
-        editor->confirmComposition(ev->commitString());
-    else if (!hasSelection && !ev->preeditString().isEmpty())
+    } else if (!ev->commitString().isEmpty()) {
+        if (editor->hasComposition())
+            editor->confirmComposition(ev->commitString());
+        else
+            editor->insertText(ev->commitString(), 0);
+    } else if (!hasSelection && !ev->preeditString().isEmpty())
         editor->setComposition(ev->preeditString(), underlines, 0, 0);
     else if (ev->preeditString().isEmpty() && editor->hasComposition())
         editor->confirmComposition(String());
index a57a323e4bb50d9690fbaf37e8b1d1304b33d0d3..886d9ac80821b85513fe771c044d156b82f37920 100644 (file)
@@ -1,3 +1,15 @@
+2011-01-04  Zhe Su  <suzhe@chromium.org>
+
+        Reviewed by Kenneth Russell.
+
+        Fix test LayoutTests/fast/events/ime-composition-events-001.html.
+
+        https://bugs.webkit.org/show_bug.cgi?id=51693
+
+        * Api/qwebpage.cpp:
+        (QWebPagePrivate::inputMethodEvent): Calls editor->insertText() to
+        insert the commit string when no composition text is available.
+
 2011-01-03  Yi Shen  <yi.4.shen@nokia.com>
 
         Reviewed by Adam Barth.