summaryrefslogtreecommitdiffstats
path: root/WebKitTools/DumpRenderTree/qt
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-06-28 16:42:48 +0100
committerKristian Monsen <kristianm@google.com>2010-07-02 10:29:56 +0100
commit06ea8e899e48f1f2f396b70e63fae369f2f23232 (patch)
tree20c1428cd05c76f32394ab354ea35ed99acd86d8 /WebKitTools/DumpRenderTree/qt
parent72aad67af14193199e29cdd5c4ddc095a8b9a8a8 (diff)
downloadexternal_webkit-06ea8e899e48f1f2f396b70e63fae369f2f23232.zip
external_webkit-06ea8e899e48f1f2f396b70e63fae369f2f23232.tar.gz
external_webkit-06ea8e899e48f1f2f396b70e63fae369f2f23232.tar.bz2
Merge WebKit at r61871: Initial merge by git.
Change-Id: I6cff43abca9cc4782e088a469ad4f03f166a65d5
Diffstat (limited to 'WebKitTools/DumpRenderTree/qt')
-rw-r--r--WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp43
-rw-r--r--WebKitTools/DumpRenderTree/qt/EventSenderQt.h1
-rw-r--r--WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp15
-rw-r--r--WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h7
4 files changed, 62 insertions, 4 deletions
diff --git a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp
index 7ec505f..5f340e9 100644
--- a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp
@@ -191,11 +191,23 @@ void EventSender::continuousMouseScrollBy(int x, int y)
// continuousMouseScrollBy() mimics devices that send fine-grained scroll events where the 'delta' specified is not the usual
// multiple of 120. See http://doc.qt.nokia.com/4.6/qwheelevent.html#delta for a good explanation of this.
if (x) {
- QWheelEvent* event = new QWheelEvent(m_mousePos, m_mousePos, x, m_mouseButtons, Qt::NoModifier, Qt::Horizontal);
+ QEvent* event;
+ if (isGraphicsBased()) {
+ event = createGraphicsSceneWheelEvent(QEvent::GraphicsSceneWheel,
+ m_mousePos, m_mousePos, x, Qt::NoModifier, Qt::Horizontal);
+ } else
+ event = new QWheelEvent(m_mousePos, m_mousePos, x, m_mouseButtons, Qt::NoModifier, Qt::Horizontal);
+
sendOrQueueEvent(event);
}
if (y) {
- QWheelEvent* event = new QWheelEvent(m_mousePos, m_mousePos, y, m_mouseButtons, Qt::NoModifier, Qt::Vertical);
+ QEvent* event;
+ if (isGraphicsBased()) {
+ event = createGraphicsSceneWheelEvent(QEvent::GraphicsSceneWheel,
+ m_mousePos, m_mousePos, y, Qt::NoModifier, Qt::Vertical);
+ } else
+ event = new QWheelEvent(m_mousePos, m_mousePos, y, m_mouseButtons, Qt::NoModifier, Qt::Vertical);
+
sendOrQueueEvent(event);
}
}
@@ -339,8 +351,18 @@ void EventSender::contextClick()
sendEvent(m_page, &event);
QMouseEvent event2(QEvent::MouseButtonRelease, m_mousePos, Qt::RightButton, Qt::RightButton, Qt::NoModifier);
sendEvent(m_page, &event2);
- QContextMenuEvent event3(QContextMenuEvent::Mouse, m_mousePos);
- sendEvent(m_page->view(), &event3);
+
+ if (isGraphicsBased()) {
+ QGraphicsSceneContextMenuEvent ctxEvent(QEvent::GraphicsSceneContextMenu);
+ ctxEvent.setReason(QGraphicsSceneContextMenuEvent::Mouse);
+ ctxEvent.setPos(m_mousePos);
+ WebCore::WebViewGraphicsBased* view = qobject_cast<WebCore::WebViewGraphicsBased*>(m_page->view());
+ if (view)
+ sendEvent(view->graphicsView(), &ctxEvent);
+ } else {
+ QContextMenuEvent ctxEvent(QContextMenuEvent::Mouse, m_mousePos);
+ sendEvent(m_page->view(), &ctxEvent);
+ }
}
void EventSender::scheduleAsynchronousClick()
@@ -601,6 +623,19 @@ QGraphicsSceneMouseEvent* EventSender::createGraphicsSceneMouseEvent(QEvent::Typ
return event;
}
+QGraphicsSceneWheelEvent* EventSender::createGraphicsSceneWheelEvent(QEvent::Type type, const QPoint& pos, const QPoint& screenPos, int delta, Qt::KeyboardModifiers modifiers, Qt::Orientation orientation)
+{
+ QGraphicsSceneWheelEvent* event;
+ event = new QGraphicsSceneWheelEvent(type);
+ event->setPos(pos);
+ event->setScreenPos(screenPos);
+ event->setDelta(delta);
+ event->setModifiers(modifiers);
+ event->setOrientation(orientation);
+
+ return event;
+}
+
void EventSender::sendEvent(QObject* receiver, QEvent* event)
{
if (WebCore::WebViewGraphicsBased* view = qobject_cast<WebCore::WebViewGraphicsBased*>(receiver))
diff --git a/WebKitTools/DumpRenderTree/qt/EventSenderQt.h b/WebKitTools/DumpRenderTree/qt/EventSenderQt.h
index 51c8325..c2ff746 100644
--- a/WebKitTools/DumpRenderTree/qt/EventSenderQt.h
+++ b/WebKitTools/DumpRenderTree/qt/EventSenderQt.h
@@ -88,6 +88,7 @@ protected:
private:
bool isGraphicsBased() const { return qobject_cast<WebCore::WebViewGraphicsBased*>(m_page->view()); }
QGraphicsSceneMouseEvent* createGraphicsSceneMouseEvent(QEvent::Type, const QPoint& pos, const QPoint& screenPos, Qt::MouseButton, Qt::MouseButtons, Qt::KeyboardModifiers);
+ QGraphicsSceneWheelEvent* createGraphicsSceneWheelEvent(QEvent::Type, const QPoint& pos, const QPoint& screenPos, int delta, Qt::KeyboardModifiers, Qt::Orientation);
void sendEvent(QObject* receiver, QEvent* event);
private:
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
index 8450376..3cced7d 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
@@ -35,6 +35,7 @@
#include "WorkQueueItemQt.h"
#include <QDir>
#include <QLocale>
+#include <qwebscriptworld.h>
#include <qwebsettings.h>
LayoutTestController::LayoutTestController(WebCore::DumpRenderTree* drt)
@@ -662,5 +663,19 @@ void LayoutTestController::setMockGeolocationPosition(double latitude, double lo
DumpRenderTreeSupportQt::setMockGeolocationPosition(latitude, longitude, accuracy);
}
+void LayoutTestController::evaluateScriptInIsolatedWorld(int worldID, const QString& script)
+{
+ QWebScriptWorld* scriptWorld;
+ if (!worldID) {
+ scriptWorld = new QWebScriptWorld();
+ } else if (!m_worldMap.contains(worldID)) {
+ scriptWorld = new QWebScriptWorld();
+ m_worldMap.insert(worldID, scriptWorld);
+ } else
+ scriptWorld = m_worldMap.value(worldID);
+
+ m_drt->webPage()->mainFrame()->evaluateScriptInIsolatedWorld(scriptWorld, script);
+}
+
const unsigned LayoutTestController::maxViewWidth = 800;
const unsigned LayoutTestController::maxViewHeight = 600;
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
index a041ad0..b56f1c9 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
@@ -183,6 +183,10 @@ public slots:
// For now, this is a no-op. This may change depending on outcome of
// https://bugs.webkit.org/show_bug.cgi?id=33333
void setCallCloseOnWebViews() {}
+ // This is a no-op - it allows us to pass
+ // plugins/get-url-that-the-resource-load-delegate-will-disallow.html
+ // which is a Mac-specific test.
+ void addDisallowedURL(const QString&) {}
void setMockGeolocationError(int code, const QString& message);
void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
@@ -204,6 +208,8 @@ public slots:
void setEditingBehavior(const QString& editingBehavior);
+ void evaluateScriptInIsolatedWorld(int worldID, const QString& script);
+
private slots:
void processWork();
@@ -224,6 +230,7 @@ private:
bool m_isGeolocationPermissionSet;
bool m_geolocationPermission;
+ QMap<int, QWebScriptWorld*> m_worldMap;
QUrl m_userStyleSheetLocation;
QBasicTimer m_timeoutTimer;
QWebFrame* m_topLoadingFrame;