- Revision
- 102488
- Author
- [email protected]
- Date
- 2011-12-09 15:53:35 -0800 (Fri, 09 Dec 2011)
Log 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 <[email protected]> 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:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (102487 => 102488)
--- trunk/LayoutTests/ChangeLog 2011-12-09 23:50:58 UTC (rev 102487)
+++ trunk/LayoutTests/ChangeLog 2011-12-09 23:53:35 UTC (rev 102488)
@@ -1,3 +1,15 @@
+2011-12-09 Hugo Parente Lima <[email protected]>
+
+ [Qt] Click's count is limited to three continuous clicks.
+ https://bugs.webkit.org/show_bug.cgi?id=45666
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Enable fast/events/click-count.html for qt and disable for qt-wk1.
+
+ * platform/qt-wk1/Skipped:
+ * platform/qt/Skipped:
+
2011-12-09 Tony Chang <[email protected]>
add css parsing for flex-flow: wrap and wrap-reverse
Modified: trunk/LayoutTests/platform/qt/Skipped (102487 => 102488)
--- trunk/LayoutTests/platform/qt/Skipped 2011-12-09 23:50:58 UTC (rev 102487)
+++ trunk/LayoutTests/platform/qt/Skipped 2011-12-09 23:53:35 UTC (rev 102488)
@@ -1130,7 +1130,6 @@
fast/encoding/GBK/x-euc-cn.html
fast/encoding/GBK/x-gbk.html
fast/events/autoscroll.html
-fast/events/click-count.html
fast/events/content-changed-during-drop.html
fast/events/js-keyboard-event-creation.html
fast/events/keypress-insert-tab.html
Modified: trunk/LayoutTests/platform/qt-wk1/Skipped (102487 => 102488)
--- trunk/LayoutTests/platform/qt-wk1/Skipped 2011-12-09 23:50:58 UTC (rev 102487)
+++ trunk/LayoutTests/platform/qt-wk1/Skipped 2011-12-09 23:53:35 UTC (rev 102488)
@@ -4,6 +4,10 @@
# https://bugs.webkit.org/show_bug.cgi?id=73366
fast/events/dont-loose-last-event.html
+# This has been fixed only on qt-wk2
+# https://bugs.webkit.org/show_bug.cgi?id=45666
+fast/events/click-count.html
+
# [Qt] http/tests/misc/drag-over-iframe-invalid-source-crash.html and fast/events/drag-selects-image.html fails with timeout
# https://bugs.webkit.org/show_bug.cgi?id=73901
http/tests/misc/drag-over-iframe-invalid-source-crash.html
Modified: trunk/Source/WebKit2/ChangeLog (102487 => 102488)
--- trunk/Source/WebKit2/ChangeLog 2011-12-09 23:50:58 UTC (rev 102487)
+++ trunk/Source/WebKit2/ChangeLog 2011-12-09 23:53:35 UTC (rev 102488)
@@ -1,3 +1,20 @@
+2011-12-09 Hugo Parente Lima <[email protected]>
+
+ [Qt] Click's count is limited to three continuous clicks.
+ https://bugs.webkit.org/show_bug.cgi?id=45666
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ 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:
+
2011-12-09 Sam Weinig <[email protected]>
Expose a WKConnectionRef which represents the connection to/from the WebProcess/UIProcess
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp (102487 => 102488)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp 2011-12-09 23:50:58 UTC (rev 102487)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp 2011-12-09 23:53:35 UTC (rev 102488)
@@ -83,6 +83,8 @@
, m_panGestureRecognizer(this)
, m_pinchGestureRecognizer(this)
, m_tapGestureRecognizer(this)
+ , m_previousClickButton(Qt::NoButton)
+ , m_clickCount(0)
{
}
@@ -94,36 +96,37 @@
{
switch (ev->type()) {
case QEvent::MouseMove:
- return handleMouseMoveEvent(reinterpret_cast<QMouseEvent*>(ev));
+ return handleMouseMoveEvent(static_cast<QMouseEvent*>(ev));
case QEvent::MouseButtonPress:
- return handleMousePressEvent(reinterpret_cast<QMouseEvent*>(ev));
+ case QEvent::MouseButtonDblClick:
+ // If a MouseButtonDblClick was received then we got a MouseButtonPress before
+ // handleMousePressEvent will take care of double clicks.
+ return handleMousePressEvent(static_cast<QMouseEvent*>(ev));
case QEvent::MouseButtonRelease:
- return handleMouseReleaseEvent(reinterpret_cast<QMouseEvent*>(ev));
- case QEvent::MouseButtonDblClick:
- return handleMouseDoubleClickEvent(reinterpret_cast<QMouseEvent*>(ev));
+ return handleMouseReleaseEvent(static_cast<QMouseEvent*>(ev));
case QEvent::Wheel:
- return handleWheelEvent(reinterpret_cast<QWheelEvent*>(ev));
+ return handleWheelEvent(static_cast<QWheelEvent*>(ev));
case QEvent::HoverLeave:
- return handleHoverLeaveEvent(reinterpret_cast<QHoverEvent*>(ev));
+ return handleHoverLeaveEvent(static_cast<QHoverEvent*>(ev));
case QEvent::HoverEnter: // Fall-through, for WebKit the distinction doesn't matter.
case QEvent::HoverMove:
- return handleHoverMoveEvent(reinterpret_cast<QHoverEvent*>(ev));
+ return handleHoverMoveEvent(static_cast<QHoverEvent*>(ev));
case QEvent::DragEnter:
- return handleDragEnterEvent(reinterpret_cast<QDragEnterEvent*>(ev));
+ return handleDragEnterEvent(static_cast<QDragEnterEvent*>(ev));
case QEvent::DragLeave:
- return handleDragLeaveEvent(reinterpret_cast<QDragLeaveEvent*>(ev));
+ return handleDragLeaveEvent(static_cast<QDragLeaveEvent*>(ev));
case QEvent::DragMove:
- return handleDragMoveEvent(reinterpret_cast<QDragMoveEvent*>(ev));
+ return handleDragMoveEvent(static_cast<QDragMoveEvent*>(ev));
case QEvent::Drop:
- return handleDropEvent(reinterpret_cast<QDropEvent*>(ev));
+ return handleDropEvent(static_cast<QDropEvent*>(ev));
case QEvent::KeyPress:
- return handleKeyPressEvent(reinterpret_cast<QKeyEvent*>(ev));
+ return handleKeyPressEvent(static_cast<QKeyEvent*>(ev));
case QEvent::KeyRelease:
- return handleKeyReleaseEvent(reinterpret_cast<QKeyEvent*>(ev));
+ return handleKeyReleaseEvent(static_cast<QKeyEvent*>(ev));
case QEvent::FocusIn:
- return handleFocusInEvent(reinterpret_cast<QFocusEvent*>(ev));
+ return handleFocusInEvent(static_cast<QFocusEvent*>(ev));
case QEvent::FocusOut:
- return handleFocusOutEvent(reinterpret_cast<QFocusEvent*>(ev));
+ return handleFocusOutEvent(static_cast<QFocusEvent*>(ev));
case QEvent::TouchBegin:
case QEvent::TouchEnd:
case QEvent::TouchUpdate:
@@ -154,12 +157,19 @@
bool QtWebPageEventHandler::handleMousePressEvent(QMouseEvent* ev)
{
- if (m_tripleClickTimer.isActive() && (ev->pos() - m_tripleClick).manhattanLength() < qApp->styleHints()->startDragDistance()) {
- m_webPageProxy->handleMouseEvent(NativeWebMouseEvent(ev, /*eventClickCount*/ 3));
- return ev->isAccepted();
+ if (m_clickTimer.isActive()
+ && m_previousClickButton == ev->button()
+ && (ev->pos() - m_lastClick).manhattanLength() < qApp->styleHints()->startDragDistance()) {
+ m_clickCount++;
+ } else {
+ m_clickCount = 1;
+ m_previousClickButton = ev->button();
}
- m_webPageProxy->handleMouseEvent(NativeWebMouseEvent(ev, /*eventClickCount*/ 1));
+ m_webPageProxy->handleMouseEvent(NativeWebMouseEvent(ev, m_clickCount));
+
+ m_lastClick = ev->pos();
+ m_clickTimer.start(qApp->styleHints()->mouseDoubleClickInterval(), this);
return ev->isAccepted();
}
@@ -169,15 +179,6 @@
return ev->isAccepted();
}
-bool QtWebPageEventHandler::handleMouseDoubleClickEvent(QMouseEvent* ev)
-{
- m_webPageProxy->handleMouseEvent(NativeWebMouseEvent(ev, /*eventClickCount*/ 2));
-
- m_tripleClickTimer.start(qApp->styleHints()->mouseDoubleClickInterval(), this);
- m_tripleClick = ev->localPos().toPoint();
- return ev->isAccepted();
-}
-
bool QtWebPageEventHandler::handleWheelEvent(QWheelEvent* ev)
{
m_webPageProxy->handleWheelEvent(NativeWebWheelEvent(ev));
@@ -272,8 +273,8 @@
void QtWebPageEventHandler::timerEvent(QTimerEvent* ev)
{
int timerId = ev->timerId();
- if (timerId == m_tripleClickTimer.timerId())
- m_tripleClickTimer.stop();
+ if (timerId == m_clickTimer.timerId())
+ m_clickTimer.stop();
else
QObject::timerEvent(ev);
}
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h (102487 => 102488)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h 2011-12-09 23:50:58 UTC (rev 102487)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h 2011-12-09 23:53:35 UTC (rev 102488)
@@ -73,7 +73,6 @@
bool handleMouseMoveEvent(QMouseEvent*);
bool handleMousePressEvent(QMouseEvent*);
bool handleMouseReleaseEvent(QMouseEvent*);
- bool handleMouseDoubleClickEvent(QMouseEvent*);
bool handleWheelEvent(QWheelEvent*);
bool handleHoverLeaveEvent(QHoverEvent*);
bool handleHoverMoveEvent(QHoverEvent*);
@@ -86,8 +85,10 @@
void touchEvent(QTouchEvent*);
- QPoint m_tripleClick;
- QBasicTimer m_tripleClickTimer;
+ QPoint m_lastClick;
+ QBasicTimer m_clickTimer;
+ Qt::MouseButton m_previousClickButton;
+ int m_clickCount;
};
#endif /* QtWebPageEventHandler_h */
Modified: trunk/Tools/ChangeLog (102487 => 102488)
--- trunk/Tools/ChangeLog 2011-12-09 23:50:58 UTC (rev 102487)
+++ trunk/Tools/ChangeLog 2011-12-09 23:53:35 UTC (rev 102488)
@@ -1,3 +1,17 @@
+2011-12-09 Hugo Parente Lima <[email protected]>
+
+ [Qt] Click's count is limited to three continuous clicks.
+ https://bugs.webkit.org/show_bug.cgi?id=45666
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ 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):
+
2011-12-09 Kentaro Hara <[email protected]>
[Refactoring] Reduce top-level code in prepare-ChangeLog
Modified: trunk/Tools/WebKitTestRunner/qt/EventSenderProxyQt.cpp (102487 => 102488)
--- trunk/Tools/WebKitTestRunner/qt/EventSenderProxyQt.cpp 2011-12-09 23:50:58 UTC (rev 102487)
+++ trunk/Tools/WebKitTestRunner/qt/EventSenderProxyQt.cpp 2011-12-09 23:53:35 UTC (rev 102488)
@@ -246,7 +246,7 @@
void EventSenderProxy::updateClickCountForButton(int button)
{
- if (m_time - m_clickTime < QApplication::doubleClickInterval() / 1000.0 && m_position == m_clickPosition && button == m_clickButton) {
+ if (m_time - m_clickTime < QApplication::doubleClickInterval() && m_position == m_clickPosition && button == m_clickButton) {
++m_clickCount;
m_clickTime = m_time;
return;
@@ -306,6 +306,7 @@
void EventSenderProxy::leapForward(int ms)
{
eventQueue[endOfQueue].m_delay = ms;
+ m_time += ms;
}
#if ENABLE(TOUCH_EVENTS)