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