Commit 9b814a43 authored by adele@apple.com's avatar adele@apple.com

WebCore:

2009-06-15  Adele Peterson  <adele@apple.com>

        Reviewed by Darin Adler.

        Fix for <rdar://problem/6907228> Pasting a paragraph as quotation leaves you typing in blue instead of black; repros

        * editing/InsertParagraphSeparatorCommand.cpp: (WebCore::InsertParagraphSeparatorCommand::doApply):
        When inserting a newline after the blockquote, we don't want to apply the original style after the insertion.

LayoutTests:

2009-06-15  Adele Peterson  <adele@apple.com>

        Reviewed by Darin Adler.

        Updating test for:
        <rdar://problem/6907228> Pasting a paragraph as quotation leaves you typing in blue instead of black; repros

        This test case covered inserting a newline after a blockquote, but outside of the blockquote.  I added some 
        text insertion to verify that the newline doesn't get any old styles copied from the blockquote.

        * editing/pasteboard/5368833.html:
        * platform/mac/editing/pasteboard/5368833-expected.checksum:
        * platform/mac/editing/pasteboard/5368833-expected.png:
        * platform/mac/editing/pasteboard/5368833-expected.txt:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@44712 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent acf7fea8
2009-06-15 Adele Peterson <adele@apple.com>
Reviewed by Darin Adler.
Updating test for:
<rdar://problem/6907228> Pasting a paragraph as quotation leaves you typing in blue instead of black; repros
This test case covered inserting a newline after a blockquote, but outside of the blockquote. I added some
text insertion to verify that the newline doesn't get any old styles copied from the blockquote.
* editing/pasteboard/5368833.html:
* platform/mac/editing/pasteboard/5368833-expected.checksum:
* platform/mac/editing/pasteboard/5368833-expected.png:
* platform/mac/editing/pasteboard/5368833-expected.txt:
2009-06-15 Chris Marrin <cmarrin@apple.com>
Reviewed by Simon Fraser <simon.fraser@apple.com>.
......@@ -7,7 +7,8 @@ blockquote {
}
</style>
<p>We copy and paste a blockquoted paragraph plus a paragraph break. The paragraph break shouldn't be inside the blockquote on paste. You should see 'hello' (blockquoted), empty paragraph, 'hello' (blockquoted), empty paragraph.</p>
<p>We copy and paste a blockquoted paragraph plus a paragraph break. The paragraph break shouldn't be inside the blockquote on paste.
You should see 'hello' (blockquoted), 'world' (not quoted, black text), 'hello' (blockquoted), empty paragraph.</p>
<div id="div" contenteditable="true"><br><blockquote id="blockquote" type="cite">hello<br></blockquote><br></div>
<script>
......@@ -18,4 +19,5 @@ sel.setBaseAndExtent(blockquote, 0, div, 2);
document.execCommand("Copy");
sel.setPosition(div, 0);
document.execCommand("Paste");
document.execCommand("InsertHTML", false, "world");
</script>
545484b97d9de4bc44a6027c77178b5d
\ No newline at end of file
c0c0d3df2a27f84bad5455b5cccaaf25
\ No newline at end of file
......@@ -8,7 +8,7 @@ layer at (0,0) size 800x600
text run at (0,0) width 435: "We copy and paste a blockquoted paragraph plus a paragraph break. "
text run at (435,0) width 349: "The paragraph break shouldn't be inside the blockquote"
text run at (0,18) width 60: "on paste. "
text run at (60,18) width 600: "You should see 'hello' (blockquoted), empty paragraph, 'hello' (blockquoted), empty paragraph."
text run at (60,18) width 687: "You should see 'hello' (blockquoted), 'world' (not quoted, black text), 'hello' (blockquoted), empty paragraph."
RenderBlock {DIV} at (0,52) size 784x72
RenderBlock {BLOCKQUOTE} at (0,0) size 784x18 [color=#0000FF] [border: (2px solid #0000FF)]
RenderText {#text} at (7,0) size 31x18
......@@ -16,12 +16,12 @@ layer at (0,0) size 800x600
RenderBR {BR} at (38,14) size 0x0
RenderBlock (anonymous) at (0,18) size 784x0
RenderBlock {DIV} at (0,18) size 784x18
RenderInline {FONT} at (0,0) size 0x18 [color=#0000FF]
RenderBR {BR} at (0,0) size 0x18
RenderText {#text} at (0,0) size 37x18
text run at (0,0) width 37: "world"
RenderBlock {BLOCKQUOTE} at (0,36) size 784x18 [color=#0000FF] [border: (2px solid #0000FF)]
RenderText {#text} at (7,0) size 31x18
text run at (7,0) width 31: "hello"
RenderBR {BR} at (38,14) size 0x0
RenderBlock (anonymous) at (0,54) size 784x18
RenderBR {BR} at (0,0) size 0x18
caret: position 0 of child 0 {BR} of child 0 {FONT} of child 1 {DIV} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
caret: position 5 of child 0 {#text} of child 1 {DIV} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
2009-06-15 Adele Peterson <adele@apple.com>
Reviewed by Darin Adler.
Fix for <rdar://problem/6907228> Pasting a paragraph as quotation leaves you typing in blue instead of black; repros
* editing/InsertParagraphSeparatorCommand.cpp: (WebCore::InsertParagraphSeparatorCommand::doApply):
When inserting a newline after the blockquote, we don't want to apply the original style after the insertion.
2009-06-15 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
......@@ -170,6 +170,7 @@ void InsertParagraphSeparatorCommand::doApply()
// Handle case when position is in the last visible position in its block,
// including when the block is empty.
if (isLastInBlock) {
bool shouldApplyStyleAfterInsertion = true;
if (nestNewBlock) {
if (isFirstInBlock && !lineBreakExistsAtVisiblePosition(visiblePos)) {
// The block is empty. Create an empty block to
......@@ -182,13 +183,18 @@ void InsertParagraphSeparatorCommand::doApply()
} else {
// We can get here if we pasted a copied portion of a blockquote with a newline at the end and are trying to paste it
// into an unquoted area. We then don't want the newline within the blockquote or else it will also be quoted.
Node* highestBlockquote = highestEnclosingNodeOfType(canonicalPos, &isMailBlockquote);
insertNodeAfter(blockToInsert, highestBlockquote ? highestBlockquote : startBlock);
if (Node* highestBlockquote = highestEnclosingNodeOfType(canonicalPos, &isMailBlockquote)) {
startBlock = static_cast<Element*>(highestBlockquote);
// When inserting the newline after the blockquote, we don't want to apply the original style after the insertion
shouldApplyStyleAfterInsertion = false;
}
insertNodeAfter(blockToInsert, startBlock);
}
appendBlockPlaceholder(blockToInsert);
setEndingSelection(VisibleSelection(Position(blockToInsert.get(), 0), DOWNSTREAM));
applyStyleAfterInsertion(startBlock);
if (shouldApplyStyleAfterInsertion)
applyStyleAfterInsertion(startBlock);
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment