Changeset 152185 in webkit


Ignore:
Timestamp:
Jun 28, 2013 12:59:04 PM (11 years ago)
Author:
rniwa@webkit.org
Message:

-webkit-line-break: after-white-space sometimes truncates DOM on copy & paste
https://bugs.webkit.org/show_bug.cgi?id=118164

Reviewed by Sam Weinig.

Source/WebCore:

We can't assume that all subsequent ancestors contain exactly one child since they could have been
added in the first if statement matching: currentNode->parentNode() != rootNode && isRemovableBlock(currentNode)

Exit early when we encounter such an ancestor since removing its ancestor (that contains multiple children
some of which aren't in nodesToRemove) can clobber more nodes than we're allowed to remove.

Test: editing/pasteboard/simplfiying-markup-should-not-strip-content.html

  • editing/SimplifyMarkupCommand.cpp:

(WebCore::SimplifyMarkupCommand::doApply):
(WebCore::SimplifyMarkupCommand::pruneSubsequentAncestorsToRemove):

LayoutTests:

Add a regression test.

  • editing/pasteboard/simplfiying-markup-should-not-strip-content-expected.txt: Added.
  • editing/pasteboard/simplfiying-markup-should-not-strip-content.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r152184 r152185  
     12013-06-28  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        -webkit-line-break: after-white-space sometimes truncates DOM on copy & paste
     4        https://bugs.webkit.org/show_bug.cgi?id=118164
     5
     6        Reviewed by Sam Weinig.
     7
     8        Add a regression test.
     9
     10        * editing/pasteboard/simplfiying-markup-should-not-strip-content-expected.txt: Added.
     11        * editing/pasteboard/simplfiying-markup-should-not-strip-content.html: Added.
     12
    1132013-06-28  Jer Noble  <jer.noble@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r152183 r152185  
     12013-06-28  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        -webkit-line-break: after-white-space sometimes truncates DOM on copy & paste
     4        https://bugs.webkit.org/show_bug.cgi?id=118164
     5
     6        Reviewed by Sam Weinig.
     7
     8        We can't assume that all subsequent ancestors contain exactly one child since they could have been
     9        added in the first if statement matching: currentNode->parentNode() != rootNode && isRemovableBlock(currentNode)
     10
     11        Exit early when we encounter such an ancestor since removing its ancestor (that contains multiple children
     12        some of which aren't in nodesToRemove) can clobber more nodes than we're allowed to remove.
     13
     14        Test: editing/pasteboard/simplfiying-markup-should-not-strip-content.html
     15
     16        * editing/SimplifyMarkupCommand.cpp:
     17        (WebCore::SimplifyMarkupCommand::doApply):
     18        (WebCore::SimplifyMarkupCommand::pruneSubsequentAncestorsToRemove):
     19
    1202013-06-28  Gwang Yoon Hwang  <ryumiel@company100.net>
    221
  • trunk/Source/WebCore/editing/SimplifyMarkupCommand.cpp

    r138303 r152185  
    4545    Vector<RefPtr<Node> > nodesToRemove;
    4646   
     47    document()->updateLayoutIgnorePendingStylesheets();
     48
    4749    // Walk through the inserted nodes, to see if there are elements that could be removed
    4850    // without affecting the style. The goal is to produce leaner markup even when starting
     
    103105        if (nodesToRemove[pastLastNodeToRemove - 1]->parentNode() != nodesToRemove[pastLastNodeToRemove])
    104106            break;
    105         ASSERT(nodesToRemove[pastLastNodeToRemove]->firstChild() == nodesToRemove[pastLastNodeToRemove]->lastChild());
     107        if (nodesToRemove[pastLastNodeToRemove]->firstChild() != nodesToRemove[pastLastNodeToRemove]->lastChild())
     108            break;
    106109    }
    107110
Note: See TracChangeset for help on using the changeset viewer.