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

Side by Side Diff: Source/core/editing/EditingStyle.cpp

Issue 1195813003: Refactoring: Remove a boolean parameter from EditingStyle::wrappingStyleForSerialization (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: comment 80 chars in a line Created 5 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/editing/EditingStyle.h ('k') | Source/core/editing/StyledMarkupSerializer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009 Apple Computer, Inc. 2 * Copyright (C) 2007, 2008, 2009 Apple Computer, Inc.
3 * Copyright (C) 2010, 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2010, 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 1084
1085 const WillBeHeapVector<OwnPtrWillBeMember<HTMLAttributeEquivalent>>& attribu teEquivalents = htmlAttributeEquivalents(); 1085 const WillBeHeapVector<OwnPtrWillBeMember<HTMLAttributeEquivalent>>& attribu teEquivalents = htmlAttributeEquivalents();
1086 for (const auto& attribute : attributeEquivalents) { 1086 for (const auto& attribute : attributeEquivalents) {
1087 if (attribute->attributeName() == HTMLNames::dirAttr) 1087 if (attribute->attributeName() == HTMLNames::dirAttr)
1088 continue; // We don't want to include directionality 1088 continue; // We don't want to include directionality
1089 if (elementMatchesAndPropertyIsNotInInlineStyleDecl(attribute.get(), ele ment, mode, m_mutableStyle.get())) 1089 if (elementMatchesAndPropertyIsNotInInlineStyleDecl(attribute.get(), ele ment, mode, m_mutableStyle.get()))
1090 attribute->addToStyle(element, this); 1090 attribute->addToStyle(element, this);
1091 } 1091 }
1092 } 1092 }
1093 1093
1094 PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::wrappingStyleForSerialization (ContainerNode* context, bool shouldAnnotate) 1094 PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::wrappingStyleForAnnotatedSeri alization(ContainerNode* context)
1095 { 1095 {
1096 RefPtrWillBeRawPtr<EditingStyle> wrappingStyle = nullptr; 1096 RefPtrWillBeRawPtr<EditingStyle> wrappingStyle = EditingStyle::create(contex t, EditingStyle::EditingPropertiesInEffect);
1097 if (shouldAnnotate) {
1098 wrappingStyle = EditingStyle::create(context, EditingStyle::EditingPrope rtiesInEffect);
1099 1097
1100 // Styles that Mail blockquotes contribute should only be placed on the Mail blockquote, 1098 // Styles that Mail blockquotes contribute should only be placed on the Mail
1101 // to help us differentiate those styles from ones that the user has app lied. 1099 // blockquote, to help us differentiate those styles from ones that the user
1102 // This helps us get the color of content pasted into blockquotes right. 1100 // has applied. This helps us get the color of content pasted into
1103 wrappingStyle->removeStyleAddedByElement(toHTMLElement(enclosingNodeOfTy pe(firstPositionInOrBeforeNode(context), isMailHTMLBlockquoteElement, CanCrossEd itingBoundary))); 1101 // blockquotes right.
1102 wrappingStyle->removeStyleAddedByElement(toHTMLElement(enclosingNodeOfType(f irstPositionInOrBeforeNode(context), isMailHTMLBlockquoteElement, CanCrossEditin gBoundary)));
1104 1103
1105 // Call collapseTextDecorationProperties first or otherwise it'll copy t he value over from in-effect to text-decorations. 1104 // Call collapseTextDecorationProperties first or otherwise it'll copy the v alue over from in-effect to text-decorations.
1106 wrappingStyle->collapseTextDecorationProperties(); 1105 wrappingStyle->collapseTextDecorationProperties();
1107 1106
1108 return wrappingStyle.release(); 1107 return wrappingStyle.release();
1109 } 1108 }
1110 1109
1111 wrappingStyle = EditingStyle::create(); 1110 PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::wrappingStyleForSerialization (ContainerNode* context)
1111 {
1112 RefPtrWillBeRawPtr<EditingStyle> wrappingStyle = EditingStyle::create();
1112 1113
1113 // When not annotating for interchange, we only preserve inline style declar ations. 1114 // When not annotating for interchange, we only preserve inline style declar ations.
1114 for (ContainerNode* node = context; node && !node->isDocumentNode(); node = node->parentNode()) { 1115 for (ContainerNode* node = context; node && !node->isDocumentNode(); node = node->parentNode()) {
1115 if (node->isStyledElement() && !isMailHTMLBlockquoteElement(node)) { 1116 if (node->isStyledElement() && !isMailHTMLBlockquoteElement(node)) {
1116 wrappingStyle->mergeInlineAndImplicitStyleOfElement(toElement(node), EditingStyle::DoNotOverrideValues, 1117 wrappingStyle->mergeInlineAndImplicitStyleOfElement(toElement(node), EditingStyle::DoNotOverrideValues,
1117 EditingStyle::EditingPropertiesInEffect); 1118 EditingStyle::EditingPropertiesInEffect);
1118 } 1119 }
1119 } 1120 }
1120 1121
1121 return wrappingStyle.release(); 1122 return wrappingStyle.release();
1122 } 1123 }
1123 1124
1124
1125 static void mergeTextDecorationValues(CSSValueList* mergedValue, const CSSValueL ist* valueToMerge) 1125 static void mergeTextDecorationValues(CSSValueList* mergedValue, const CSSValueL ist* valueToMerge)
1126 { 1126 {
1127 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, underline, (CSSPrimi tiveValue::createIdentifier(CSSValueUnderline))); 1127 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, underline, (CSSPrimi tiveValue::createIdentifier(CSSValueUnderline)));
1128 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, lineThrough, (CSSPri mitiveValue::createIdentifier(CSSValueLineThrough))); 1128 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, lineThrough, (CSSPri mitiveValue::createIdentifier(CSSValueLineThrough)));
1129 if (valueToMerge->hasValue(underline) && !mergedValue->hasValue(underline)) 1129 if (valueToMerge->hasValue(underline) && !mergedValue->hasValue(underline))
1130 mergedValue->append(underline); 1130 mergedValue->append(underline);
1131 1131
1132 if (valueToMerge->hasValue(lineThrough) && !mergedValue->hasValue(lineThroug h)) 1132 if (valueToMerge->hasValue(lineThrough) && !mergedValue->hasValue(lineThroug h))
1133 mergedValue->append(lineThrough); 1133 mergedValue->append(lineThrough);
1134 } 1134 }
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
1708 { 1708 {
1709 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { 1709 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) {
1710 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu tedStyleDeclaration::create(ancestor); 1710 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu tedStyleDeclaration::create(ancestor);
1711 if (!hasTransparentBackgroundColor(ancestorStyle.get())) 1711 if (!hasTransparentBackgroundColor(ancestorStyle.get()))
1712 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor ); 1712 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor );
1713 } 1713 }
1714 return nullptr; 1714 return nullptr;
1715 } 1715 }
1716 1716
1717 } 1717 }
OLDNEW
« no previous file with comments | « Source/core/editing/EditingStyle.h ('k') | Source/core/editing/StyledMarkupSerializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698