summaryrefslogtreecommitdiffstats
path: root/WebKitTools/DumpRenderTree/gtk
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-11-05 09:23:40 +0000
committerSteve Block <steveblock@google.com>2009-11-10 22:41:12 +0000
commitcac0f67c402d107cdb10971b95719e2ff9c7c76b (patch)
treed182c7f87211c6f201a5f038e332336493ebdbe7 /WebKitTools/DumpRenderTree/gtk
parent4b2ef0f288e7c6c4602f621b7a0e9feed304b70e (diff)
downloadexternal_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.zip
external_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.tar.gz
external_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.tar.bz2
Merge webkit.org at r50258 : Initial merge by git.
Change-Id: I1a9e1dc4ed654b69174ad52a4f031a07240f37b0
Diffstat (limited to 'WebKitTools/DumpRenderTree/gtk')
-rw-r--r--WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp10
-rw-r--r--WebKitTools/DumpRenderTree/gtk/EventSender.cpp80
-rw-r--r--WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp43
3 files changed, 130 insertions, 3 deletions
diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
index 6ecd774..4ed6e36 100644
--- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
@@ -319,6 +319,8 @@ static void resetDefaultsToConsistentValues()
"enable-offline-web-application-cache", TRUE,
"enable-universal-access-from-file-uris", TRUE,
"enable-scripts", TRUE,
+ "enable-web-sockets", TRUE,
+ "enable-dom-paste", TRUE,
"default-font-family", "Times",
"monospace-font-family", "Courier",
"serif-font-family", "Times",
@@ -706,6 +708,11 @@ static void databaseQuotaExceeded(WebKitWebView* view, WebKitWebFrame* frame, We
static WebKitWebView* webViewCreate(WebKitWebView*, WebKitWebFrame*);
+static WebKitWebView* webInspectorInspectWebView(WebKitWebInspector*, gpointer data)
+{
+ return WEBKIT_WEB_VIEW(webkit_web_view_new());
+}
+
static WebKitWebView* createWebView()
{
WebKitWebView* view = WEBKIT_WEB_VIEW(webkit_web_view_new());
@@ -730,6 +737,9 @@ static WebKitWebView* createWebView()
"signal::database-quota-exceeded", databaseQuotaExceeded, 0,
NULL);
+ WebKitWebInspector* inspector = webkit_web_view_get_inspector(view);
+ g_signal_connect(inspector, "inspect-web-view", G_CALLBACK(webInspectorInspectWebView), 0);
+
return view;
}
diff --git a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp
index c3c72c1..f42928c 100644
--- a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp
@@ -53,6 +53,7 @@ extern "C" {
}
static bool down = false;
+static bool currentEventButton = 1;
static bool dragMode = true;
static bool replayingSavedEvents = false;
static int lastMousePositionX;
@@ -122,12 +123,27 @@ static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef functio
static void updateClickCount(int /* button */)
{
// FIXME: take the last clicked button number and the time of last click into account.
- if (lastClickPositionX != lastMousePositionX && lastClickPositionY != lastMousePositionY)
+ if (lastClickPositionX != lastMousePositionX || lastClickPositionY != lastMousePositionY)
clickCount = 1;
else
clickCount++;
}
+#if !GTK_CHECK_VERSION(2,17,3)
+static void getRootCoords(GtkWidget* view, int* rootX, int* rootY)
+{
+ GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(view));
+ int tmpX, tmpY;
+
+ gtk_widget_translate_coordinates(view, window, lastMousePositionX, lastMousePositionY, &tmpX, &tmpY);
+
+ gdk_window_get_origin(window->window, rootX, rootY);
+
+ *rootX += tmpX;
+ *rootY += tmpY;
+}
+#endif
+
static JSValueRef mouseDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
@@ -140,9 +156,29 @@ static JSValueRef mouseDownCallback(JSContextRef context, JSObjectRef function,
memset(&event, 0, sizeof(event));
event.type = GDK_BUTTON_PRESS;
event.button.button = 1;
+
+ if (argumentCount == 1) {
+ event.button.button = (int)JSValueToNumber(context, arguments[0], exception) + 1;
+ g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context));
+ }
+
+ currentEventButton = event.button.button;
+
event.button.x = lastMousePositionX;
event.button.y = lastMousePositionY;
event.button.window = GTK_WIDGET(view)->window;
+ event.button.time = GDK_CURRENT_TIME;
+ event.button.device = gdk_device_get_core_pointer();
+
+ int x_root, y_root;
+#if GTK_CHECK_VERSION(2,17,3)
+ gdk_window_get_root_coords(GTK_WIDGET(view)->window, lastMousePositionX, lastMousePositionY, &x_root, &y_root);
+#else
+ getRootCoords(GTK_WIDGET(view), &x_root, &y_root);
+#endif
+
+ event.button.x_root = x_root;
+ event.button.y_root = y_root;
updateClickCount(1);
@@ -177,9 +213,29 @@ static JSValueRef mouseUpCallback(JSContextRef context, JSObjectRef function, JS
memset(&event, 0, sizeof(event));
event.type = GDK_BUTTON_RELEASE;
event.button.button = 1;
+
+ if (argumentCount == 1) {
+ event.button.button = (int)JSValueToNumber(context, arguments[0], exception) + 1;
+ g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context));
+ }
+
+ currentEventButton = event.button.button;
+
event.button.x = lastMousePositionX;
event.button.y = lastMousePositionY;
event.button.window = GTK_WIDGET(view)->window;
+ event.button.time = GDK_CURRENT_TIME;
+ event.button.device = gdk_device_get_core_pointer();
+
+ int x_root, y_root;
+#if GTK_CHECK_VERSION(2,17,3)
+ gdk_window_get_root_coords(GTK_WIDGET(view)->window, lastMousePositionX, lastMousePositionY, &x_root, &y_root);
+#else
+ getRootCoords(GTK_WIDGET(view), &x_root, &y_root);
+#endif
+
+ event.button.x_root = x_root;
+ event.button.y_root = y_root;
if ((dragMode && !replayingSavedEvents) || msgQueue[endOfQueue].delay) {
msgQueue[endOfQueue].event = event;
@@ -213,11 +269,33 @@ static JSValueRef mouseMoveToCallback(JSContextRef context, JSObjectRef function
g_return_val_if_fail((!exception || !*exception), JSValueMakeUndefined(context));
GdkEvent event;
+ memset(&event, 0, sizeof(event));
event.type = GDK_MOTION_NOTIFY;
event.motion.x = lastMousePositionX;
event.motion.y = lastMousePositionY;
event.motion.time = GDK_CURRENT_TIME;
event.motion.window = GTK_WIDGET(view)->window;
+ event.motion.device = gdk_device_get_core_pointer();
+
+ int x_root, y_root;
+#if GTK_CHECK_VERSION(2,17,3)
+ gdk_window_get_root_coords(GTK_WIDGET(view)->window, lastMousePositionX, lastMousePositionY, &x_root, &y_root);
+#else
+ getRootCoords(GTK_WIDGET(view), &x_root, &y_root);
+#endif
+
+ event.motion.x_root = x_root;
+ event.motion.y_root = y_root;
+
+ if (down) {
+ if (currentEventButton == 1)
+ event.motion.state = GDK_BUTTON1_MASK;
+ else if (currentEventButton == 2)
+ event.motion.state = GDK_BUTTON2_MASK;
+ else if (currentEventButton == 3)
+ event.motion.state = GDK_BUTTON3_MASK;
+ } else
+ event.motion.state = 0;
if (dragMode && down && !replayingSavedEvents) {
msgQueue[endOfQueue].event = event;
diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
index 0b4a38f..631fc31 100644
--- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
@@ -3,6 +3,7 @@
* Copyright (C) 2007 Eric Seidel <eric@webkit.org>
* Copyright (C) 2008 Nuanti Ltd.
* Copyright (C) 2009 Jan Michael Alonzo <jmalonzo@gmail.com>
+ * Copyright (C) 2009 Collabora Ltd.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -52,6 +53,8 @@ unsigned int webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame)
void webkit_application_cache_set_maximum_size(unsigned long long size);
unsigned int webkit_worker_thread_count(void);
void webkit_white_list_access_from_origin(const gchar* sourceOrigin, const gchar* destinationProtocol, const gchar* destinationHost, bool allowDestinationSubdomains);
+gchar* webkit_web_frame_counter_value_for_element_by_id(WebKitWebFrame* frame, const gchar* id);
+void webkit_web_inspector_execute_script(WebKitWebInspector* inspector, long callId, const gchar* script);
}
static gchar* copyWebSettingKey(gchar* preferenceKey)
@@ -118,6 +121,17 @@ void LayoutTestController::display()
displayWebView();
}
+JSRetainPtr<JSStringRef> LayoutTestController::counterValueForElementById(JSStringRef id)
+{
+ gchar* idGChar = JSStringCopyUTF8CString(id);
+ gchar* counterValueGChar = webkit_web_frame_counter_value_for_element_by_id(mainFrame, idGChar);
+ g_free(idGChar);
+ if (!counterValueGChar)
+ return 0;
+ JSRetainPtr<JSStringRef> counterValue(Adopt, JSStringCreateWithUTF8CString(counterValueGChar));
+ return counterValue;
+}
+
void LayoutTestController::keepWebHistory()
{
// FIXME: implement
@@ -474,15 +488,40 @@ void LayoutTestController::addUserStyleSheet(JSStringRef source)
void LayoutTestController::showWebInspector()
{
- // FIXME: Implement this.
+ WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
+ WebKitWebSettings* webSettings = webkit_web_view_get_settings(webView);
+ WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView);
+
+ g_object_set(webSettings, "enable-developer-extras", TRUE, NULL);
+ webkit_web_inspector_inspect_coordinates(inspector, 0, 0);
}
void LayoutTestController::closeWebInspector()
{
- // FIXME: Implement this.
+ WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
+ WebKitWebSettings* webSettings = webkit_web_view_get_settings(webView);
+ WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView);
+
+ webkit_web_inspector_close(inspector);
+ g_object_set(webSettings, "enable-developer-extras", FALSE, NULL);
}
void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script)
{
+ WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
+ WebKitWebInspector* inspector = webkit_web_view_get_inspector(webView);
+ char* scriptString = JSStringCopyUTF8CString(script);
+
+ webkit_web_inspector_execute_script(inspector, callId, scriptString);
+ g_free(scriptString);
+}
+
+void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
+{
+ // FIXME: Implement this.
+}
+
+void LayoutTestController::removeAllVisitedLinks()
+{
// FIXME: Implement this.
}