Bug 47482 - Add webkitGetDataBlob/webkitSetDataBlob to event.dataTransfer
Summary: Add webkitGetDataBlob/webkitSetDataBlob to event.dataTransfer
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-10 23:54 PDT by Daniel Cheng
Modified: 2011-04-27 19:11 PDT (History)
5 users (show)

See Also:


Attachments
Patch (25.38 KB, patch)
2010-10-11 00:06 PDT, Daniel Cheng
no flags Details | Formatted Diff | Diff
Patch (26.55 KB, patch)
2010-10-11 08:55 PDT, Daniel Cheng
no flags Details | Formatted Diff | Diff
Patch (26.76 KB, patch)
2010-10-15 14:29 PDT, Daniel Cheng
no flags Details | Formatted Diff | Diff
Patch (26.10 KB, patch)
2010-10-25 17:33 PDT, Daniel Cheng
dimich: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Cheng 2010-10-10 23:54:34 PDT
For now, just add stubs. It'd be nice to have event.dataTransfer support binary blobs to support operations like copying and pasting images.

mrobinson was interested in this change as well, but for some reason, Bugzilla won't let me CC him.
Comment 1 Daniel Cheng 2010-10-11 00:06:56 PDT
Created attachment 70426 [details]
Patch
Comment 2 Early Warning System Bot 2010-10-11 00:14:40 PDT
Attachment 70426 [details] did not build on qt:
Build output: http://queues.webkit.org/results/4362018
Comment 3 Daniel Cheng 2010-10-11 08:55:36 PDT
Created attachment 70437 [details]
Patch
Comment 4 Jian Li 2010-10-15 14:08:27 PDT
Comment on attachment 70437 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=70437&action=review

> WebCore/ChangeLog:9
> +        copy-and-paste or drag-and-drop in WebKit.

Can you add a link to the proposal or discussion?

> WebCore/ChangeLog:11
> +        No tests. No functionality changed.

I think we should say that the test will be added when we have the stub implemented.

> WebCore/WebCore.xcodeproj/project.pbxproj:748
> +		2EDEF1F4121B0EFC00726DB2 /* BlobData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDEF1EE121B0EFC00726DB2 /* BlobData.h */; settings = {ATTRIBUTES = (Private, ); }; };

Why do we need to change the settings? Do you mean to copy the header file to PrivateHeaders? If needed, please explain in ChangeLog.

> WebCore/dom/Clipboard.h:67
> +        virtual PassRefPtr<Blob> webkitGetDataBlob(const String& type, bool& success) const = 0;

Can we simply return 0 to indicate failure, instead of introducing an extra boolean output parameter?

> WebCore/dom/Clipboard.h:68
> +        virtual bool webkitSetDataBlob(const String& type, PassRefPtr<Blob> data) = 0;

You can omit 'data' argument name.

> WebCore/dom/Clipboard.idl:41
> +        [Custom] void webkitGetDataBlob(in DOMString type)

Do we need Custom attribute? I think probably we can remove it if we remove 'success' parameter Clipboard::webkitGetDataBlob?
Do we consider adding a feature guard to wrap this new feature?
Comment 5 Daniel Cheng 2010-10-15 14:29:14 PDT
Created attachment 70897 [details]
Patch
Comment 6 Daniel Cheng 2010-10-15 14:29:37 PDT
(In reply to comment #4)
> (From update of attachment 70437 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=70437&action=review
> 
> > WebCore/ChangeLog:9
> > +        copy-and-paste or drag-and-drop in WebKit.
> 
> Can you add a link to the proposal or discussion?

There wasn't much discussion, since no one ever replied to the post. But I linked it anyway.

> 
> > WebCore/ChangeLog:11
> > +        No tests. No functionality changed.
> 
> I think we should say that the test will be added when we have the stub implemented.
> 

Done.

> > WebCore/WebCore.xcodeproj/project.pbxproj:748
> > +		2EDEF1F4121B0EFC00726DB2 /* BlobData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDEF1EE121B0EFC00726DB2 /* BlobData.h */; settings = {ATTRIBUTES = (Private, ); }; };
> 
> Why do we need to change the settings? Do you mean to copy the header file to PrivateHeaders? If needed, please explain in ChangeLog.
> 

Done.

> > WebCore/dom/Clipboard.h:67
> > +        virtual PassRefPtr<Blob> webkitGetDataBlob(const String& type, bool& success) const = 0;
> 
> Can we simply return 0 to indicate failure, instead of introducing an extra boolean output parameter?
> 

I opted to follow the pattern in the IDL file, but I'm not opposed to changing it.

> > WebCore/dom/Clipboard.h:68
> > +        virtual bool webkitSetDataBlob(const String& type, PassRefPtr<Blob> data) = 0;
> 
> You can omit 'data' argument name.
> 

Done.

> > WebCore/dom/Clipboard.idl:41
> > +        [Custom] void webkitGetDataBlob(in DOMString type)
> 
> Do we need Custom attribute? I think probably we can remove it if we remove 'success' parameter Clipboard::webkitGetDataBlob?

I opted to follow the way existing code did it. I'm not really familiar with the IDL bindings, so it seemed safest to copy the existing pattern in the file.

> Do we consider adding a feature guard to wrap this new feature?

I did not consider this. Who defines these flags when you're building, say, the Chrome port?
Comment 7 WebKit Review Bot 2010-10-16 23:46:24 PDT
Attachment 70897 [details] did not build on win:
Build output: http://queues.webkit.org/results/4410074
Comment 8 Daniel Cheng 2010-10-25 17:33:59 PDT
Created attachment 71825 [details]
Patch
Comment 9 Dmitry Titov 2010-10-27 15:15:36 PDT
Comment on attachment 71825 [details]
Patch

I think there should be a better proposal before this kind of patch can land.

The linked post (http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2010-June/026910.html) only contains a question about what would be the preferred shape of API for exchanging non-text data with clipboard. I think it didn't get responses because context was unclear.

It is not exactly clear what kind of use case these APIs are going to enable, what kind of data are we talkign about, sizes and speeds (if data is big or produced on demand, then perhaps it should not be a synchronous API?) etc.  It is hard to say, based on information in this bug, whether or not these APIs are all right since it's unclear what exact data transfer scenarios they are going to be used for.

If this is a part of a bigger modification, it could be also useful to see what it is (since it mentions non-text data in clipboardData). In short, I think this requires a proposal or design doc.