-webkit-line-break: after-white-space sometimes truncates DOM on copy & paste
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Jun 2013 19:59:04 +0000 (19:59 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Jun 2013 19:59:04 +0000 (19:59 +0000)
commit50b4e61c93d80d491b5665b7d1f44e09600f2019
tree82a0dad55ec6158df105c755f7fc44e8e9c06a0d
parent62dbc8188cfe152ca5de56c589a86a00bbd9266d
-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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@152185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/editing/pasteboard/simplfiying-markup-should-not-strip-content-expected.txt [new file with mode: 0644]
LayoutTests/editing/pasteboard/simplfiying-markup-should-not-strip-content.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/editing/SimplifyMarkupCommand.cpp