summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-11-22 08:06:10 +0100
committerQt Continuous Integration System <qt-info@nokia.com>2010-11-22 08:06:10 +0100
commit3e833cbf5e2d351d548a83f5d0c922760f775a43 (patch)
treec5a10ce71ad0b8f60e351ba5ffe8cb8aea091dba
parentab794fe3a0d2992d770c09527c479a563f21164e (diff)
parentf234f248fa8f0d2bb74a14f5ee3cb489f256c0f2 (diff)
downloadqt4-tools-3e833cbf5e2d351d548a83f5d0c922760f775a43.tar.gz
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public: Fixed handling of QInputMethodEvents with nonzero replacementLength.
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp10
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp14
2 files changed, 22 insertions, 2 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
index ff92f0bc97..d9a2cbeb11 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
@@ -1257,9 +1257,15 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev)
}
}
- if (!ev->commitString().isEmpty())
+ if (renderTextControl && ev->replacementLength() > 0) {
+ renderTextControl->setSelectionStart(qMax(renderTextControl->selectionStart() + ev->replacementStart(), 0));
+ renderTextControl->setSelectionEnd(qMin(renderTextControl->selectionStart() + ev->replacementLength(), static_cast<int>(renderTextControl->text().length())));
+ // Commit regardless of whether commitString is empty, to get rid of selection.
editor->confirmComposition(ev->commitString());
- else if (!ev->preeditString().isEmpty()) {
+ } else if (!ev->commitString().isEmpty()) {
+ editor->confirmComposition(ev->commitString());
+ }
+ if (!ev->preeditString().isEmpty()) {
QString preedit = ev->preeditString();
editor->setComposition(preedit, underlines, preedit.length(), 0);
}
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index 55ee42abb6..b566365a3c 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -1494,6 +1494,20 @@ void tst_QWebPage::inputMethods()
QCOMPARE(value, QString("QtWebKit"));
#endif
+ {
+ 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"));
+ }
+
//ImhHiddenText
QMouseEvent evpresPassword(QEvent::MouseButtonPress, inputs.at(1).geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
page->event(&evpresPassword);