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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #include "core/editing/FrameSelection.h" | 49 #include "core/editing/FrameSelection.h" |
50 #include "core/editing/HTMLInterchange.h" | 50 #include "core/editing/HTMLInterchange.h" |
51 #include "core/editing/htmlediting.h" | 51 #include "core/editing/htmlediting.h" |
52 #include "core/html/HTMLFontElement.h" | 52 #include "core/html/HTMLFontElement.h" |
53 #include "core/page/Frame.h" | 53 #include "core/page/Frame.h" |
54 #include "core/page/RuntimeCSSEnabled.h" | 54 #include "core/page/RuntimeCSSEnabled.h" |
55 #include "core/rendering/style/RenderStyle.h" | 55 #include "core/rendering/style/RenderStyle.h" |
56 | 56 |
57 namespace WebCore { | 57 namespace WebCore { |
58 | 58 |
59 static const CSSPropertyID& textDecorationPropertyForEditing() | |
60 { | |
61 static const CSSPropertyID property = RuntimeEnabledFeatures::css3TextDecora
tionsEnabled() ? CSSPropertyTextDecorationLine : CSSPropertyTextDecoration; | |
62 return property; | |
63 } | |
64 | |
65 // Editing style properties must be preserved during editing operation. | 59 // Editing style properties must be preserved during editing operation. |
66 // e.g. when a user inserts a new paragraph, all properties listed here must be
copied to the new paragraph. | 60 // e.g. when a user inserts a new paragraph, all properties listed here must be
copied to the new paragraph. |
67 // NOTE: Use editingProperties() to respect runtime enabling of properties. | 61 // NOTE: Use editingProperties() to respect runtime enabling of properties. |
68 static const unsigned nonInheritedStaticPropertiesCount = 3; | 62 static const unsigned nonInheritedStaticPropertiesCount = 2; |
69 | 63 |
70 static const CSSPropertyID staticEditingProperties[] = { | 64 static const CSSPropertyID staticEditingProperties[] = { |
71 // NOTE: inheritableEditingProperties depends on these properties being firs
t. | 65 // NOTE: inheritableEditingProperties depends on these two properties being
first. |
72 // If you change this list, make sure to update nonInheritedPropertyCount. | 66 // If you change this list, make sure to update nonInheritedPropertyCount. |
73 CSSPropertyBackgroundColor, | 67 CSSPropertyBackgroundColor, |
74 // FIXME: CSSPropertyTextDecoration needs to be removed when CSS3 Text | |
75 // Decoration feature is no longer experimental. | |
76 CSSPropertyTextDecoration, | 68 CSSPropertyTextDecoration, |
77 CSSPropertyTextDecorationLine, | |
78 | 69 |
79 // CSS inheritable properties | 70 // CSS inheritable properties |
80 CSSPropertyColor, | 71 CSSPropertyColor, |
81 CSSPropertyFontFamily, | 72 CSSPropertyFontFamily, |
82 CSSPropertyFontSize, | 73 CSSPropertyFontSize, |
83 CSSPropertyFontStyle, | 74 CSSPropertyFontStyle, |
84 CSSPropertyFontVariant, | 75 CSSPropertyFontVariant, |
85 CSSPropertyFontWeight, | 76 CSSPropertyFontWeight, |
86 CSSPropertyLetterSpacing, | 77 CSSPropertyLetterSpacing, |
87 CSSPropertyLineHeight, | 78 CSSPropertyLineHeight, |
88 CSSPropertyOrphans, | 79 CSSPropertyOrphans, |
89 CSSPropertyTextAlign, | 80 CSSPropertyTextAlign, |
90 CSSPropertyTextIndent, | 81 CSSPropertyTextIndent, |
91 CSSPropertyTextTransform, | 82 CSSPropertyTextTransform, |
92 CSSPropertyWhiteSpace, | 83 CSSPropertyWhiteSpace, |
93 CSSPropertyWidows, | 84 CSSPropertyWidows, |
94 CSSPropertyWordSpacing, | 85 CSSPropertyWordSpacing, |
95 CSSPropertyWebkitTextDecorationsInEffect, | 86 CSSPropertyWebkitTextDecorationsInEffect, |
96 CSSPropertyWebkitTextFillColor, | 87 CSSPropertyWebkitTextFillColor, |
97 CSSPropertyWebkitTextStrokeColor, | 88 CSSPropertyWebkitTextStrokeColor, |
98 CSSPropertyWebkitTextStrokeWidth, | 89 CSSPropertyWebkitTextStrokeWidth, |
99 }; | 90 }; |
100 | 91 |
101 enum EditingPropertiesType { OnlyInheritableEditingProperties, AllEditingPropert
ies }; | 92 enum EditingPropertiesType { OnlyInheritableEditingProperties, AllEditingPropert
ies }; |
102 | 93 |
103 static const Vector<CSSPropertyID>& allEditingProperties() | 94 static const Vector<CSSPropertyID>& allEditingProperties() |
104 { | 95 { |
105 DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ()); | 96 DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ()); |
106 if (properties.isEmpty()) { | 97 if (properties.isEmpty()) |
107 RuntimeCSSEnabled::filterEnabledCSSPropertiesIntoVector(staticEditingPro
perties, WTF_ARRAY_LENGTH(staticEditingProperties), properties); | 98 RuntimeCSSEnabled::filterEnabledCSSPropertiesIntoVector(staticEditingPro
perties, WTF_ARRAY_LENGTH(staticEditingProperties), properties); |
108 // This ensures we have only one of these properties on the vector. | |
109 if (RuntimeEnabledFeatures::css3TextDecorationsEnabled()) | |
110 properties.remove(properties.find(CSSPropertyTextDecoration)); | |
111 else | |
112 properties.remove(properties.find(CSSPropertyTextDecorationLine)); | |
113 } | |
114 return properties; | 99 return properties; |
115 } | 100 } |
116 | 101 |
117 static const Vector<CSSPropertyID>& inheritableEditingProperties() | 102 static const Vector<CSSPropertyID>& inheritableEditingProperties() |
118 { | 103 { |
119 DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ()); | 104 DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ()); |
120 if (properties.isEmpty()) | 105 if (properties.isEmpty()) |
121 RuntimeCSSEnabled::filterEnabledCSSPropertiesIntoVector(staticEditingPro
perties + nonInheritedStaticPropertiesCount, WTF_ARRAY_LENGTH(staticEditingPrope
rties) - nonInheritedStaticPropertiesCount, properties); | 106 RuntimeCSSEnabled::filterEnabledCSSPropertiesIntoVector(staticEditingPro
perties + nonInheritedStaticPropertiesCount, WTF_ARRAY_LENGTH(staticEditingPrope
rties) - nonInheritedStaticPropertiesCount, properties); |
122 return properties; | 107 return properties; |
123 } | 108 } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 return adoptPtr(new HTMLTextDecorationEquivalent(primitiveValue, tagName
)); | 197 return adoptPtr(new HTMLTextDecorationEquivalent(primitiveValue, tagName
)); |
213 } | 198 } |
214 virtual bool propertyExistsInStyle(const StylePropertySet*) const; | 199 virtual bool propertyExistsInStyle(const StylePropertySet*) const; |
215 virtual bool valueIsPresentInStyle(Element*, StylePropertySet*) const; | 200 virtual bool valueIsPresentInStyle(Element*, StylePropertySet*) const; |
216 | 201 |
217 private: | 202 private: |
218 HTMLTextDecorationEquivalent(CSSValueID primitiveValue, const QualifiedName&
tagName); | 203 HTMLTextDecorationEquivalent(CSSValueID primitiveValue, const QualifiedName&
tagName); |
219 }; | 204 }; |
220 | 205 |
221 HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent(CSSValueID primitiveV
alue, const QualifiedName& tagName) | 206 HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent(CSSValueID primitiveV
alue, const QualifiedName& tagName) |
222 : HTMLElementEquivalent(textDecorationPropertyForEditing(), primitiveValue,
tagName) | 207 : HTMLElementEquivalent(CSSPropertyTextDecoration, primitiveValue, tagName) |
223 // m_propertyID is used in HTMLElementEquivalent::addToStyle | 208 // m_propertyID is used in HTMLElementEquivalent::addToStyle |
224 { | 209 { |
225 } | 210 } |
226 | 211 |
227 bool HTMLTextDecorationEquivalent::propertyExistsInStyle(const StylePropertySet*
style) const | 212 bool HTMLTextDecorationEquivalent::propertyExistsInStyle(const StylePropertySet*
style) const |
228 { | 213 { |
229 return style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect) | 214 return style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect)
|| style->getPropertyCSSValue(CSSPropertyTextDecoration); |
230 || style->getPropertyCSSValue(textDecorationPropertyForEditing()); | |
231 } | 215 } |
232 | 216 |
233 bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(Element* element, Style
PropertySet* style) const | 217 bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(Element* element, Style
PropertySet* style) const |
234 { | 218 { |
235 RefPtr<CSSValue> styleValue = style->getPropertyCSSValue(CSSPropertyWebkitTe
xtDecorationsInEffect); | 219 RefPtr<CSSValue> styleValue = style->getPropertyCSSValue(CSSPropertyWebkitTe
xtDecorationsInEffect); |
236 if (!styleValue) | 220 if (!styleValue) |
237 styleValue = style->getPropertyCSSValue(textDecorationPropertyForEditing
()); | 221 styleValue = style->getPropertyCSSValue(CSSPropertyTextDecoration); |
238 return matches(element) && styleValue && styleValue->isValueList() && toCSSV
alueList(styleValue.get())->hasValue(m_primitiveValue.get()); | 222 return matches(element) && styleValue && styleValue->isValueList() && toCSSV
alueList(styleValue.get())->hasValue(m_primitiveValue.get()); |
239 } | 223 } |
240 | 224 |
241 class HTMLAttributeEquivalent : public HTMLElementEquivalent { | 225 class HTMLAttributeEquivalent : public HTMLElementEquivalent { |
242 public: | 226 public: |
243 static PassOwnPtr<HTMLAttributeEquivalent> create(CSSPropertyID propertyID,
const QualifiedName& tagName, const QualifiedName& attrName) | 227 static PassOwnPtr<HTMLAttributeEquivalent> create(CSSPropertyID propertyID,
const QualifiedName& tagName, const QualifiedName& attrName) |
244 { | 228 { |
245 return adoptPtr(new HTMLAttributeEquivalent(propertyID, tagName, attrNam
e)); | 229 return adoptPtr(new HTMLAttributeEquivalent(propertyID, tagName, attrNam
e)); |
246 } | 230 } |
247 static PassOwnPtr<HTMLAttributeEquivalent> create(CSSPropertyID propertyID,
const QualifiedName& attrName) | 231 static PassOwnPtr<HTMLAttributeEquivalent> create(CSSPropertyID propertyID,
const QualifiedName& attrName) |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 void EditingStyle::collapseTextDecorationProperties() | 639 void EditingStyle::collapseTextDecorationProperties() |
656 { | 640 { |
657 if (!m_mutableStyle) | 641 if (!m_mutableStyle) |
658 return; | 642 return; |
659 | 643 |
660 RefPtr<CSSValue> textDecorationsInEffect = m_mutableStyle->getPropertyCSSVal
ue(CSSPropertyWebkitTextDecorationsInEffect); | 644 RefPtr<CSSValue> textDecorationsInEffect = m_mutableStyle->getPropertyCSSVal
ue(CSSPropertyWebkitTextDecorationsInEffect); |
661 if (!textDecorationsInEffect) | 645 if (!textDecorationsInEffect) |
662 return; | 646 return; |
663 | 647 |
664 if (textDecorationsInEffect->isValueList()) | 648 if (textDecorationsInEffect->isValueList()) |
665 m_mutableStyle->setProperty(textDecorationPropertyForEditing(), textDeco
rationsInEffect->cssText(), m_mutableStyle->propertyIsImportant(textDecorationPr
opertyForEditing())); | 649 m_mutableStyle->setProperty(CSSPropertyTextDecoration, textDecorationsIn
Effect->cssText(), m_mutableStyle->propertyIsImportant(CSSPropertyTextDecoration
)); |
666 else | 650 else |
667 m_mutableStyle->removeProperty(textDecorationPropertyForEditing()); | 651 m_mutableStyle->removeProperty(CSSPropertyTextDecoration); |
668 m_mutableStyle->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); | 652 m_mutableStyle->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); |
669 } | 653 } |
670 | 654 |
671 // CSS properties that create a visual difference only when applied to text. | 655 // CSS properties that create a visual difference only when applied to text. |
672 static const CSSPropertyID textOnlyProperties[] = { | 656 static const CSSPropertyID textOnlyProperties[] = { |
673 // FIXME: CSSPropertyTextDecoration needs to be removed when CSS3 Text | |
674 // Decoration feature is no longer experimental. | |
675 CSSPropertyTextDecoration, | 657 CSSPropertyTextDecoration, |
676 CSSPropertyTextDecorationLine, | |
677 CSSPropertyWebkitTextDecorationsInEffect, | 658 CSSPropertyWebkitTextDecorationsInEffect, |
678 CSSPropertyFontStyle, | 659 CSSPropertyFontStyle, |
679 CSSPropertyFontWeight, | 660 CSSPropertyFontWeight, |
680 CSSPropertyColor, | 661 CSSPropertyColor, |
681 }; | 662 }; |
682 | 663 |
683 TriState EditingStyle::triStateOfStyle(EditingStyle* style) const | 664 TriState EditingStyle::triStateOfStyle(EditingStyle* style) const |
684 { | 665 { |
685 if (!style || !style->m_mutableStyle) | 666 if (!style || !style->m_mutableStyle) |
686 return FalseTriState; | 667 return FalseTriState; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 return false; | 724 return false; |
744 | 725 |
745 unsigned propertyCount = m_mutableStyle->propertyCount(); | 726 unsigned propertyCount = m_mutableStyle->propertyCount(); |
746 for (unsigned i = 0; i < propertyCount; ++i) { | 727 for (unsigned i = 0; i < propertyCount; ++i) { |
747 CSSPropertyID propertyID = m_mutableStyle->propertyAt(i).id(); | 728 CSSPropertyID propertyID = m_mutableStyle->propertyAt(i).id(); |
748 | 729 |
749 // We don't override whitespace property of a tab span because that woul
d collapse the tab into a space. | 730 // We don't override whitespace property of a tab span because that woul
d collapse the tab into a space. |
750 if (propertyID == CSSPropertyWhiteSpace && isTabSpanNode(element)) | 731 if (propertyID == CSSPropertyWhiteSpace && isTabSpanNode(element)) |
751 continue; | 732 continue; |
752 | 733 |
753 if (propertyID == CSSPropertyWebkitTextDecorationsInEffect && inlineStyl
e->getPropertyCSSValue(textDecorationPropertyForEditing())) { | 734 if (propertyID == CSSPropertyWebkitTextDecorationsInEffect && inlineStyl
e->getPropertyCSSValue(CSSPropertyTextDecoration)) { |
754 if (!conflictingProperties) | 735 if (!conflictingProperties) |
755 return true; | 736 return true; |
756 conflictingProperties->append(CSSPropertyTextDecoration); | 737 conflictingProperties->append(CSSPropertyTextDecoration); |
757 // Because text-decoration expands to text-decoration-line when CSS3 | |
758 // Text Decoration is enabled, we also state it as conflicting. | |
759 if (RuntimeEnabledFeatures::css3TextDecorationsEnabled()) | |
760 conflictingProperties->append(CSSPropertyTextDecorationLine); | |
761 if (extractedStyle) | 738 if (extractedStyle) |
762 extractedStyle->setProperty(textDecorationPropertyForEditing(),
inlineStyle->getPropertyValue(textDecorationPropertyForEditing()), inlineStyle->
propertyIsImportant(textDecorationPropertyForEditing())); | 739 extractedStyle->setProperty(CSSPropertyTextDecoration, inlineSty
le->getPropertyValue(CSSPropertyTextDecoration), inlineStyle->propertyIsImportan
t(CSSPropertyTextDecoration)); |
763 continue; | 740 continue; |
764 } | 741 } |
765 | 742 |
766 if (!inlineStyle->getPropertyCSSValue(propertyID)) | 743 if (!inlineStyle->getPropertyCSSValue(propertyID)) |
767 continue; | 744 continue; |
768 | 745 |
769 if (propertyID == CSSPropertyUnicodeBidi && inlineStyle->getPropertyCSSV
alue(CSSPropertyDirection)) { | 746 if (propertyID == CSSPropertyUnicodeBidi && inlineStyle->getPropertyCSSV
alue(CSSPropertyDirection)) { |
770 if (!conflictingProperties) | 747 if (!conflictingProperties) |
771 return true; | 748 return true; |
772 conflictingProperties->append(CSSPropertyDirection); | 749 conflictingProperties->append(CSSPropertyDirection); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 m_mutableStyle = style->mutableCopy(); | 1087 m_mutableStyle = style->mutableCopy(); |
1111 return; | 1088 return; |
1112 } | 1089 } |
1113 | 1090 |
1114 unsigned propertyCount = style->propertyCount(); | 1091 unsigned propertyCount = style->propertyCount(); |
1115 for (unsigned i = 0; i < propertyCount; ++i) { | 1092 for (unsigned i = 0; i < propertyCount; ++i) { |
1116 StylePropertySet::PropertyReference property = style->propertyAt(i); | 1093 StylePropertySet::PropertyReference property = style->propertyAt(i); |
1117 RefPtr<CSSValue> value = m_mutableStyle->getPropertyCSSValue(property.id
()); | 1094 RefPtr<CSSValue> value = m_mutableStyle->getPropertyCSSValue(property.id
()); |
1118 | 1095 |
1119 // text decorations never override values | 1096 // text decorations never override values |
1120 if ((property.id() == textDecorationPropertyForEditing() || property.id(
) == CSSPropertyWebkitTextDecorationsInEffect) && property.value()->isValueList(
) && value) { | 1097 if ((property.id() == CSSPropertyTextDecoration || property.id() == CSSP
ropertyWebkitTextDecorationsInEffect) && property.value()->isValueList() && valu
e) { |
1121 if (value->isValueList()) { | 1098 if (value->isValueList()) { |
1122 mergeTextDecorationValues(toCSSValueList(value.get()), toCSSValu
eList(property.value())); | 1099 mergeTextDecorationValues(toCSSValueList(value.get()), toCSSValu
eList(property.value())); |
1123 continue; | 1100 continue; |
1124 } | 1101 } |
1125 value = 0; // text-decoration: none is equivalent to not having the
property | 1102 value = 0; // text-decoration: none is equivalent to not having the
property |
1126 } | 1103 } |
1127 | 1104 |
1128 if (mode == OverrideValues || (mode == DoNotOverrideValues && !value)) | 1105 if (mode == OverrideValues || (mode == DoNotOverrideValues && !value)) |
1129 m_mutableStyle->setProperty(property.id(), property.value()->cssText
(), property.isImportant()); | 1106 m_mutableStyle->setProperty(property.id(), property.value()->cssText
(), property.isImportant()); |
1130 } | 1107 } |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1365 | 1342 |
1366 foundDirection = directionValue == CSSValueLtr ? LeftToRightWritingDirec
tion : RightToLeftWritingDirection; | 1343 foundDirection = directionValue == CSSValueLtr ? LeftToRightWritingDirec
tion : RightToLeftWritingDirection; |
1367 } | 1344 } |
1368 hasNestedOrMultipleEmbeddings = false; | 1345 hasNestedOrMultipleEmbeddings = false; |
1369 return foundDirection; | 1346 return foundDirection; |
1370 } | 1347 } |
1371 | 1348 |
1372 static void reconcileTextDecorationProperties(MutableStylePropertySet* style) | 1349 static void reconcileTextDecorationProperties(MutableStylePropertySet* style) |
1373 { | 1350 { |
1374 RefPtr<CSSValue> textDecorationsInEffect = style->getPropertyCSSValue(CSSPro
pertyWebkitTextDecorationsInEffect); | 1351 RefPtr<CSSValue> textDecorationsInEffect = style->getPropertyCSSValue(CSSPro
pertyWebkitTextDecorationsInEffect); |
1375 RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(textDecorationP
ropertyForEditing()); | 1352 RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(CSSPropertyText
Decoration); |
1376 // We shouldn't have both text-decoration and -webkit-text-decorations-in-ef
fect because that wouldn't make sense. | 1353 // We shouldn't have both text-decoration and -webkit-text-decorations-in-ef
fect because that wouldn't make sense. |
1377 ASSERT(!textDecorationsInEffect || !textDecoration); | 1354 ASSERT(!textDecorationsInEffect || !textDecoration); |
1378 if (textDecorationsInEffect) { | 1355 if (textDecorationsInEffect) { |
1379 style->setProperty(textDecorationPropertyForEditing(), textDecorationsIn
Effect->cssText()); | 1356 style->setProperty(CSSPropertyTextDecoration, textDecorationsInEffect->c
ssText()); |
1380 style->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); | 1357 style->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); |
1381 textDecoration = textDecorationsInEffect; | 1358 textDecoration = textDecorationsInEffect; |
1382 } | 1359 } |
1383 | 1360 |
1384 // If text-decoration is set to "none", remove the property because we don't
want to add redundant "text-decoration: none". | 1361 // If text-decoration is set to "none", remove the property because we don't
want to add redundant "text-decoration: none". |
1385 if (textDecoration && !textDecoration->isValueList()) | 1362 if (textDecoration && !textDecoration->isValueList()) |
1386 style->removeProperty(textDecorationPropertyForEditing()); | 1363 style->removeProperty(CSSPropertyTextDecoration); |
1387 } | 1364 } |
1388 | 1365 |
1389 StyleChange::StyleChange(EditingStyle* style, const Position& position) | 1366 StyleChange::StyleChange(EditingStyle* style, const Position& position) |
1390 : m_applyBold(false) | 1367 : m_applyBold(false) |
1391 , m_applyItalic(false) | 1368 , m_applyItalic(false) |
1392 , m_applyUnderline(false) | 1369 , m_applyUnderline(false) |
1393 , m_applyLineThrough(false) | 1370 , m_applyLineThrough(false) |
1394 , m_applySubscript(false) | 1371 , m_applySubscript(false) |
1395 , m_applySuperscript(false) | 1372 , m_applySuperscript(false) |
1396 { | 1373 { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1440 } | 1417 } |
1441 | 1418 |
1442 int fontStyle = getIdentifierValue(style, CSSPropertyFontStyle); | 1419 int fontStyle = getIdentifierValue(style, CSSPropertyFontStyle); |
1443 if (fontStyle == CSSValueItalic || fontStyle == CSSValueOblique) { | 1420 if (fontStyle == CSSValueItalic || fontStyle == CSSValueOblique) { |
1444 style->removeProperty(CSSPropertyFontStyle); | 1421 style->removeProperty(CSSPropertyFontStyle); |
1445 m_applyItalic = true; | 1422 m_applyItalic = true; |
1446 } | 1423 } |
1447 | 1424 |
1448 // Assuming reconcileTextDecorationProperties has been called, there should
not be -webkit-text-decorations-in-effect | 1425 // Assuming reconcileTextDecorationProperties has been called, there should
not be -webkit-text-decorations-in-effect |
1449 // Furthermore, text-decoration: none has been trimmed so that text-decorati
on property is always a CSSValueList. | 1426 // Furthermore, text-decoration: none has been trimmed so that text-decorati
on property is always a CSSValueList. |
1450 RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(textDecorationP
ropertyForEditing()); | 1427 RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(CSSPropertyText
Decoration); |
1451 if (textDecoration && textDecoration->isValueList()) { | 1428 if (textDecoration && textDecoration->isValueList()) { |
1452 DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, underline, (CSSPrimitiveV
alue::createIdentifier(CSSValueUnderline))); | 1429 DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, underline, (CSSPrimitiveV
alue::createIdentifier(CSSValueUnderline))); |
1453 DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, lineThrough, (CSSPrimitiv
eValue::createIdentifier(CSSValueLineThrough))); | 1430 DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, lineThrough, (CSSPrimitiv
eValue::createIdentifier(CSSValueLineThrough))); |
1454 | 1431 |
1455 RefPtr<CSSValueList> newTextDecoration = toCSSValueList(textDecoration.g
et())->copy(); | 1432 RefPtr<CSSValueList> newTextDecoration = toCSSValueList(textDecoration.g
et())->copy(); |
1456 if (newTextDecoration->removeAll(underline.get())) | 1433 if (newTextDecoration->removeAll(underline.get())) |
1457 m_applyUnderline = true; | 1434 m_applyUnderline = true; |
1458 if (newTextDecoration->removeAll(lineThrough.get())) | 1435 if (newTextDecoration->removeAll(lineThrough.get())) |
1459 m_applyLineThrough = true; | 1436 m_applyLineThrough = true; |
1460 | 1437 |
1461 // If trimTextDecorations, delete underline and line-through | 1438 // If trimTextDecorations, delete underline and line-through |
1462 setTextDecorationProperty(style, newTextDecoration.get(), textDecoration
PropertyForEditing()); | 1439 setTextDecorationProperty(style, newTextDecoration.get(), CSSPropertyTex
tDecoration); |
1463 } | 1440 } |
1464 | 1441 |
1465 int verticalAlign = getIdentifierValue(style, CSSPropertyVerticalAlign); | 1442 int verticalAlign = getIdentifierValue(style, CSSPropertyVerticalAlign); |
1466 switch (verticalAlign) { | 1443 switch (verticalAlign) { |
1467 case CSSValueSub: | 1444 case CSSValueSub: |
1468 style->removeProperty(CSSPropertyVerticalAlign); | 1445 style->removeProperty(CSSPropertyVerticalAlign); |
1469 m_applySubscript = true; | 1446 m_applySubscript = true; |
1470 break; | 1447 break; |
1471 case CSSValueSuper: | 1448 case CSSValueSuper: |
1472 style->removeProperty(CSSPropertyVerticalAlign); | 1449 style->removeProperty(CSSPropertyVerticalAlign); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1557 | 1534 |
1558 PassRefPtr<MutableStylePropertySet> getPropertiesNotIn(StylePropertySet* styleWi
thRedundantProperties, CSSStyleDeclaration* baseStyle) | 1535 PassRefPtr<MutableStylePropertySet> getPropertiesNotIn(StylePropertySet* styleWi
thRedundantProperties, CSSStyleDeclaration* baseStyle) |
1559 { | 1536 { |
1560 ASSERT(styleWithRedundantProperties); | 1537 ASSERT(styleWithRedundantProperties); |
1561 ASSERT(baseStyle); | 1538 ASSERT(baseStyle); |
1562 RefPtr<MutableStylePropertySet> result = styleWithRedundantProperties->mutab
leCopy(); | 1539 RefPtr<MutableStylePropertySet> result = styleWithRedundantProperties->mutab
leCopy(); |
1563 | 1540 |
1564 result->removeEquivalentProperties(baseStyle); | 1541 result->removeEquivalentProperties(baseStyle); |
1565 | 1542 |
1566 RefPtr<CSSValue> baseTextDecorationsInEffect = baseStyle->getPropertyCSSValu
eInternal(CSSPropertyWebkitTextDecorationsInEffect); | 1543 RefPtr<CSSValue> baseTextDecorationsInEffect = baseStyle->getPropertyCSSValu
eInternal(CSSPropertyWebkitTextDecorationsInEffect); |
1567 diffTextDecorations(result.get(), textDecorationPropertyForEditing(), baseTe
xtDecorationsInEffect.get()); | 1544 diffTextDecorations(result.get(), CSSPropertyTextDecoration, baseTextDecorat
ionsInEffect.get()); |
1568 diffTextDecorations(result.get(), CSSPropertyWebkitTextDecorationsInEffect,
baseTextDecorationsInEffect.get()); | 1545 diffTextDecorations(result.get(), CSSPropertyWebkitTextDecorationsInEffect,
baseTextDecorationsInEffect.get()); |
1569 | 1546 |
1570 if (baseStyle->getPropertyCSSValueInternal(CSSPropertyFontWeight) && fontWei
ghtIsBold(result.get()) == fontWeightIsBold(baseStyle)) | 1547 if (baseStyle->getPropertyCSSValueInternal(CSSPropertyFontWeight) && fontWei
ghtIsBold(result.get()) == fontWeightIsBold(baseStyle)) |
1571 result->removeProperty(CSSPropertyFontWeight); | 1548 result->removeProperty(CSSPropertyFontWeight); |
1572 | 1549 |
1573 if (baseStyle->getPropertyCSSValueInternal(CSSPropertyColor) && getRGBAFontC
olor(result.get()) == getRGBAFontColor(baseStyle)) | 1550 if (baseStyle->getPropertyCSSValueInternal(CSSPropertyColor) && getRGBAFontC
olor(result.get()) == getRGBAFontColor(baseStyle)) |
1574 result->removeProperty(CSSPropertyColor); | 1551 result->removeProperty(CSSPropertyColor); |
1575 | 1552 |
1576 if (baseStyle->getPropertyCSSValueInternal(CSSPropertyTextAlign) | 1553 if (baseStyle->getPropertyCSSValueInternal(CSSPropertyTextAlign) |
1577 && textAlignResolvingStartAndEnd(result.get()) == textAlignResolvingStar
tAndEnd(baseStyle)) | 1554 && textAlignResolvingStartAndEnd(result.get()) == textAlignResolvingStar
tAndEnd(baseStyle)) |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1655 { | 1632 { |
1656 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1633 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
1657 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); | 1634 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); |
1658 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1635 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
1659 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1636 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
1660 } | 1637 } |
1661 return 0; | 1638 return 0; |
1662 } | 1639 } |
1663 | 1640 |
1664 } | 1641 } |
OLD | NEW |