Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 blockquote, |
|
yosin_UTC9
2015/06/24 05:52:17
Could you fill comment lines in 80 chars?
hajimehoshi
2015/06/24 06:03:16
Done.
| |
| 1101 // to help us differentiate those styles from ones that the user has app lied. | 1099 // to help us differentiate those styles from ones that the user has applied . |
| 1102 // This helps us get the color of content pasted into blockquotes right. | 1100 // This helps us get the color of content pasted into blockquotes right. |
| 1103 wrappingStyle->removeStyleAddedByElement(toHTMLElement(enclosingNodeOfTy pe(firstPositionInOrBeforeNode(context), isMailHTMLBlockquoteElement, CanCrossEd itingBoundary))); | 1101 wrappingStyle->removeStyleAddedByElement(toHTMLElement(enclosingNodeOfType(f irstPositionInOrBeforeNode(context), isMailHTMLBlockquoteElement, CanCrossEditin gBoundary))); |
| 1104 | 1102 |
| 1105 // Call collapseTextDecorationProperties first or otherwise it'll copy t he value over from in-effect to text-decorations. | 1103 // Call collapseTextDecorationProperties first or otherwise it'll copy the v alue over from in-effect to text-decorations. |
| 1106 wrappingStyle->collapseTextDecorationProperties(); | 1104 wrappingStyle->collapseTextDecorationProperties(); |
| 1107 | 1105 |
| 1108 return wrappingStyle.release(); | 1106 return wrappingStyle.release(); |
| 1109 } | 1107 } |
| 1110 | 1108 |
| 1111 wrappingStyle = EditingStyle::create(); | 1109 PassRefPtrWillBeRawPtr<EditingStyle> EditingStyle::wrappingStyleForSerialization (ContainerNode* context) |
| 1110 { | |
| 1111 RefPtrWillBeRawPtr<EditingStyle> wrappingStyle = EditingStyle::create(); | |
| 1112 | 1112 |
| 1113 // When not annotating for interchange, we only preserve inline style declar ations. | 1113 // When not annotating for interchange, we only preserve inline style declar ations. |
| 1114 for (ContainerNode* node = context; node && !node->isDocumentNode(); node = node->parentNode()) { | 1114 for (ContainerNode* node = context; node && !node->isDocumentNode(); node = node->parentNode()) { |
| 1115 if (node->isStyledElement() && !isMailHTMLBlockquoteElement(node)) { | 1115 if (node->isStyledElement() && !isMailHTMLBlockquoteElement(node)) { |
| 1116 wrappingStyle->mergeInlineAndImplicitStyleOfElement(toElement(node), EditingStyle::DoNotOverrideValues, | 1116 wrappingStyle->mergeInlineAndImplicitStyleOfElement(toElement(node), EditingStyle::DoNotOverrideValues, |
| 1117 EditingStyle::EditingPropertiesInEffect); | 1117 EditingStyle::EditingPropertiesInEffect); |
| 1118 } | 1118 } |
| 1119 } | 1119 } |
| 1120 | 1120 |
| 1121 return wrappingStyle.release(); | 1121 return wrappingStyle.release(); |
| 1122 } | 1122 } |
| 1123 | 1123 |
| 1124 | |
| 1125 static void mergeTextDecorationValues(CSSValueList* mergedValue, const CSSValueL ist* valueToMerge) | 1124 static void mergeTextDecorationValues(CSSValueList* mergedValue, const CSSValueL ist* valueToMerge) |
| 1126 { | 1125 { |
| 1127 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, underline, (CSSPrimi tiveValue::createIdentifier(CSSValueUnderline))); | 1126 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))); | 1127 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, lineThrough, (CSSPri mitiveValue::createIdentifier(CSSValueLineThrough))); |
| 1129 if (valueToMerge->hasValue(underline) && !mergedValue->hasValue(underline)) | 1128 if (valueToMerge->hasValue(underline) && !mergedValue->hasValue(underline)) |
| 1130 mergedValue->append(underline); | 1129 mergedValue->append(underline); |
| 1131 | 1130 |
| 1132 if (valueToMerge->hasValue(lineThrough) && !mergedValue->hasValue(lineThroug h)) | 1131 if (valueToMerge->hasValue(lineThrough) && !mergedValue->hasValue(lineThroug h)) |
| 1133 mergedValue->append(lineThrough); | 1132 mergedValue->append(lineThrough); |
| 1134 } | 1133 } |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1708 { | 1707 { |
| 1709 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1708 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
| 1710 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu tedStyleDeclaration::create(ancestor); | 1709 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu tedStyleDeclaration::create(ancestor); |
| 1711 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1710 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
| 1712 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor ); | 1711 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor ); |
| 1713 } | 1712 } |
| 1714 return nullptr; | 1713 return nullptr; |
| 1715 } | 1714 } |
| 1716 | 1715 |
| 1717 } | 1716 } |
| OLD | NEW |