diff options
Diffstat (limited to 'src/3rdparty/webkit/WebKit')
5 files changed, 49 insertions, 19 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/declarative/qdeclarativewebview.cpp b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp index e4f70de..7a8aae7 100644 --- a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp @@ -141,6 +141,16 @@ void GraphicsWebView::mouseMoveEvent(QGraphicsSceneMouseEvent* event) QGraphicsWebView::mouseMoveEvent(event); } +bool GraphicsWebView::sceneEvent(QEvent *event) +{ + bool rv = QGraphicsWebView::sceneEvent(event); + if (event->type() == QEvent::UngrabMouse) { + pressTimer.stop(); + parent->setKeepMouseGrab(false); + } + return rv; +} + /*! \qmlclass WebView QDeclarativeWebView \ingroup qml-view-elements diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview_p.h b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview_p.h index b2055bf..ca15a1e 100644 --- a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview_p.h +++ b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview_p.h @@ -70,6 +70,8 @@ protected: void mouseMoveEvent(QGraphicsSceneMouseEvent* event); void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); void timerEvent(QTimerEvent* event); + bool sceneEvent(QEvent *event); + Q_SIGNALS: void doubleClick(int clickX, int clickY); private: diff --git a/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri b/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri index f2282f8..b98617f 100644 --- a/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri +++ b/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri @@ -1,5 +1,5 @@ -QT_WEBKIT_VERSION = 4.7.1 +QT_WEBKIT_VERSION = 4.7.2 QT_WEBKIT_MAJOR_VERSION = 4 QT_WEBKIT_MINOR_VERSION = 7 -QT_WEBKIT_PATCH_VERSION = 1 +QT_WEBKIT_PATCH_VERSION = 2 QT_CONFIG += webkit 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); |