Commit 40779bc1 authored by eric@webkit.org's avatar eric@webkit.org

2010-03-04 Diego Gonzalez <diego.gonzalez@openbossa.org>

        Reviewed by Simon Hausmann.

        Make Qt DumpRenderTree EventSender able to send double click events

        LayoutTests:
            fast/events/dblclick-addEventListener.html

        [Qt] DRT: Send double click event from EventSender
        https://bugs.webkit.org/show_bug.cgi?id=35255

        * platform/qt/Skipped:
2010-03-04  Diego Gonzalez  <diego.gonzalez@openbossa.org>

        Reviewed by Simon Hausmann.

        Make Qt DumpRenderTree EventSender able to send double click events

        LayoutTests:
            fast/events/dblclick-addEventListener.html

        [Qt] DRT: Send double click event from EventSender
        https://bugs.webkit.org/show_bug.cgi?id=35255

        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
        (WebCore::DumpRenderTree::resetToConsistentStateBeforeTesting):
        * DumpRenderTree/qt/EventSenderQt.cpp:
        (EventSender::EventSender):
        (EventSender::mouseDown):
        * DumpRenderTree/qt/EventSenderQt.h:
        (EventSender::resetClickCount):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55541 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f76a9bff
2010-03-04 Diego Gonzalez <diego.gonzalez@openbossa.org>
Reviewed by Simon Hausmann.
Make Qt DumpRenderTree EventSender able to send double click events
LayoutTests:
fast/events/dblclick-addEventListener.html
[Qt] DRT: Send double click event from EventSender
https://bugs.webkit.org/show_bug.cgi?id=35255
* platform/qt/Skipped:
2010-03-04 Shu Chang <Chang.Shu@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
......
......@@ -444,7 +444,6 @@ fast/events/5056619.html
fast/events/autoscroll.html
fast/events/click-count.html
fast/events/content-changed-during-drop.html
fast/events/dblclick-addEventListener.html
fast/events/drag-in-frames.html
fast/events/focusingUnloadedFrame.html
fast/events/js-keyboard-event-creation.html
......
2010-03-04 Diego Gonzalez <diego.gonzalez@openbossa.org>
Reviewed by Simon Hausmann.
Make Qt DumpRenderTree EventSender able to send double click events
LayoutTests:
fast/events/dblclick-addEventListener.html
[Qt] DRT: Send double click event from EventSender
https://bugs.webkit.org/show_bug.cgi?id=35255
* DumpRenderTree/qt/DumpRenderTreeQt.cpp:
(WebCore::DumpRenderTree::resetToConsistentStateBeforeTesting):
* DumpRenderTree/qt/EventSenderQt.cpp:
(EventSender::EventSender):
(EventSender::mouseDown):
* DumpRenderTree/qt/EventSenderQt.h:
(EventSender::resetClickCount):
2010-03-04 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Tor Arne Vestbø.
......
......@@ -392,6 +392,9 @@ void DumpRenderTree::resetToConsistentStateBeforeTesting()
// of the DRT.
m_controller->reset();
// reset mouse clicks counter
m_eventSender->resetClickCount();
closeRemainingWindows();
m_page->resetSettings();
......
......@@ -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)
......@@ -514,3 +533,8 @@ bool EventSender::eventFilter(QObject* watched, QEvent* event)
}
return false;
}
void EventSender::timerEvent(QTimerEvent* ev)
{
m_clickTimer.stop();
}
......@@ -30,6 +30,7 @@
#define EventSenderQt_h
#include <QApplication>
#include <QBasicTimer>
#include <QEvent>
#include <QEventLoop>
#include <QMouseEvent>
......@@ -50,6 +51,7 @@ class EventSender : public QObject {
public:
EventSender(QWebPage* parent);
virtual bool eventFilter(QObject* watched, QEvent* event);
void resetClickCount() { m_clickCount = 0; }
public slots:
void mouseDown(int button = 0);
......@@ -73,18 +75,24 @@ public slots:
void clearTouchPoints();
void releaseTouchPoint(int index);
protected:
void timerEvent(QTimerEvent*);
private:
void sendTouchEvent(QEvent::Type);
void sendOrQueueEvent(QEvent*);
void replaySavedEvents(bool flush);
QPoint m_mousePos;
QPoint m_clickPos;
Qt::MouseButtons m_mouseButtons;
QWebPage* m_page;
int m_timeLeap;
int m_clickCount;
int m_currentButton;
bool m_mouseButtonPressed;
bool m_drag;
QEventLoop* m_eventLoop;
QWebFrame* frameUnderMouse() const;
QBasicTimer m_clickTimer;
#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
QList<QTouchEvent::TouchPoint> m_touchPoints;
Qt::KeyboardModifiers m_touchModifiers;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment