WebCore:
Reviewed by Darin.
<rdar://problem/5368833>
REGRESSION: Pasting a triple-clicked line of quoted text at the top of a message adds an extra, quoted line
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::insertParagraphSeparator): Added an option for
using a plain div to hold the new paragraph, instead of a clone of the previous
block.
* editing/CompositeEditCommand.h:
* editing/InsertParagraphSeparatorCommand.cpp: Ditto.
(WebCore::InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand): Ditto.
(WebCore::InsertParagraphSeparatorCommand::doApply): Ditto.
* editing/InsertParagraphSeparatorCommand.h:
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::doApply): Use a default block element when creating
new paragraphs, so that empty paragraphs don't contain the block style of the previous
one.
Don't expand collapsed brs at the end of inserted content, this was the root of the bug.
We'd copy <blockquote>hello<br></blockquote><br class="Apple-interchange-newline">
and get an extra paragraph. The removed code used to make sure that if the copied
selection ends with a paragraph break that is represented in the copied markup by a
regular br (not an interchange newline br), that that paragraph break appears in the
pasted content, but shouldMergeEnd, which was introduced after this code was written,
now takes care of that.
(WebCore::ReplaceSelectionCommand::shouldRemoveEndBR): Inserted content should always
displace placeholder brs, even if that inserted content ends with a br.
* editing/markup.cpp:
(WebCore::needInterchangeNewlineAfter): This code failed to add an interchange newline
if the user copied <div>hello</div><br>, only don't add an interchange newline when
copying ^hello<br>^<br>, because then the copied paragraph break will already be
represented in the copied markup by a br.
(WebCore::createMarkup):
LayoutTests:
Reviewed by Darin.
<rdar://problem/5368833>
REGRESSION: Pasting a triple-clicked line of quoted text at the top of a message adds an extra, quoted line
Tested for behavior that we no longer want to have:
* editing/pasteboard/quirks-mode-br-2-expected.checksum: Removed.
* editing/pasteboard/quirks-mode-br-2-expected.png: Removed.
* editing/pasteboard/quirks-mode-br-2-expected.txt: Removed.
* editing/pasteboard/quirks-mode-br-2.html: Removed.
* platform/mac/editing/pasteboard: Added.
Demonstrates bug:
* editing/pasteboard/5368833.html: Added.
* platform/mac/editing/pasteboard/5368833-expected.checksum: Added.
* platform/mac/editing/pasteboard/5368833-expected.png: Added.
* platform/mac/editing/pasteboard/5368833-expected.txt: Added.
Regenerated these expected results to reflect new behavior:
* editing/pasteboard/paste-text-012-expected.checksum: Removed.
* editing/pasteboard/paste-text-012-expected.png: Removed.
* editing/pasteboard/paste-text-012-expected.txt: Removed.
* editing/pasteboard/paste-text-013-expected.checksum: Removed.
* editing/pasteboard/paste-text-016-expected.checksum: Removed.
* editing/pasteboard/paste-text-016-expected.png: Removed.
* editing/pasteboard/paste-text-016-expected.txt: Removed.
* platform/mac/editing/pasteboard/paste-text-012-expected.checksum: Added.
* platform/mac/editing/pasteboard/paste-text-012-expected.png: Added.
* platform/mac/editing/pasteboard/paste-text-012-expected.txt: Added.
* platform/mac/editing/pasteboard/paste-text-013-expected.checksum: Added.
* platform/mac/editing/pasteboard/paste-text-013-expected.png: Added.
* platform/mac/editing/pasteboard/paste-text-013-expected.txt: Added.
* platform/mac/editing/pasteboard/paste-text-016-expected.checksum: Added.
* platform/mac/editing/pasteboard/paste-text-016-expected.png: Added.
* platform/mac/editing/pasteboard/paste-text-016-expected.txt: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@25327
268f45cc-cd09-0410-ab3c-
d52691b4dbfc