Changeset 48968 in webkit


Ignore:
Timestamp:
Oct 1, 2009 5:43:49 AM (15 years ago)
Author:
Simon Hausmann
Message:

Fixed software input panel support on web input elements.

Patch by Kristian Amlie <kristian.amlie@nokia.com> 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:
Location:
trunk/WebKit/qt
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/qt/Api/qwebpage.cpp

    r48967 r48968  
    268268    , inspectorIsInternalOnly(false)
    269269    , viewportSize(QSize(0, 0))
     270    , clickCausedFocus(false)
    270271{
    271272    WebCore::InitializeLoggingChannelsIfNecessary();
     
    633634        return;
    634635
     636    RefPtr<WebCore::Node> oldNode;
     637    if (page->focusController()->focusedFrame()
     638        && page->focusController()->focusedFrame()->document())
     639        oldNode = page->focusController()->focusedFrame()->document()->focusedNode();
     640
    635641    if (tripleClickTimer.isActive()
    636642            && (ev->pos() - tripleClick).manhattanLength()
     
    646652        accepted = frame->eventHandler()->handleMousePressEvent(mev);
    647653    ev->setAccepted(accepted);
     654
     655    RefPtr<WebCore::Node> newNode;
     656    if (page->focusController()->focusedFrame()
     657        && page->focusController()->focusedFrame()->document())
     658        newNode = page->focusController()->focusedFrame()->document()->focusedNode();
     659
     660    if (newNode && oldNode != newNode)
     661        clickCausedFocus = true;
    648662}
    649663
     
    751765
    752766    handleClipboard(ev, ev->button());
     767
     768#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
     769    if (view && view->testAttribute(Qt::WA_InputMethodEnabled)
     770        && ev->button() == Qt::LeftButton && qApp->autoSipEnabled()) {
     771        QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel(
     772            view->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
     773        if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) {
     774            QEvent event(QEvent::RequestSoftwareInputPanel);
     775            QApplication::sendEvent(view, &event);
     776        }
     777    }
     778
     779    clickCausedFocus = false;
     780#endif
    753781}
    754782
  • trunk/WebKit/qt/Api/qwebpage_p.h

    r48604 r48968  
    144144    QBasicTimer tripleClickTimer;
    145145
     146    bool clickCausedFocus;
     147
    146148#if QT_VERSION < 0x040400
    147149    bool acceptNavigationRequest(QWebFrame *frame, const QWebNetworkRequest &request, QWebPage::NavigationType type);
  • trunk/WebKit/qt/ChangeLog

    r48967 r48968  
     12009-10-01  Kristian Amlie  <kristian.amlie@nokia.com>
     2
     3        Reviewed by Simon Hausmann.
     4
     5        Fixed software input panel support on web input elements.
     6
     7        Send the RequestSoftwareInputPanel event if the element supports focus
     8        and the element is clicked.
     9
     10        * Api/qwebpage.cpp:
     11        (QWebPagePrivate::QWebPagePrivate):
     12        (QWebPagePrivate::mousePressEvent):
     13        (QWebPagePrivate::mouseReleaseEvent):
     14        * Api/qwebpage_p.h:
     15
    1162009-10-01  Joe Ligman  <joseph.ligman@nokia.com>
    217
Note: See TracChangeset for help on using the changeset viewer.