summaryrefslogtreecommitdiffstats
path: root/src/3rdparty
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2010-11-19 14:33:07 (GMT)
committeraxis <qt-info@nokia.com>2010-11-19 14:33:07 (GMT)
commit7eb9cf865f2b40ca3ca4bf8655b6bb6d40d6fcdd (patch)
tree322edf52459169ad0d5a93c765487b961968586e /src/3rdparty
parent4b380543cc973d575a3ed0c77918adbe5b6133f0 (diff)
parentf234f248fa8f0d2bb74a14f5ee3cb489f256c0f2 (diff)
downloadQt-7eb9cf865f2b40ca3ca4bf8655b6bb6d40d6fcdd.zip
Qt-7eb9cf865f2b40ca3ca4bf8655b6bb6d40d6fcdd.tar.gz
Qt-7eb9cf865f2b40ca3ca4bf8655b6bb6d40d6fcdd.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7-s60
Conflicts: src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
Diffstat (limited to 'src/3rdparty')
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp38
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp14
2 files changed, 35 insertions, 17 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
index 9b97c8b..5bb3c57 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
@@ -1351,26 +1351,30 @@ 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 {
- // 1. empty preedit with a selection attribute, and start/end of 0 cancels composition
- // 2. empty preedit with a selection attribute, and start/end of non-0 updates selection of current preedit text
- // 3. populated preedit with a selection attribute, and start/end of 0 or non-0 updates selection of supplied preedit text
- // 4. otherwise event is updating supplied pre-edit text
- QString preedit = ev->preeditString();
+ } else if (!ev->commitString().isEmpty()) {
+ editor->confirmComposition(ev->commitString());
+ }
+ // 1. empty preedit with a selection attribute, and start/end of 0 cancels composition
+ // 2. empty preedit with a selection attribute, and start/end of non-0 updates selection of current preedit text
+ // 3. populated preedit with a selection attribute, and start/end of 0 or non-0 updates selection of supplied preedit text
+ // 4. otherwise event is updating supplied pre-edit text
+ QString preedit = ev->preeditString();
#if QT_VERSION >= 0x040600
- if (hasSelection) {
- QString text = (renderTextControl) ? QString(renderTextControl->text()) : QString();
- if (preedit.isEmpty() && selection.start + selection.length > 0)
- preedit = text;
- editor->setComposition(preedit, underlines,
- (selection.length < 0) ? selection.start + selection.length : selection.start,
- (selection.length < 0) ? selection.start : selection.start + selection.length);
- } else
+ if (hasSelection) {
+ QString text = (renderTextControl) ? QString(renderTextControl->text()) : QString();
+ if (preedit.isEmpty() && selection.start + selection.length > 0)
+ preedit = text;
+ editor->setComposition(preedit, underlines,
+ (selection.length < 0) ? selection.start + selection.length : selection.start,
+ (selection.length < 0) ? selection.start : selection.start + selection.length);
+ } else
#endif
- editor->setComposition(preedit, underlines, preedit.length(), 0);
- }
+ editor->setComposition(preedit, underlines, preedit.length(), 0);
ev->accept();
}
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 b7ffb8a..31cf277 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -1502,6 +1502,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"));
+ }
+
// Cancel current composition first
inputAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 0, 0, QVariant());
QInputMethodEvent eventSelection4("", inputAttributes);