Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Unified Diff: third_party/WebKit/WebCore/editing/ReplaceSelectionCommand.cpp

Issue 46097: WebKit merge 41660:41709 (WebKit side).... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/WebCore/editing/ReplaceSelectionCommand.cpp
===================================================================
--- third_party/WebKit/WebCore/editing/ReplaceSelectionCommand.cpp (revision 11711)
+++ third_party/WebKit/WebCore/editing/ReplaceSelectionCommand.cpp (working copy)
@@ -527,8 +527,9 @@
{
Node* topNode = fragment.firstChild();
- // Handling this case is more complicated (see handleStyleSpans) and doesn't receive the optimization.
- if (isMailPasteAsQuotationNode(topNode))
+ // Handling the case where we are doing Paste as Quotation or pasting into quoted content is more complicated (see handleStyleSpans)
+ // and doesn't receive the optimization.
+ if (isMailPasteAsQuotationNode(topNode) || nearestMailBlockquote(topNode))
return false;
// Either there are no style spans in the fragment or a WebKit client has added content to the fragment
@@ -591,11 +592,12 @@
RefPtr<CSSMutableStyleDeclaration> sourceDocumentStyle = static_cast<HTMLElement*>(sourceDocumentStyleSpan)->getInlineStyleDecl()->copy();
Node* context = sourceDocumentStyleSpan->parentNode();
- // If Mail wraps the fragment with a Paste as Quotation blockquote, styles from that element are
- // allowed to override those from the source document, see <rdar://problem/4930986>.
- if (isMailPasteAsQuotationNode(context)) {
- RefPtr<CSSMutableStyleDeclaration> blockquoteStyle = computedStyle(context)->copyInheritableProperties();
- RefPtr<CSSMutableStyleDeclaration> parentStyle = computedStyle(context->parentNode())->copyInheritableProperties();
+ // If Mail wraps the fragment with a Paste as Quotation blockquote, or if you're pasting into a quoted region,
+ // styles from blockquoteNode are allowed to override those from the source document, see <rdar://problem/4930986> and <rdar://problem/5089327>.
+ Node* blockquoteNode = isMailPasteAsQuotationNode(context) ? context : nearestMailBlockquote(context);
+ if (blockquoteNode) {
+ RefPtr<CSSMutableStyleDeclaration> blockquoteStyle = computedStyle(blockquoteNode)->copyInheritableProperties();
+ RefPtr<CSSMutableStyleDeclaration> parentStyle = computedStyle(blockquoteNode->parentNode())->copyInheritableProperties();
parentStyle->diff(blockquoteStyle.get());
CSSMutableStyleDeclaration::const_iterator end = blockquoteStyle->end();
@@ -604,7 +606,7 @@
sourceDocumentStyle->removeProperty(property.id());
}
- context = context->parentNode();
+ context = blockquoteNode->parentNode();
}
RefPtr<CSSMutableStyleDeclaration> contextStyle = computedStyle(context)->copyInheritableProperties();
« no previous file with comments | « third_party/WebKit/WebCore/dom/QualifiedName.h ('k') | third_party/WebKit/WebCore/loader/CrossOriginAccessControl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698