Changeset 102488 in webkit


Ignore:
Timestamp:
Dec 9, 2011 3:53:35 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[Qt] Click's count is limited to three continuous clicks.
https://bugs.webkit.org/show_bug.cgi?id=45666

Patch by Hugo Parente Lima <Hugo Parente Lima> on 2011-12-09
Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

Make Qt recognize "infinite" continuous mouse clicks.
handleMouseDoubleClickEvent merged into handleMousePressEvent.

  • UIProcess/qt/QtWebPageEventHandler.cpp:

(QtWebPageEventHandler::QtWebPageEventHandler):
(QtWebPageEventHandler::handleEvent):
(QtWebPageEventHandler::handleMousePressEvent):
(QtWebPageEventHandler::timerEvent):

  • UIProcess/qt/QtWebPageEventHandler.h:

Tools:

Update m_time at every call to leapForward, so double clicks
event are correctly sent by EventSender.

  • WebKitTestRunner/qt/EventSenderProxyQt.cpp:

(WTR::EventSenderProxy::updateClickCountForButton):
(WTR::EventSenderProxy::leapForward):

LayoutTests:

Enable fast/events/click-count.html for qt and disable for qt-wk1.

  • platform/qt-wk1/Skipped:
  • platform/qt/Skipped:
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r102486 r102488  
     12011-12-09  Hugo Parente Lima  <hugo.lima@openbossa.org>
     2
     3        [Qt] Click's count is limited to three continuous clicks.
     4        https://bugs.webkit.org/show_bug.cgi?id=45666
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Enable fast/events/click-count.html for qt and disable for qt-wk1.
     9
     10        * platform/qt-wk1/Skipped:
     11        * platform/qt/Skipped:
     12
    1132011-12-09  Tony Chang  <tony@chromium.org>
    214
  • trunk/LayoutTests/platform/qt-wk1/Skipped

    r102117 r102488  
    55fast/events/dont-loose-last-event.html
    66
     7# This has been fixed only on qt-wk2
     8# https://bugs.webkit.org/show_bug.cgi?id=45666
     9fast/events/click-count.html
     10
    711# [Qt] http/tests/misc/drag-over-iframe-invalid-source-crash.html and fast/events/drag-selects-image.html fails with timeout
    812# https://bugs.webkit.org/show_bug.cgi?id=73901
  • trunk/LayoutTests/platform/qt/Skipped

    r102300 r102488  
    11311131fast/encoding/GBK/x-gbk.html
    11321132fast/events/autoscroll.html
    1133 fast/events/click-count.html
    11341133fast/events/content-changed-during-drop.html
    11351134fast/events/js-keyboard-event-creation.html
  • trunk/Source/WebKit2/ChangeLog

    r102484 r102488  
     12011-12-09  Hugo Parente Lima  <hugo.lima@openbossa.org>
     2
     3        [Qt] Click's count is limited to three continuous clicks.
     4        https://bugs.webkit.org/show_bug.cgi?id=45666
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Make Qt recognize "infinite" continuous mouse clicks.
     9        handleMouseDoubleClickEvent merged into handleMousePressEvent.
     10
     11        * UIProcess/qt/QtWebPageEventHandler.cpp:
     12        (QtWebPageEventHandler::QtWebPageEventHandler):
     13        (QtWebPageEventHandler::handleEvent):
     14        (QtWebPageEventHandler::handleMousePressEvent):
     15        (QtWebPageEventHandler::timerEvent):
     16        * UIProcess/qt/QtWebPageEventHandler.h:
     17
    1182011-12-09  Sam Weinig  <sam@webkit.org>
    219
  • trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp

    r102136 r102488  
    8484    , m_pinchGestureRecognizer(this)
    8585    , m_tapGestureRecognizer(this)
     86    , m_previousClickButton(Qt::NoButton)
     87    , m_clickCount(0)
    8688{
    8789}
     
    9597    switch (ev->type()) {
    9698    case QEvent::MouseMove:
    97         return handleMouseMoveEvent(reinterpret_cast<QMouseEvent*>(ev));
     99        return handleMouseMoveEvent(static_cast<QMouseEvent*>(ev));
    98100    case QEvent::MouseButtonPress:
    99         return handleMousePressEvent(reinterpret_cast<QMouseEvent*>(ev));
     101    case QEvent::MouseButtonDblClick:
     102        // If a MouseButtonDblClick was received then we got a MouseButtonPress before
     103        // handleMousePressEvent will take care of double clicks.
     104        return handleMousePressEvent(static_cast<QMouseEvent*>(ev));
    100105    case QEvent::MouseButtonRelease:
    101         return handleMouseReleaseEvent(reinterpret_cast<QMouseEvent*>(ev));
    102     case QEvent::MouseButtonDblClick:
    103         return handleMouseDoubleClickEvent(reinterpret_cast<QMouseEvent*>(ev));
     106        return handleMouseReleaseEvent(static_cast<QMouseEvent*>(ev));
    104107    case QEvent::Wheel:
    105         return handleWheelEvent(reinterpret_cast<QWheelEvent*>(ev));
     108        return handleWheelEvent(static_cast<QWheelEvent*>(ev));
    106109    case QEvent::HoverLeave:
    107         return handleHoverLeaveEvent(reinterpret_cast<QHoverEvent*>(ev));
     110        return handleHoverLeaveEvent(static_cast<QHoverEvent*>(ev));
    108111    case QEvent::HoverEnter: // Fall-through, for WebKit the distinction doesn't matter.
    109112    case QEvent::HoverMove:
    110         return handleHoverMoveEvent(reinterpret_cast<QHoverEvent*>(ev));
     113        return handleHoverMoveEvent(static_cast<QHoverEvent*>(ev));
    111114    case QEvent::DragEnter:
    112         return handleDragEnterEvent(reinterpret_cast<QDragEnterEvent*>(ev));
     115        return handleDragEnterEvent(static_cast<QDragEnterEvent*>(ev));
    113116    case QEvent::DragLeave:
    114         return handleDragLeaveEvent(reinterpret_cast<QDragLeaveEvent*>(ev));
     117        return handleDragLeaveEvent(static_cast<QDragLeaveEvent*>(ev));
    115118    case QEvent::DragMove:
    116         return handleDragMoveEvent(reinterpret_cast<QDragMoveEvent*>(ev));
     119        return handleDragMoveEvent(static_cast<QDragMoveEvent*>(ev));
    117120    case QEvent::Drop:
    118         return handleDropEvent(reinterpret_cast<QDropEvent*>(ev));
     121        return handleDropEvent(static_cast<QDropEvent*>(ev));
    119122    case QEvent::KeyPress:
    120         return handleKeyPressEvent(reinterpret_cast<QKeyEvent*>(ev));
     123        return handleKeyPressEvent(static_cast<QKeyEvent*>(ev));
    121124    case QEvent::KeyRelease:
    122         return handleKeyReleaseEvent(reinterpret_cast<QKeyEvent*>(ev));
     125        return handleKeyReleaseEvent(static_cast<QKeyEvent*>(ev));
    123126    case QEvent::FocusIn:
    124         return handleFocusInEvent(reinterpret_cast<QFocusEvent*>(ev));
     127        return handleFocusInEvent(static_cast<QFocusEvent*>(ev));
    125128    case QEvent::FocusOut:
    126         return handleFocusOutEvent(reinterpret_cast<QFocusEvent*>(ev));
     129        return handleFocusOutEvent(static_cast<QFocusEvent*>(ev));
    127130    case QEvent::TouchBegin:
    128131    case QEvent::TouchEnd:
     
    155158bool QtWebPageEventHandler::handleMousePressEvent(QMouseEvent* ev)
    156159{
    157     if (m_tripleClickTimer.isActive() && (ev->pos() - m_tripleClick).manhattanLength() < qApp->styleHints()->startDragDistance()) {
    158         m_webPageProxy->handleMouseEvent(NativeWebMouseEvent(ev, /*eventClickCount*/ 3));
    159         return ev->isAccepted();
    160     }
    161 
    162     m_webPageProxy->handleMouseEvent(NativeWebMouseEvent(ev, /*eventClickCount*/ 1));
     160    if (m_clickTimer.isActive()
     161        && m_previousClickButton == ev->button()
     162        && (ev->pos() - m_lastClick).manhattanLength() < qApp->styleHints()->startDragDistance()) {
     163        m_clickCount++;
     164    } else {
     165        m_clickCount = 1;
     166        m_previousClickButton = ev->button();
     167    }
     168
     169    m_webPageProxy->handleMouseEvent(NativeWebMouseEvent(ev, m_clickCount));
     170
     171    m_lastClick = ev->pos();
     172    m_clickTimer.start(qApp->styleHints()->mouseDoubleClickInterval(), this);
    163173    return ev->isAccepted();
    164174}
     
    167177{
    168178    m_webPageProxy->handleMouseEvent(NativeWebMouseEvent(ev, /*eventClickCount*/ 0));
    169     return ev->isAccepted();
    170 }
    171 
    172 bool QtWebPageEventHandler::handleMouseDoubleClickEvent(QMouseEvent* ev)
    173 {
    174     m_webPageProxy->handleMouseEvent(NativeWebMouseEvent(ev, /*eventClickCount*/ 2));
    175 
    176     m_tripleClickTimer.start(qApp->styleHints()->mouseDoubleClickInterval(), this);
    177     m_tripleClick = ev->localPos().toPoint();
    178179    return ev->isAccepted();
    179180}
     
    273274{
    274275    int timerId = ev->timerId();
    275     if (timerId == m_tripleClickTimer.timerId())
    276         m_tripleClickTimer.stop();
     276    if (timerId == m_clickTimer.timerId())
     277        m_clickTimer.stop();
    277278    else
    278279        QObject::timerEvent(ev);
  • trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h

    r102136 r102488  
    7474    bool handleMousePressEvent(QMouseEvent*);
    7575    bool handleMouseReleaseEvent(QMouseEvent*);
    76     bool handleMouseDoubleClickEvent(QMouseEvent*);
    7776    bool handleWheelEvent(QWheelEvent*);
    7877    bool handleHoverLeaveEvent(QHoverEvent*);
     
    8786    void touchEvent(QTouchEvent*);
    8887
    89     QPoint m_tripleClick;
    90     QBasicTimer m_tripleClickTimer;
     88    QPoint m_lastClick;
     89    QBasicTimer m_clickTimer;
     90    Qt::MouseButton m_previousClickButton;
     91    int m_clickCount;
    9192};
    9293
  • trunk/Tools/ChangeLog

    r102487 r102488  
     12011-12-09  Hugo Parente Lima  <hugo.lima@openbossa.org>
     2
     3        [Qt] Click's count is limited to three continuous clicks.
     4        https://bugs.webkit.org/show_bug.cgi?id=45666
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Update m_time at every call to leapForward, so double clicks
     9        event are correctly sent by EventSender.
     10
     11        * WebKitTestRunner/qt/EventSenderProxyQt.cpp:
     12        (WTR::EventSenderProxy::updateClickCountForButton):
     13        (WTR::EventSenderProxy::leapForward):
     14
    1152011-12-09  Kentaro Hara  <haraken@chromium.org>
    216
  • trunk/Tools/WebKitTestRunner/qt/EventSenderProxyQt.cpp

    r102048 r102488  
    247247void EventSenderProxy::updateClickCountForButton(int button)
    248248{
    249     if (m_time - m_clickTime < QApplication::doubleClickInterval() / 1000.0 && m_position == m_clickPosition && button == m_clickButton) {
     249    if (m_time - m_clickTime < QApplication::doubleClickInterval() && m_position == m_clickPosition && button == m_clickButton) {
    250250        ++m_clickCount;
    251251        m_clickTime = m_time;
     
    307307{
    308308    eventQueue[endOfQueue].m_delay = ms;
     309    m_time += ms;
    309310}
    310311
Note: See TracChangeset for help on using the changeset viewer.