Copied text would contain text inside CDATA sections and comments
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Nov 2016 22:21:35 +0000 (22:21 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Nov 2016 22:21:35 +0000 (22:21 +0000)
commitc6e7702ca4646e9846f5d5a50883f533c7dd3bb9
tree9e8811b887489e3d8aa6ad4651e87fecbe7dd1ed
parent98ee6bdcbfe2545281112df98a51349279acdf9b
Copied text would contain text inside CDATA sections and comments
https://bugs.webkit.org/show_bug.cgi?id=164578
Source/WebCore:

<rdar://problem/19834542>

Reviewed by Darin Adler.

The bug was caused by HTMLConverter::_traverseNode always including the content of a Text node.
Since Comment and CDataSection nodes are also Text nodes, we need to exclude them.

In the long term, we should check the visibility of the text as done in MarkupAccumulator.

Test: editing/mac/attributed-string/comment-cdata-section.html

* editing/cocoa/HTMLConverter.mm:
(HTMLConverter::_traverseNode):

LayoutTests:

Reviewed by Darin Adler.

Added a regression test for creating an attributed string from different kinds of Text nodes.
Comment and CDataSection should not be included in the attributed string.

* editing/mac/attributed-string/comment-cdata-section-expected.txt: Added.
* editing/mac/attributed-string/comment-cdata-section.html: Added.
* platform/mac-yosemite/editing/mac/attributed-string/comment-cdata-section-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/editing/mac/attributed-string/comment-cdata-section-expected.txt [new file with mode: 0644]
LayoutTests/editing/mac/attributed-string/comment-cdata-section.html [new file with mode: 0644]
LayoutTests/platform/mac-yosemite/editing/mac/attributed-string/comment-cdata-section-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/editing/cocoa/HTMLConverter.mm