Commit ed7744cb authored by mrobinson@webkit.org's avatar mrobinson@webkit.org
Browse files

2011-01-18 Adam Bergkvist <adam.bergkvist@ericsson.com> and Martin Robinson ...

2011-01-18  Adam Bergkvist  <adam.bergkvist@ericsson.com> and Martin Robinson  <mrobinson@igalia.com>

        Reviewed by Gustavo Noronha Silva.

        [GTK] The GTK+ EventSender needs support for beginDragWithFiles
        https://bugs.webkit.org/show_bug.cgi?id=40833

        Unskip passing tests, add in a GTK+-specific result and one more result
        which is necessary because GTK+ tests run in Xvfb.

        * platform/gtk/Skipped: Unskip tests that are now passing and organize
        the remaining skipped tests.
        * platform/gtk/fast/forms/input-file-re-render-expected.txt: Added.
        * platform/gtk/http/tests/security/clipboard/clipboard-file-access-expected.txt: Added.
2011-01-18  Adam Bergkvist  <adam.bergkvist@ericsson.com> and Martin Robinson  <mrobinson@igalia.com>

        Reviewed by Gustavo Noronha Silva.

        [GTK] The GTK+ EventSender needs support for beginDragWithFiles
        https://bugs.webkit.org/show_bug.cgi?id=40833

        * DumpRenderTree/gtk/EventSender.cpp: Add a beginDragWithFiles implementation for the
        GTK+ event sender.
        (dragWithFilesDragDataGetCallback): Added.
        (dragWithFilesDragEndCallback): Added.
        (beginDragWithFilesCallback): Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76031 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d4c0590f
2011-01-18 Adam Bergkvist <adam.bergkvist@ericsson.com> and Martin Robinson <mrobinson@igalia.com>
Reviewed by Gustavo Noronha Silva.
[GTK] The GTK+ EventSender needs support for beginDragWithFiles
https://bugs.webkit.org/show_bug.cgi?id=40833
Unskip passing tests, add in a GTK+-specific result and one more result
which is necessary because GTK+ tests run in Xvfb.
* platform/gtk/Skipped: Unskip tests that are now passing and organize
the remaining skipped tests.
* platform/gtk/fast/forms/input-file-re-render-expected.txt: Added.
* platform/gtk/http/tests/security/clipboard/clipboard-file-access-expected.txt: Added.
2011-01-18 Andrey Kosyakov <caseq@chromium.org>
 
Reviewed by Yury Semikhatsky.
......
......@@ -2720,11 +2720,7 @@ http/tests/loading/gmail-assert-on-load.html
http/tests/loading/preload-img-test.html
http/tests/loading/redirect-with-no-location-crash.html
http/tests/loading/text-content-type-with-binary-extension.html
http/tests/local/blob/send-data-blob.html
http/tests/local/blob/send-hybrid-blob.html
http/tests/local/blob/send-sliced-data-blob.html
# File API is not supported yet
fast/files
http/tests/media/video-play-stall-seek.html
http/tests/media/video-play-stall.html
http/tests/media/video-seekable-stall.html
......@@ -5326,19 +5322,6 @@ http/tests/xmlhttprequest/remember-bad-password.html
# different DOM to be created.
html5lib/runner.html
#Tests failing because beginDragWithFiles is unimplemented
editing/pasteboard/file-drag-to-editable.html
editing/pasteboard/file-input-files-access.html
editing/pasteboard/files-during-page-drags.html
fast/dom/Window/window-postmessage-clone-frames.html
fast/dom/Window/window-postmessage-clone.html
fast/events/drag-to-navigate.html
fast/events/prevent-drag-to-navigate.html
fast/forms/input-file-re-render.html
http/tests/local/formdata
http/tests/local/fileapi
http/tests/security/clipboard/clipboard-file-access.html
# Still failing, looks like a bug in the EventSender drag-and-drop
fast/css/user-drag-none.html
......@@ -5351,6 +5334,25 @@ http/tests/misc/bubble-drag-events.html
fast/events/content-changed-during-drop.html
editing/pasteboard/drop-link.html
# [Soup] ResourceHandleSoup does not ever call didSendData for file uploads
# https://bugs.webkit.org/show_bug.cgi?id=52090
http/tests/local/formdata/upload-events.html
# [Soup] ResourceHandleSoup does not handle encodedBlobData
# https://bugs.webkit.org/show_bug.cgi?id=52092
http/tests/local/blob/send-data-blob.html
http/tests/local/blob/send-hybrid-blob.html
http/tests/local/blob/send-sliced-data-blob.html
http/tests/local/formdata/send-form-data-with-sliced-file.html
# [GTK] Dragging images and links results in a DataTransfer object containing a non-empty files array
# https://bugs.webkit.org/show_bug.cgi?id=52094
editing/pasteboard/files-during-page-drags.html
# [GTK] Filenames are converted to URLs during edit drags
# https://bugs.webkit.org/show_bug.cgi?id=52096
editing/pasteboard/file-drag-to-editable.html
# The feature was disabled due to a compatibility issue.
# https://bugs.webkit.org/show_bug.cgi?id=40520
fast/forms/interactive-validation-lost-focusable.html
......@@ -5479,6 +5481,7 @@ fast/parser/pre-html5-parser-quirks.html
# FileSystem API is not supported.
fast/filesystem
http/tests/local/fileapi
# Needs more investigation like QT
fast/dom/nodesFromRect-links-and-text.html
......
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x91
RenderBlock {HTML} at (0,0) size 800x91
RenderBody {BODY} at (8,8) size 784x67
RenderBlock {FORM} at (0,0) size 784x32
RenderFileUploadControl {INPUT} at (2,2) size 306x28 "2 files"
RenderButton {INPUT} at (0,0) size 103x28 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
RenderBlock (anonymous) at (8,4) size 87x19
RenderText at (0,0) size 87x19
text run at (0,0) width 87: "Choose File"
RenderText {#text} at (0,0) size 0x0
RenderBlock {P} at (0,48) size 784x19
RenderText {#text} at (0,0) size 442x19
text run at (0,0) width 442: "The file upload control above should have text '2 files,' not a filename."
Tests access to event.dataTransfer.files and .types
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Dragging no files should return an empty file list (arbitrary implementation detail):
On dragenter:
PASS event.dataTransfer.types does not contain Files.
PASS event.dataTransfer.files.length is 0
On dragover:
PASS event.dataTransfer.types does not contain Files.
PASS event.dataTransfer.files.length is 0
On dragover:
PASS event.dataTransfer.types does not contain Files.
PASS event.dataTransfer.files.length is 0
On drop:
PASS event.dataTransfer.types does not contain Files.
PASS event.dataTransfer.files.length is 0
Drag drop a single (non-existant) file onto an element:
On dragenter:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On dragover:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On dragover:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On drop:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 1
PASS event.dataTransfer.files[0].fileName is "DRTFakeFile"
PASS event.dataTransfer.files[0].fileSize is 0
FIXME: File.fileSize always returns 0 for files dropped by eventSender.beginDragWithFiles from http tests: https://bugs.webkit.org/show_bug.cgi?id=25909
Drag files over an element, leave that element and release the mouse:
On dragenter:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On dragover:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On dragover:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On dragleave:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
Drag drop a real file onto an element:
On dragenter:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On dragover:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On dragover:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On drop:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 1
PASS event.dataTransfer.files[0].fileName is "apple.gif"
FAIL event.dataTransfer.files[0].fileSize should be 1476. Was 0.
Drag drop two files onto an element:
On dragenter:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On dragover:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On dragover:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On drop:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 2
PASS event.dataTransfer.files[0].fileName is "apple.gif"
FAIL event.dataTransfer.files[0].fileSize should be 1476. Was 0.
PASS event.dataTransfer.files[1].fileName is "mozilla.gif"
FAIL event.dataTransfer.files[1].fileSize should be 2593. Was 0.
Drag drop two files in reverse alphabetical order onto an element:
On dragenter:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On dragover:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On dragover:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On drop:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 2
PASS event.dataTransfer.files[0].fileName is "mozilla.gif"
FAIL event.dataTransfer.files[0].fileSize should be 2593. Was 0.
PASS event.dataTransfer.files[1].fileName is "apple.gif"
FAIL event.dataTransfer.files[1].fileSize should be 1476. Was 0.
FIXME: We should not allow element to accept drops including directories unless https://bugs.webkit.org/show_bug.cgi?id=25879 is fixed to make directory File objects useful from JavaScript. The page is given File objects corresponding to directories, but form submission and xhr.send() will fail.
Drag drop a directory onto an element:
On dragenter:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On dragover:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On dragover:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On drop:
PASS event.dataTransfer.types contains Files.
FAIL event.dataTransfer.files.length should be 0. Was 1.
Drag drop a file and a directory onto an element:
On dragenter:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On dragover:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On dragover:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On drop:
PASS event.dataTransfer.types contains Files.
FAIL event.dataTransfer.files.length should be 0. Was 2.
Drag drop a directory and a file onto an element:
On dragenter:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On dragover:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On dragover:
PASS event.dataTransfer.types contains Files.
PASS event.dataTransfer.files.length is 0
On drop:
PASS event.dataTransfer.types contains Files.
FAIL event.dataTransfer.files.length should be 0. Was 2.
PASS successfullyParsed is true
TEST COMPLETE
2011-01-18 Adam Bergkvist <adam.bergkvist@ericsson.com> and Martin Robinson <mrobinson@igalia.com>
Reviewed by Gustavo Noronha Silva.
[GTK] The GTK+ EventSender needs support for beginDragWithFiles
https://bugs.webkit.org/show_bug.cgi?id=40833
* DumpRenderTree/gtk/EventSender.cpp: Add a beginDragWithFiles implementation for the
GTK+ event sender.
(dragWithFilesDragDataGetCallback): Added.
(dragWithFilesDragEndCallback): Added.
(beginDragWithFilesCallback): Added.
2011-01-18 Gyuyoung Kim <gyuyoung.kim@samsung.com>
 
Reviewed by Adam Barth.
......@@ -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,84 @@ 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;
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 = view->window;
event.motion.device = gdk_device_get_core_pointer();
event.motion.state = GDK_BUTTON1_MASK;
int xRoot, yRoot;
gdk_window_get_root_coords(view->window, 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);
}
......
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