Copying (createMarkup) wrapping text results in space between wrapped lines stripped.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Feb 2014 20:45:35 +0000 (20:45 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Feb 2014 20:45:35 +0000 (20:45 +0000)
commit612aa8f7dae453cbec70716e67ce52bb2ef7a35f
treef8bbf328c7c26cfc0b55ea1cd5c9118c3dead8a3
parentb07aba33cab68924f81777e6e3cf3b61cb297465
Copying (createMarkup) wrapping text results in space between wrapped lines stripped.
https://bugs.webkit.org/show_bug.cgi?id=63233

Source/WebCore:

The problem is StyledMarkupAccumulator uses renderedText and the space at
the end of the text has been stripped when the tag after the text was wrapped.

Patch by Chang Shu <cshu@webkit.org> on 2014-02-13
Reviewed by Ryosuke Niwa.

Test: editing/pasteboard/copy-text-with-wrapped-tag.html

* editing/TextIterator.cpp:
(WebCore::TextIterator::TextIterator):
(WebCore::TextIterator::handleTextBox):
* editing/TextIterator.h:
Check the special case when the iterator runs over a range that is followed by a non-text box.
In this case, the possible last space has been collapsed and needs to be restored.
* editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::renderedText):
Check if the range is followed by more nodes and pass this information to the constructed TextIterator.

LayoutTests:

Patch by Chang Shu <cshu@webkit.org> on 2014-02-13
Reviewed by Ryosuke Niwa.

The problem is StyledMarkupAccumulator uses renderedText and the space at
the end of the text has been stripped when the tag after the text was wrapped.

* editing/pasteboard/copy-text-with-wrapped-tag-expected.txt: Added.
* editing/pasteboard/copy-text-with-wrapped-tag.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@164047 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/editing/pasteboard/copy-text-with-wrapped-tag-expected.txt [new file with mode: 0644]
LayoutTests/editing/pasteboard/copy-text-with-wrapped-tag.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/editing/TextIterator.cpp
Source/WebCore/editing/TextIterator.h
Source/WebCore/editing/markup.cpp