summaryrefslogtreecommitdiffstats
path: root/Tools/DumpRenderTree
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-16 16:25:10 +0100
committerBen Murdoch <benm@google.com>2011-05-23 18:54:14 +0100
commitab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb (patch)
treedb769fadd053248f85db67434a5b275224defef7 /Tools/DumpRenderTree
parent52e2557aeb8477967e97fd24f20f8f407a10fa15 (diff)
downloadexternal_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.zip
external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.tar.gz
external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.tar.bz2
Merge WebKit at r76408: Initial merge by git.
Change-Id: I5b91decbd693ccbf5c1b8354b37cd68cc9a1ea53
Diffstat (limited to 'Tools/DumpRenderTree')
-rw-r--r--Tools/DumpRenderTree/ForwardingHeaders/wtf/FastAllocBase.h1
-rw-r--r--Tools/DumpRenderTree/chromium/CppBoundClass.h3
-rw-r--r--Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h4
-rw-r--r--Tools/DumpRenderTree/chromium/DRTDevToolsClient.h4
-rw-r--r--Tools/DumpRenderTree/chromium/TestNavigationController.h3
-rw-r--r--Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.h3
-rw-r--r--Tools/DumpRenderTree/chromium/WebThemeEngineDRTWin.h3
-rw-r--r--Tools/DumpRenderTree/chromium/WebViewHost.cpp16
-rw-r--r--Tools/DumpRenderTree/chromium/WebViewHost.h3
-rw-r--r--Tools/DumpRenderTree/gtk/EventSender.cpp85
-rw-r--r--Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp4
11 files changed, 115 insertions, 14 deletions
diff --git a/Tools/DumpRenderTree/ForwardingHeaders/wtf/FastAllocBase.h b/Tools/DumpRenderTree/ForwardingHeaders/wtf/FastAllocBase.h
new file mode 100644
index 0000000..421c040
--- /dev/null
+++ b/Tools/DumpRenderTree/ForwardingHeaders/wtf/FastAllocBase.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/FastAllocBase.h>
diff --git a/Tools/DumpRenderTree/chromium/CppBoundClass.h b/Tools/DumpRenderTree/chromium/CppBoundClass.h
index 6cb638e..6151a9c 100644
--- a/Tools/DumpRenderTree/chromium/CppBoundClass.h
+++ b/Tools/DumpRenderTree/chromium/CppBoundClass.h
@@ -58,7 +58,8 @@ typedef Vector<CppVariant> CppArgumentList;
// CppBoundClass lets you map Javascript method calls and property accesses
// directly to C++ method calls and CppVariant* variable access.
-class CppBoundClass : public Noncopyable {
+class CppBoundClass {
+ WTF_MAKE_NONCOPYABLE(CppBoundClass);
public:
class PropertyCallback {
public:
diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h
index e1478d0..665435c 100644
--- a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h
+++ b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h
@@ -49,8 +49,8 @@ struct WebDevToolsMessageData;
class DRTDevToolsClient;
-class DRTDevToolsAgent : public WebKit::WebDevToolsAgentClient
- , public Noncopyable {
+class DRTDevToolsAgent : public WebKit::WebDevToolsAgentClient {
+ WTF_MAKE_NONCOPYABLE(DRTDevToolsAgent);
public:
DRTDevToolsAgent();
virtual ~DRTDevToolsAgent() {}
diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h b/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h
index 9ca1402..0cba51c 100644
--- a/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h
+++ b/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h
@@ -48,8 +48,8 @@ class WebView;
class DRTDevToolsAgent;
-class DRTDevToolsClient : public WebKit::WebDevToolsFrontendClient
- , public Noncopyable {
+class DRTDevToolsClient : public WebKit::WebDevToolsFrontendClient {
+ WTF_MAKE_NONCOPYABLE(DRTDevToolsClient);
public:
DRTDevToolsClient(DRTDevToolsAgent*, WebKit::WebView*);
virtual ~DRTDevToolsClient();
diff --git a/Tools/DumpRenderTree/chromium/TestNavigationController.h b/Tools/DumpRenderTree/chromium/TestNavigationController.h
index b671489..8502a96 100644
--- a/Tools/DumpRenderTree/chromium/TestNavigationController.h
+++ b/Tools/DumpRenderTree/chromium/TestNavigationController.h
@@ -111,7 +111,8 @@ public:
// Test shell's NavigationController. The goal is to be as close to the Chrome
// version as possible.
-class TestNavigationController: public Noncopyable {
+class TestNavigationController {
+ WTF_MAKE_NONCOPYABLE(TestNavigationController);
public:
TestNavigationController(NavigationHost*);
~TestNavigationController();
diff --git a/Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.h b/Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.h
index 4e22461..ede1458 100644
--- a/Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.h
+++ b/Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.h
@@ -46,7 +46,8 @@
// Skia forward declarations
struct SkIRect;
-class WebThemeControlDRTWin : public Noncopyable {
+class WebThemeControlDRTWin {
+ WTF_MAKE_NONCOPYABLE(WebThemeControlDRTWin);
public:
// This list of states mostly mirrors the list in WebCore/platform/ThemeTypes.h
// but is maintained separately since that isn't public and also to minimize
diff --git a/Tools/DumpRenderTree/chromium/WebThemeEngineDRTWin.h b/Tools/DumpRenderTree/chromium/WebThemeEngineDRTWin.h
index 2e15cf8..9b1e817 100644
--- a/Tools/DumpRenderTree/chromium/WebThemeEngineDRTWin.h
+++ b/Tools/DumpRenderTree/chromium/WebThemeEngineDRTWin.h
@@ -50,7 +50,8 @@
#include "win/WebThemeEngine.h"
#include <wtf/Noncopyable.h>
-class WebThemeEngineDRTWin : public WebKit::WebThemeEngine, public Noncopyable {
+class WebThemeEngineDRTWin : public WebKit::WebThemeEngine {
+ WTF_MAKE_NONCOPYABLE(WebThemeEngineDRTWin);
public:
WebThemeEngineDRTWin() {}
diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp
index 62df390..18b107f 100644
--- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp
+++ b/Tools/DumpRenderTree/chromium/WebViewHost.cpp
@@ -624,6 +624,19 @@ void WebViewHost::scheduleComposite()
didInvalidateRect(clientRect);
}
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+static void invokeScheduleComposite(void* context)
+{
+ WebViewHost* wvh = static_cast<WebViewHost*>(context);
+ wvh->scheduleComposite();
+}
+
+void WebViewHost::scheduleAnimation()
+{
+ webkit_support::PostDelayedTask(invokeScheduleComposite, this, 0);
+}
+#endif
+
void WebViewHost::didFocus()
{
m_shell->setFocus(webWidget(), true);
@@ -1438,6 +1451,9 @@ void WebViewHost::paintRect(const WebRect& rect)
void WebViewHost::paintInvalidatedRegion()
{
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+ webWidget()->animate();
+#endif
webWidget()->layout();
WebSize widgetSize = webWidget()->size();
WebRect clientRect(0, 0, widgetSize.width, widgetSize.height);
diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.h b/Tools/DumpRenderTree/chromium/WebViewHost.h
index 0a36aec..83d21dc 100644
--- a/Tools/DumpRenderTree/chromium/WebViewHost.h
+++ b/Tools/DumpRenderTree/chromium/WebViewHost.h
@@ -147,6 +147,9 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
virtual void didInvalidateRect(const WebKit::WebRect&);
virtual void didScrollRect(int dx, int dy, const WebKit::WebRect&);
virtual void scheduleComposite();
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+ virtual void scheduleAnimation();
+#endif
virtual void didFocus();
virtual void didBlur();
virtual void didChangeCursor(const WebKit::WebCursorInfo&);
diff --git a/Tools/DumpRenderTree/gtk/EventSender.cpp b/Tools/DumpRenderTree/gtk/EventSender.cpp
index b844558..923a4ba 100644
--- a/Tools/DumpRenderTree/gtk/EventSender.cpp
+++ b/Tools/DumpRenderTree/gtk/EventSender.cpp
@@ -34,21 +34,21 @@
#include "DumpRenderTree.h"
#include "WebCoreSupport/DumpRenderTreeSupportGtk.h"
-
+#include <GOwnPtrGtk.h>
+#include <GRefPtrGtk.h>
#include <GtkVersioning.h>
#include <JavaScriptCore/JSObjectRef.h>
#include <JavaScriptCore/JSRetainPtr.h>
#include <JavaScriptCore/JSStringRef.h>
+#include <cstring>
+#include <gdk/gdk.h>
+#include <gdk/gdkkeysyms.h>
#include <webkit/webkitwebframe.h>
#include <webkit/webkitwebview.h>
#include <wtf/ASCIICType.h>
#include <wtf/Platform.h>
#include <wtf/text/CString.h>
-#include <gdk/gdk.h>
-#include <gdk/gdkkeysyms.h>
-#include <string.h>
-
extern "C" {
extern GtkMenu* webkit_web_view_get_context_menu(WebKitWebView*);
}
@@ -416,12 +416,85 @@ static JSValueRef continuousMouseScrollByCallback(JSContextRef context, JSObject
return JSValueMakeUndefined(context);
}
+static void dragWithFilesDragDataGetCallback(GtkWidget*, GdkDragContext*, GtkSelectionData *data, guint, guint, gpointer userData)
+{
+ gtk_selection_data_set_uris(data, static_cast<gchar**>(userData));
+}
+
+static void dragWithFilesDragEndCallback(GtkWidget* widget, GdkDragContext*, gpointer userData)
+{
+ g_signal_handlers_disconnect_by_func(widget, reinterpret_cast<void*>(dragWithFilesDragEndCallback), userData);
+ g_signal_handlers_disconnect_by_func(widget, reinterpret_cast<void*>(dragWithFilesDragDataGetCallback), userData);
+ g_strfreev(static_cast<gchar**>(userData));
+}
+
static JSValueRef beginDragWithFilesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
if (argumentCount < 1)
return JSValueMakeUndefined(context);
- // FIXME: Implement this completely once WebCore has complete drag and drop support
+ JSObjectRef filesArray = JSValueToObject(context, arguments[0], exception);
+ ASSERT(!exception || !*exception);
+
+ const gchar* mainFrameURI = webkit_web_frame_get_uri(mainFrame);
+ GRefPtr<GFile> testFile(adoptGRef(g_file_new_for_uri(mainFrameURI)));
+ GRefPtr<GFile> parentDirectory(g_file_get_parent(testFile.get()));
+ if (!parentDirectory)
+ return JSValueMakeUndefined(context);
+
+ // If this is an HTTP test, we still need to pass a local file path
+ // to WebCore. Even though the file doesn't exist, this should be fine
+ // for most tests.
+ GOwnPtr<gchar> scheme(g_file_get_uri_scheme(parentDirectory.get()));
+ if (g_str_equal(scheme.get(), "http") || g_str_equal(scheme.get(), "https")) {
+ GOwnPtr<gchar> currentDirectory(g_get_current_dir());
+ parentDirectory = g_file_new_for_path(currentDirectory.get());
+ }
+
+ JSStringRef lengthProperty = JSStringCreateWithUTF8CString("length");
+ int filesArrayLength = JSValueToNumber(context, JSObjectGetProperty(context, filesArray, lengthProperty, 0), 0);
+ JSStringRelease(lengthProperty);
+
+ gchar** draggedFilesURIList = g_new0(gchar*, filesArrayLength + 1);
+ for (int i = 0; i < filesArrayLength; ++i) {
+ JSStringRef filenameString = JSValueToStringCopy(context,
+ JSObjectGetPropertyAtIndex(context, filesArray, i, 0), 0);
+ size_t bufferSize = JSStringGetMaximumUTF8CStringSize(filenameString);
+ GOwnPtr<gchar> filenameBuffer(static_cast<gchar*>(g_malloc(bufferSize)));
+ JSStringGetUTF8CString(filenameString, filenameBuffer.get(), bufferSize);
+ JSStringRelease(filenameString);
+
+ GRefPtr<GFile> dragFile(g_file_get_child(parentDirectory.get(), filenameBuffer.get()));
+ draggedFilesURIList[i] = g_file_get_uri(dragFile.get());
+ }
+
+ GtkWidget* view = GTK_WIDGET(webkit_web_frame_get_web_view(mainFrame));
+ g_object_connect(G_OBJECT(view),
+ "signal::drag-end", dragWithFilesDragEndCallback, draggedFilesURIList,
+ "signal::drag-data-get", dragWithFilesDragDataGetCallback, draggedFilesURIList,
+ NULL);
+
+ GdkEvent event;
+ GdkWindow* viewGDKWindow = gtk_widget_get_window(view);
+ 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 = viewGDKWindow;
+ event.motion.device = getDefaultGDKPointerDevice(viewGDKWindow);
+ event.motion.state = GDK_BUTTON1_MASK;
+
+ int xRoot, yRoot;
+ gdk_window_get_root_coords(viewGDKWindow, lastMousePositionX, lastMousePositionY, &xRoot, &yRoot);
+ event.motion.x_root = xRoot;
+ event.motion.y_root = yRoot;
+
+ GtkTargetList* targetList = gtk_target_list_new(0, 0);
+ gtk_target_list_add_uri_targets(targetList, 0);
+ gtk_drag_begin(view, targetList, GDK_ACTION_COPY, 1, &event);
+ gtk_target_list_unref(targetList);
+
return JSValueMakeUndefined(context);
}
diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
index fe37958..ce608cc 100644
--- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
+++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
@@ -915,6 +915,10 @@ void DumpRenderTree::dump()
fprintf(stdout, "Source:\n\n%s\n", markup.toUtf8().constData());
}
+ QString mimeType = DumpRenderTreeSupportQt::responseMimeType(mainFrame);
+ if (mimeType == "text/plain")
+ m_controller->dumpAsText();
+
// Dump render text...
QString resultString;
if (m_controller->shouldDumpAsText())