diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2009-10-01 12:43:49 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-10-01 12:49:27 (GMT) |
commit | df7669b7f41f4284e297c0e8d56b3d71019625d0 (patch) | |
tree | 1d5635bdc16a98e90de12766f2493c2f467f8883 /src | |
parent | 976adc629192d42882eeba33d5b398618d4445b1 (diff) | |
download | Qt-df7669b7f41f4284e297c0e8d56b3d71019625d0.zip Qt-df7669b7f41f4284e297c0e8d56b3d71019625d0.tar.gz Qt-df7669b7f41f4284e297c0e8d56b3d71019625d0.tar.bz2 |
Fixed software input panel support on web input elements.
Patch by axis on 2009-10-01
Reviewed by Simon Hausmann.
Send the RequestSoftwareInputPanel event if the element supports focus
and the element is clicked.
* Api/qwebpage.cpp:
(QWebPagePrivate::QWebPagePrivate):
(QWebPagePrivate::mousePressEvent):
(QWebPagePrivate::mouseReleaseEvent):
* Api/qwebpage_p.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48968 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Signed-off-by: Simon Hausmann <simon.hausmann@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 28 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h | 2 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/ChangeLog | 15 |
3 files changed, 45 insertions, 0 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 000b895..d1a4059 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -267,6 +267,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) , inspector(0) , inspectorIsInternalOnly(false) , viewportSize(QSize(0, 0)) + , clickCausedFocus(false) { WebCore::InitializeLoggingChannelsIfNecessary(); JSC::initializeThreading(); @@ -632,6 +633,11 @@ void QWebPagePrivate::mousePressEvent(QMouseEvent *ev) if (!frame->view()) return; + RefPtr<WebCore::Node> oldNode; + if (page->focusController()->focusedFrame() + && page->focusController()->focusedFrame()->document()) + oldNode = page->focusController()->focusedFrame()->document()->focusedNode(); + if (tripleClickTimer.isActive() && (ev->pos() - tripleClick).manhattanLength() < QApplication::startDragDistance()) { @@ -645,6 +651,14 @@ void QWebPagePrivate::mousePressEvent(QMouseEvent *ev) if (mev.button() != NoButton) accepted = frame->eventHandler()->handleMousePressEvent(mev); ev->setAccepted(accepted); + + RefPtr<WebCore::Node> newNode; + if (page->focusController()->focusedFrame() + && page->focusController()->focusedFrame()->document()) + newNode = page->focusController()->focusedFrame()->document()->focusedNode(); + + if (newNode && oldNode != newNode) + clickCausedFocus = true; } void QWebPagePrivate::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *ev) @@ -750,6 +764,20 @@ void QWebPagePrivate::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev) ev->setAccepted(accepted); handleClipboard(ev, ev->button()); + +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + if (view && view->testAttribute(Qt::WA_InputMethodEnabled) + && ev->button() == Qt::LeftButton && qApp->autoSipEnabled()) { + QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( + view->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); + if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) { + QEvent event(QEvent::RequestSoftwareInputPanel); + QApplication::sendEvent(view, &event); + } + } + + clickCausedFocus = false; +#endif } void QWebPagePrivate::mouseReleaseEvent(QMouseEvent *ev) diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h index 9f4216a..d41471a 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h @@ -143,6 +143,8 @@ public: QPoint tripleClick; QBasicTimer tripleClickTimer; + bool clickCausedFocus; + #if QT_VERSION < 0x040400 bool acceptNavigationRequest(QWebFrame *frame, const QWebNetworkRequest &request, QWebPage::NavigationType type); diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index a78f573..8b9b14f 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,18 @@ +2009-10-01 Kristian Amlie <kristian.amlie@nokia.com> + + Reviewed by Simon Hausmann. + + Fixed software input panel support on web input elements. + + Send the RequestSoftwareInputPanel event if the element supports focus + and the element is clicked. + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + (QWebPagePrivate::mousePressEvent): + (QWebPagePrivate::mouseReleaseEvent): + * Api/qwebpage_p.h: + 2009-10-01 Joe Ligman <joseph.ligman@nokia.com> Reviewed by Simon Hausmann. |