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 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 attributeEquivalents[i]->addToStyle(element, this); | 1000 attributeEquivalents[i]->addToStyle(element, this); |
1001 } | 1001 } |
1002 } | 1002 } |
1003 | 1003 |
1004 PassRefPtr<EditingStyle> EditingStyle::wrappingStyleForSerialization(Node* conte
xt, bool shouldAnnotate) | 1004 PassRefPtr<EditingStyle> EditingStyle::wrappingStyleForSerialization(Node* conte
xt, bool shouldAnnotate) |
1005 { | 1005 { |
1006 RefPtr<EditingStyle> wrappingStyle; | 1006 RefPtr<EditingStyle> wrappingStyle; |
1007 if (shouldAnnotate) { | 1007 if (shouldAnnotate) { |
1008 wrappingStyle = EditingStyle::create(context, EditingStyle::EditingPrope
rtiesInEffect); | 1008 wrappingStyle = EditingStyle::create(context, EditingStyle::EditingPrope
rtiesInEffect); |
1009 | 1009 |
1010 // Styles that Mail blockquotes contribute should only be placed on the
Mail blockquote, | |
1011 // to help us differentiate those styles from ones that the user has app
lied. | |
1012 // This helps us get the color of content pasted into blockquotes right. | |
1013 wrappingStyle->removeStyleAddedByNode(enclosingNodeOfType(firstPositionI
nOrBeforeNode(context), isMailBlockquote, CanCrossEditingBoundary)); | |
1014 | |
1015 // Call collapseTextDecorationProperties first or otherwise it'll copy t
he value over from in-effect to text-decorations. | 1010 // Call collapseTextDecorationProperties first or otherwise it'll copy t
he value over from in-effect to text-decorations. |
1016 wrappingStyle->collapseTextDecorationProperties(); | 1011 wrappingStyle->collapseTextDecorationProperties(); |
1017 | 1012 |
1018 return wrappingStyle.release(); | 1013 return wrappingStyle.release(); |
1019 } | 1014 } |
1020 | 1015 |
1021 wrappingStyle = EditingStyle::create(); | 1016 wrappingStyle = EditingStyle::create(); |
1022 | 1017 |
1023 // When not annotating for interchange, we only preserve inline style declar
ations. | 1018 // When not annotating for interchange, we only preserve inline style declar
ations. |
1024 for (Node* node = context; node && !node->isDocumentNode(); node = node->par
entNode()) { | 1019 for (Node* node = context; node && !node->isDocumentNode(); node = node->par
entNode()) { |
1025 if (node->isStyledElement() && !isMailBlockquote(node)) { | 1020 if (node->isStyledElement()) { |
1026 wrappingStyle->mergeInlineAndImplicitStyleOfElement(static_cast<Styl
edElement*>(node), EditingStyle::DoNotOverrideValues, | 1021 wrappingStyle->mergeInlineAndImplicitStyleOfElement(static_cast<Styl
edElement*>(node), EditingStyle::DoNotOverrideValues, |
1027 EditingStyle::EditingPropertiesInEffect); | 1022 EditingStyle::EditingPropertiesInEffect); |
1028 } | 1023 } |
1029 } | 1024 } |
1030 | 1025 |
1031 return wrappingStyle.release(); | 1026 return wrappingStyle.release(); |
1032 } | 1027 } |
1033 | 1028 |
1034 | 1029 |
1035 static void mergeTextDecorationValues(CSSValueList* mergedValue, const CSSValueL
ist* valueToMerge) | 1030 static void mergeTextDecorationValues(CSSValueList* mergedValue, const CSSValueL
ist* valueToMerge) |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 { | 1591 { |
1597 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1592 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
1598 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); | 1593 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); |
1599 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1594 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
1600 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1595 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
1601 } | 1596 } |
1602 return 0; | 1597 return 0; |
1603 } | 1598 } |
1604 | 1599 |
1605 } | 1600 } |
OLD | NEW |