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

andreas.kling at nokia.com andreas.kling at nokia.com
Wed Dec 22 16:16:01 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit e325fc66d71307e04ec47f1e6165dff70c7967ac
Author: andreas.kling at nokia.com <andreas.kling at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Nov 20 08:15:10 2010 +0000

    2010-11-19  Kristian Amlie  <kristian.amlie at nokia.com>
    
            Reviewed by Andreas Kling.
    
            Fixed handling of QInputMethodEvents with nonzero replacementLength.
    
            These types of events replace text that is already in the widget, but
            WebKit did not check for replacementLength at all.
    
            Also made sure that the preeditString is always respected, even if
            there is committed text. This is how QLineEdit does it.
    
            https://bugs.webkit.org/show_bug.cgi?id=49787
    
            * Api/qwebpage.cpp:
            (QWebPagePrivate::inputMethodEvent):
            * tests/qwebpage/tst_qwebpage.cpp:
            (tst_QWebPage::inputMethods):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72471 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp
index 2e8c6b7..a81ad08 100644
--- a/WebKit/qt/Api/qwebpage.cpp
+++ b/WebKit/qt/Api/qwebpage.cpp
@@ -1080,9 +1080,15 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev)
         }
     }
 
-    if (!ev->commitString().isEmpty())
+    if (node && ev->replacementLength() > 0) {
+        int cursorPos = frame->selection()->extent().offsetInContainerNode();
+        int start = cursorPos + ev->replacementStart();
+        setSelectionRange(node, start, start + ev->replacementLength());
+        // Commit regardless of whether commitString is empty, to get rid of selection.
         editor->confirmComposition(ev->commitString());
-    else if (!hasSelection && !ev->preeditString().isEmpty())
+    } else if (!ev->commitString().isEmpty())
+        editor->confirmComposition(ev->commitString());
+    if (!hasSelection && !ev->preeditString().isEmpty())
         editor->setComposition(ev->preeditString(), underlines, 0, 0);
 
     ev->accept();
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 2fd32bf..eec494e 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,22 @@
+2010-11-19  Kristian Amlie  <kristian.amlie at nokia.com>
+
+        Reviewed by Andreas Kling.
+
+        Fixed handling of QInputMethodEvents with nonzero replacementLength.
+
+        These types of events replace text that is already in the widget, but
+        WebKit did not check for replacementLength at all.
+
+        Also made sure that the preeditString is always respected, even if
+        there is committed text. This is how QLineEdit does it.
+
+        https://bugs.webkit.org/show_bug.cgi?id=49787
+
+        * Api/qwebpage.cpp:
+        (QWebPagePrivate::inputMethodEvent):
+        * tests/qwebpage/tst_qwebpage.cpp:
+        (tst_QWebPage::inputMethods):
+
 2010-11-19  Benjamin Poulain  <benjamin.poulain at nokia.com>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index 413984a..1f6ada0 100644
--- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -1568,6 +1568,20 @@ void tst_QWebPage::inputMethods()
     page->event(&evpres);
     page->event(&evrel);
 
+    {
+        QList<QInputMethodEvent::Attribute> attributes;
+        QInputMethodEvent event(QString(), attributes);
+        event.setCommitString("XXX", 0, 0);
+        page->event(&event);
+        event.setCommitString(QString(), -2, 2); // Erase two characters.
+        page->event(&event);
+        event.setCommitString(QString(), -1, 1); // Erase one character.
+        page->event(&event);
+        variant = page->inputMethodQuery(Qt::ImSurroundingText);
+        value = variant.value<QString>();
+        QCOMPARE(value, QString("QtWebKit"));
+    }
+
     //Move to the start of the line
     page->triggerAction(QWebPage::MoveToStartOfLine);
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list