Bug 52508 - [gtk] strip NUL characters when copying text/html on GTK+
Summary: [gtk] strip NUL characters when copying text/html on GTK+
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2011-01-15 00:53 PST by Tony Chang
Modified: 2011-01-26 15:51 PST (History)
4 users (show)

See Also:

Patch (5.24 KB, patch)
2011-01-26 12:05 PST, Tony Chang
rniwa: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tony Chang 2011-01-15 00:53:33 PST
This is a follow up to https://bugs.webkit.org/show_bug.cgi?id=52236.

The test editing/pasteboard/copy-null-characters.html tries to copy a text node with a null character and paste it into a content editable field.  On the GTK+ port, the pasted text is truncated at the null character.

I'm going to skip the test for now and investigate next week.
Comment 1 Tony Chang 2011-01-26 12:05:11 PST
Created attachment 80218 [details]
Comment 2 Ryosuke Niwa 2011-01-26 14:14:27 PST
Comment on attachment 80218 [details]

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

> Source/WebCore/ChangeLog:7
> +

Please elaborate on what caused the bug and what fix you're doing.

> Source/WebCore/editing/markup.cpp:188
> -    return String::adopt(result);
> +    // We remove '\0' characters because they are not visibly rendered to the user.
> +    return String::adopt(result).replace(0, "");

I don't think this is an efficient way of removing nulls but I don't have an alternative offer.  Also, replace doesn't replicate the string when there's no match so this doesn't regress the performance when there are no null characters.  In addition, any algorithm to strip null characters will require traversing through the entire string so I'd say r+.
Comment 3 Tony Chang 2011-01-26 14:52:38 PST
Committed r76723: <http://trac.webkit.org/changeset/76723>
Comment 4 WebKit Review Bot 2011-01-26 15:51:00 PST
http://trac.webkit.org/changeset/76723 might have broken Leopard Intel Release (Tests)