RESOLVED FIXED 16311
[Gtk] Copy rich text to clipboard as text/plain and text/html
https://bugs.webkit.org/show_bug.cgi?id=16311
Summary [Gtk] Copy rich text to clipboard as text/plain and text/html
Luca Bruno
Reported 2007-12-05 12:40:52 PST
We can paste text/html and text/plain to editable contents such as rich text, but we can't copy from.
Attachments
patch (9.52 KB, patch)
2007-12-07 04:32 PST, Luca Bruno
alp: review-
cleaner patch (11.06 KB, patch)
2007-12-07 08:19 PST, Luca Bruno
no flags
do not use webkit enum (11.46 KB, patch)
2007-12-07 10:54 PST, Luca Bruno
no flags
PasteboardHelper and use the right clipboard (22.46 KB, patch)
2007-12-18 06:32 PST, Luca Bruno
no flags
coding style issues (22.45 KB, patch)
2007-12-20 04:23 PST, Luca Bruno
alp: review+
Luca Bruno
Comment 1 2007-12-07 04:32:38 PST
Created attachment 17769 [details] patch Add targets for plain text and text/html, then complete the implementation of copying text from the page. Adding targets meant adding new API, hopefully this is not wrong. Please consider reviewing deeply the PasteboardGtk.cpp file which has a new struct.
Alp Toker
Comment 2 2007-12-07 05:18:49 PST
Comment on attachment 17769 [details] patch Hey Luca, Unfortunately this patch is going to need some re-designing. nothing in platform/gtk should use anything from WebKit/gtk. WebKit/gtk should be built on top of platform, never the other way round. This means that we shouldn't need to add webkit_web_view_get_target_list() as public API either. It should remain totally internal, just like GtkTextView. (The feature itself works well and this'll be a great feature to have.)
Luca Bruno
Comment 3 2007-12-07 08:19:55 PST
Created attachment 17770 [details] cleaner patch Diffs: - Use a class instead of a struct in the C++ context, which would be useful for future enhancements like URIs and GtkTextBuffer data - Create target entries inside Pasteboard - Do not use API except for WebKitWebViewTargetInfo enum
Luca Bruno
Comment 4 2007-12-07 10:54:25 PST
Created attachment 17773 [details] do not use webkit enum Diffs: - Define webkit target info enum - Use the right GdkAtom Pasteboard in in mac is used for DnD not for Pasteboard, therefore they can pass their PasteboardHelper from webkit. Instead, there's no way to do this for the Pasteboard.
Alp Toker
Comment 5 2007-12-10 10:23:32 PST
GtkTextBuffer has: GtkTargetList* gtk_text_buffer_get_copy_target_list (GtkTextBuffer *buffer); GtkTargetList* gtk_text_buffer_get_paste_target_list (GtkTextBuffer *buffer); Is there a reason why this patch adds only one? webkit_web_view_get_target_list() Just wondering, have not studied the case in detail.
Luca Bruno
Comment 6 2007-12-10 12:32:41 PST
Didn't think we need two different target lists. I just thought the copy target was the same as the paste target. As i see the text buffer has two target lists with the same contents.
Luca Bruno
Comment 7 2007-12-18 06:32:21 PST
Created attachment 17972 [details] PasteboardHelper and use the right clipboard Well i created a PasteboardHelper (please check the license) and a target list for both copy and paste operations.
Alp Toker
Comment 8 2007-12-19 16:35:59 PST
Mitch has offered to look into this one for clipboard API correctness. There are some minor coding style issues like whitespace before braces from a quick glance.
Luca Bruno
Comment 9 2007-12-20 04:23:01 PST
Created attachment 18005 [details] coding style issues
Alp Toker
Comment 10 2007-12-22 15:08:45 PST
Comment on attachment 18005 [details] coding style issues r=me (thanks to Xan and Mitch for looking into this one too) Will land with the discussed documentation and whitespace fixes.
Alp Toker
Comment 11 2007-12-22 15:13:04 PST
Landed in r28963.
Note You need to log in before you can comment on or make changes to this bug.