Changeset 76723 in webkit


Ignore:
Timestamp:
Jan 26, 2011 2:52:28 PM (13 years ago)
Author:
tony@chromium.org
Message:

2011-01-26 Tony Chang <tony@chromium.org>

Reviewed by Ryosuke Niwa.

[gtk] strip NUL characters when copying text/html on GTK+
https://bugs.webkit.org/show_bug.cgi?id=52508

  • editing/pasteboard/copy-null-characters.html: Make sure we didn't

change innerHTML (it should still contain the null)

  • platform/gtk/Skipped: Re-enable the test

2011-01-26 Tony Chang <tony@chromium.org>

Reviewed by Ryosuke Niwa.

[gtk] strip NUL characters when copying text/html on GTK+
https://bugs.webkit.org/show_bug.cgi?id=52508

Putting NUL characters in the text/html clipboard doesn't work in
WebKit GTK+ (the pasted value is truncated at the NUL). Since we're
already stripping this character for plain text (for Windows), strip
it in text/html too.

  • editing/MarkupAccumulator.h: mark function as virtual
  • editing/markup.cpp: (WebCore::StyledMarkupAccumulator::appendString): (WebCore::StyledMarkupAccumulator::takeResults): strip nulls
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r76720 r76723  
     12011-01-26  Tony Chang  <tony@chromium.org>
     2
     3        Reviewed by Ryosuke Niwa.
     4
     5        [gtk] strip NUL characters when copying text/html on GTK+
     6        https://bugs.webkit.org/show_bug.cgi?id=52508
     7
     8        * editing/pasteboard/copy-null-characters.html: Make sure we didn't
     9            change innerHTML (it should still contain the null)
     10        * platform/gtk/Skipped: Re-enable the test
     11
    1122011-01-26  Martin Robinson  <mrobinson@igalia.com>
    213
  • trunk/LayoutTests/editing/pasteboard/copy-null-characters.html

    r76097 r76723  
    1212    var textWithNull = "Copy\0 paste me";
    1313    source.textContent = textWithNull;
     14
     15    var results = document.getElementById("results");
     16    // Make sure innerHTML still has the NULL.
     17    if (source.innerHTML != textWithNull) {
     18        results.innerText = "source.innerHTML has the wrong value (expected " +
     19            JSON.stringify(textWithNull) + " but found " +
     20            JSON.stringify(source.innerHTML) + ").";
     21        Markup.dump(document.body);
     22        Markup.notifyDone();
     23        return;
     24    }
     25
    1426    sel.setPosition(source, 0);
    1527    document.execCommand("SelectAll");
     
    2436    document.execCommand("Paste");
    2537
    26     var results = document.getElementById("results");
    2738    var expectedPlainTextValue = "Copy paste me";
    2839    if (expectedPlainTextValue != destinationPlainText.value) {
  • trunk/LayoutTests/platform/gtk/Skipped

    r76720 r76723  
    52735273http/tests/loading/cross-origin-XHR-willLoadRequest.html
    52745274
    5275 # https://bugs.webkit.org/show_bug.cgi?id=52508
    5276 editing/pasteboard/copy-null-characters.html
    5277 
    52785275# https://bugs.webkit.org/show_bug.cgi?id=52798
    52795276http/tests/security/local-CSS-from-remote.html
  • trunk/Source/WebCore/ChangeLog

    r76721 r76723  
     12011-01-26  Tony Chang  <tony@chromium.org>
     2
     3        Reviewed by Ryosuke Niwa.
     4
     5        [gtk] strip NUL characters when copying text/html on GTK+
     6        https://bugs.webkit.org/show_bug.cgi?id=52508
     7
     8        Putting NUL characters in the text/html clipboard doesn't work in
     9        WebKit GTK+ (the pasted value is truncated at the NUL).  Since we're
     10        already stripping this character for plain text (for Windows), strip
     11        it in text/html too.
     12
     13        * editing/MarkupAccumulator.h: mark function as virtual
     14        * editing/markup.cpp:
     15        (WebCore::StyledMarkupAccumulator::appendString):
     16        (WebCore::StyledMarkupAccumulator::takeResults): strip nulls
     17
    1182011-01-26  Mario Sanchez Prada  <msanchez@igalia.com>
    219
  • trunk/Source/WebCore/editing/MarkupAccumulator.h

    r69994 r76723  
    7373
    7474protected:
    75     void appendString(const String&);
     75    virtual void appendString(const String&);
    7676    void appendStartTag(Node*, Namespaces* = 0);
    7777    void appendEndTag(Node*);
  • trunk/Source/WebCore/editing/markup.cpp

    r76560 r76723  
    125125
    126126    Node* serializeNodes(Node* startNode, Node* pastEnd);
    127     void appendString(const String& s) { return MarkupAccumulator::appendString(s); }
     127    virtual void appendString(const String& s) { return MarkupAccumulator::appendString(s); }
    128128    void wrapWithNode(Node*, bool convertBlocksToInlines = false, RangeFullySelectsNode = DoesFullySelectNode);
    129129    void wrapWithStyleNode(CSSStyleDeclaration*, Document*, bool isBlock = false);
     
    185185    concatenateMarkup(result);
    186186
    187     return String::adopt(result);
     187    // We remove '\0' characters because they are not visibly rendered to the user.
     188    return String::adopt(result).replace(0, "");
    188189}
    189190
Note: See TracChangeset for help on using the changeset viewer.