diff options
Diffstat (limited to 'src/3rdparty/webkit/WebCore/editing/InsertParagraphSeparatorCommand.cpp')
-rw-r--r-- | src/3rdparty/webkit/WebCore/editing/InsertParagraphSeparatorCommand.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/3rdparty/webkit/WebCore/editing/InsertParagraphSeparatorCommand.cpp b/src/3rdparty/webkit/WebCore/editing/InsertParagraphSeparatorCommand.cpp index 734d8fc..7d6e5c4 100644 --- a/src/3rdparty/webkit/WebCore/editing/InsertParagraphSeparatorCommand.cpp +++ b/src/3rdparty/webkit/WebCore/editing/InsertParagraphSeparatorCommand.cpp @@ -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; } |