Bug 16290 - [GTK] Pasting clipboard in rich text
Summary: [GTK] Pasting clipboard in rich text
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P3 Normal
Assignee: Nobody
URL:
Keywords: Gtk
Depends on:
Blocks:
 
Reported: 2007-12-04 07:28 PST by Luca Bruno
Modified: 2007-12-05 12:28 PST (History)
2 users (show)

See Also:


Attachments
documentFragment implementation (1.86 KB, patch)
2007-12-04 07:29 PST, Luca Bruno
no flags Details | Formatted Diff | Diff
complete patch (2.35 KB, patch)
2007-12-05 01:13 PST, Luca Bruno
no flags Details | Formatted Diff | Diff
corrected patch (2.49 KB, patch)
2007-12-05 11:25 PST, Luca Bruno
alp: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Luca Bruno 2007-12-04 07:28:15 PST
Hello,
i created a patch which implements documentFragment but doesn't work pretty well.
The problem is that the fragment is not pasted everywhere (in blogger for example).

I don't think at all it's a problem if how documentFragment has been implemented.
Any hint?
Comment 1 Luca Bruno 2007-12-04 07:29:41 PST
Created attachment 17702 [details]
documentFragment implementation
Comment 2 Luca Bruno 2007-12-05 01:13:11 PST
Created attachment 17712 [details]
complete patch

I written this code according to the Qt implementation, and i think for now it's both complete and enough.
Comment 3 Alp Toker 2007-12-05 10:53:33 PST
This works well.

Can you fix up the patch so:

 There are no spaces before parentheses:
  gdk_atom_intern_static_string ("text/html")

ChangeLog should use spaces not tabs. Reviewer field should be left empty.

+                if (fragment)
+                    return fragment.release();
+            }
+            gtk_selection_data_free (data);

This looks like a leak. data isn't freed when returning early.


Thanks!
Comment 4 Alp Toker 2007-12-05 11:12:46 PST
        String text = String::fromUTF8(gtk_clipboard_wait_for_text(clipboard));

This is also a leak. The return value must be freed -- see the code a few lines below for an example.
Comment 5 Luca Bruno 2007-12-05 11:25:20 PST
Created attachment 17723 [details]
corrected patch

Thanks for all these hints. Hope this is good this time.
Comment 6 Alp Toker 2007-12-05 12:27:23 PST
Comment on attachment 17723 [details]
corrected patch

r=me with the changes we discussed.
Comment 7 Alp Toker 2007-12-05 12:28:01 PST
Landed in r28448. Thanks, looking forward to copying support!