From df7669b7f41f4284e297c0e8d56b3d71019625d0 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 1 Oct 2009 12:43:49 +0000 Subject: 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 --- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 28 ++++++++++++++++++++++++++ src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h | 2 ++ src/3rdparty/webkit/WebKit/qt/ChangeLog | 15 ++++++++++++++ 3 files changed, 45 insertions(+) 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 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 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 + + 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 Reviewed by Simon Hausmann. -- cgit v0.12