diff options
author | Steve Block <steveblock@google.com> | 2010-04-27 16:31:00 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-05-11 14:42:12 +0100 |
commit | dcc8cf2e65d1aa555cce12431a16547e66b469ee (patch) | |
tree | 92a8d65cd5383bca9749f5327fb5e440563926e6 /WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp | |
parent | ccac38a6b48843126402088a309597e682f40fe6 (diff) | |
download | external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2 |
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp')
-rw-r--r-- | WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp index 1ef2d3f..7432052 100644 --- a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp @@ -67,6 +67,8 @@ EventSender::EventSender(QWebPage* parent) endOfQueue = 0; startOfQueue = 0; m_eventLoop = 0; + m_currentButton = 0; + resetClickCount(); m_page->view()->installEventFilter(this); } @@ -92,11 +94,28 @@ void EventSender::mouseDown(int button) break; } + // only consider a click to count, an event originated by the + // same previous button and at the same position. + if (m_currentButton == button + && m_mousePos == m_clickPos + && m_clickTimer.isActive()) + m_clickCount++; + else + m_clickCount = 1; + + m_currentButton = button; + m_clickPos = m_mousePos; m_mouseButtons |= mouseButton; // qDebug() << "EventSender::mouseDown" << frame; - QMouseEvent* event = new QMouseEvent(QEvent::MouseButtonPress, m_mousePos, m_mousePos, mouseButton, m_mouseButtons, Qt::NoModifier); + QMouseEvent* event; + event = new QMouseEvent((m_clickCount == 2) ? QEvent::MouseButtonDblClick : + QEvent::MouseButtonPress, m_mousePos, m_mousePos, + mouseButton, m_mouseButtons, Qt::NoModifier); + sendOrQueueEvent(event); + + m_clickTimer.start(QApplication::doubleClickInterval(), this); } void EventSender::mouseUp(int button) @@ -289,11 +308,15 @@ void EventSender::scheduleAsynchronousClick() void EventSender::addTouchPoint(int x, int y) { #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) - int id = m_touchPoints.count(); + // Use index to refer to the position in the vector that this touch + // is stored. We then create a unique id for the touch that will be + // passed into WebCore. + int index = m_touchPoints.count(); + int id = m_touchPoints.isEmpty() ? 0 : m_touchPoints.last().id() + 1; QTouchEvent::TouchPoint point(id); m_touchPoints.append(point); - updateTouchPoint(id, x, y); - m_touchPoints[id].setState(Qt::TouchPointPressed); + updateTouchPoint(index, x, y); + m_touchPoints[index].setState(Qt::TouchPointPressed); #endif } @@ -510,3 +533,8 @@ bool EventSender::eventFilter(QObject* watched, QEvent* event) } return false; } + +void EventSender::timerEvent(QTimerEvent* ev) +{ + m_clickTimer.stop(); +} |