| 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 either allEditingProperties() or inheritableEditingProperties() to | 67 // NOTE: Use either allEditingProperties() or inheritableEditingProperties() to |
| 62 // respect runtime enabling of properties. | 68 // respect runtime enabling of properties. |
| 63 static const CSSPropertyID staticEditingProperties[] = { | 69 static const CSSPropertyID staticEditingProperties[] = { |
| 64 CSSPropertyBackgroundColor, | 70 CSSPropertyBackgroundColor, |
| 65 CSSPropertyColor, | 71 CSSPropertyColor, |
| 66 CSSPropertyFontFamily, | 72 CSSPropertyFontFamily, |
| 67 CSSPropertyFontSize, | 73 CSSPropertyFontSize, |
| 68 CSSPropertyFontStyle, | 74 CSSPropertyFontStyle, |
| 69 CSSPropertyFontVariant, | 75 CSSPropertyFontVariant, |
| 70 CSSPropertyFontWeight, | 76 CSSPropertyFontWeight, |
| 71 CSSPropertyLetterSpacing, | 77 CSSPropertyLetterSpacing, |
| 72 CSSPropertyLineHeight, | 78 CSSPropertyLineHeight, |
| 73 CSSPropertyOrphans, | 79 CSSPropertyOrphans, |
| 74 CSSPropertyTextAlign, | 80 CSSPropertyTextAlign, |
| 81 // FIXME: CSSPropertyTextDecoration needs to be removed when CSS3 Text |
| 82 // Decoration feature is no longer experimental. |
| 75 CSSPropertyTextDecoration, | 83 CSSPropertyTextDecoration, |
| 84 CSSPropertyTextDecorationLine, |
| 76 CSSPropertyTextIndent, | 85 CSSPropertyTextIndent, |
| 77 CSSPropertyTextTransform, | 86 CSSPropertyTextTransform, |
| 78 CSSPropertyWhiteSpace, | 87 CSSPropertyWhiteSpace, |
| 79 CSSPropertyWidows, | 88 CSSPropertyWidows, |
| 80 CSSPropertyWordSpacing, | 89 CSSPropertyWordSpacing, |
| 81 CSSPropertyWebkitTextDecorationsInEffect, | 90 CSSPropertyWebkitTextDecorationsInEffect, |
| 82 CSSPropertyWebkitTextFillColor, | 91 CSSPropertyWebkitTextFillColor, |
| 83 CSSPropertyWebkitTextStrokeColor, | 92 CSSPropertyWebkitTextStrokeColor, |
| 84 CSSPropertyWebkitTextStrokeWidth, | 93 CSSPropertyWebkitTextStrokeWidth, |
| 85 }; | 94 }; |
| 86 | 95 |
| 87 enum EditingPropertiesType { OnlyInheritableEditingProperties, AllEditingPropert
ies }; | 96 enum EditingPropertiesType { OnlyInheritableEditingProperties, AllEditingPropert
ies }; |
| 88 | 97 |
| 89 static const Vector<CSSPropertyID>& allEditingProperties() | 98 static const Vector<CSSPropertyID>& allEditingProperties() |
| 90 { | 99 { |
| 91 DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ()); | 100 DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ()); |
| 92 if (properties.isEmpty()) | 101 if (properties.isEmpty()) { |
| 93 RuntimeCSSEnabled::filterEnabledCSSPropertiesIntoVector(staticEditingPro
perties, WTF_ARRAY_LENGTH(staticEditingProperties), properties); | 102 RuntimeCSSEnabled::filterEnabledCSSPropertiesIntoVector(staticEditingPro
perties, WTF_ARRAY_LENGTH(staticEditingProperties), properties); |
| 103 if (RuntimeEnabledFeatures::css3TextDecorationsEnabled()) |
| 104 properties.remove(properties.find(CSSPropertyTextDecoration)); |
| 105 } |
| 94 return properties; | 106 return properties; |
| 95 } | 107 } |
| 96 | 108 |
| 97 static const Vector<CSSPropertyID>& inheritableEditingProperties() | 109 static const Vector<CSSPropertyID>& inheritableEditingProperties() |
| 98 { | 110 { |
| 99 DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ()); | 111 DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ()); |
| 100 if (properties.isEmpty()) { | 112 if (properties.isEmpty()) { |
| 101 RuntimeCSSEnabled::filterEnabledCSSPropertiesIntoVector(staticEditingPro
perties, WTF_ARRAY_LENGTH(staticEditingProperties), properties); | 113 RuntimeCSSEnabled::filterEnabledCSSPropertiesIntoVector(staticEditingPro
perties, WTF_ARRAY_LENGTH(staticEditingProperties), properties); |
| 102 for (size_t index = 0; index < properties.size();) { | 114 for (size_t index = 0; index < properties.size();) { |
| 103 if (!CSSProperty::isInheritedProperty(properties[index])) { | 115 if (!CSSProperty::isInheritedProperty(properties[index])) { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 return adoptPtr(new HTMLTextDecorationEquivalent(primitiveValue, tagName
)); | 212 return adoptPtr(new HTMLTextDecorationEquivalent(primitiveValue, tagName
)); |
| 201 } | 213 } |
| 202 virtual bool propertyExistsInStyle(const StylePropertySet*) const; | 214 virtual bool propertyExistsInStyle(const StylePropertySet*) const; |
| 203 virtual bool valueIsPresentInStyle(Element*, StylePropertySet*) const; | 215 virtual bool valueIsPresentInStyle(Element*, StylePropertySet*) const; |
| 204 | 216 |
| 205 private: | 217 private: |
| 206 HTMLTextDecorationEquivalent(CSSValueID primitiveValue, const QualifiedName&
tagName); | 218 HTMLTextDecorationEquivalent(CSSValueID primitiveValue, const QualifiedName&
tagName); |
| 207 }; | 219 }; |
| 208 | 220 |
| 209 HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent(CSSValueID primitiveV
alue, const QualifiedName& tagName) | 221 HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent(CSSValueID primitiveV
alue, const QualifiedName& tagName) |
| 210 : HTMLElementEquivalent(CSSPropertyTextDecoration, primitiveValue, tagName) | 222 : HTMLElementEquivalent(textDecorationPropertyForEditing(), primitiveValue,
tagName) |
| 211 // m_propertyID is used in HTMLElementEquivalent::addToStyle | 223 // m_propertyID is used in HTMLElementEquivalent::addToStyle |
| 212 { | 224 { |
| 213 } | 225 } |
| 214 | 226 |
| 215 bool HTMLTextDecorationEquivalent::propertyExistsInStyle(const StylePropertySet*
style) const | 227 bool HTMLTextDecorationEquivalent::propertyExistsInStyle(const StylePropertySet*
style) const |
| 216 { | 228 { |
| 217 return style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect)
|| style->getPropertyCSSValue(CSSPropertyTextDecoration); | 229 return style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect) |
| 230 || style->getPropertyCSSValue(textDecorationPropertyForEditing()); |
| 218 } | 231 } |
| 219 | 232 |
| 220 bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(Element* element, Style
PropertySet* style) const | 233 bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(Element* element, Style
PropertySet* style) const |
| 221 { | 234 { |
| 222 RefPtr<CSSValue> styleValue = style->getPropertyCSSValue(CSSPropertyWebkitTe
xtDecorationsInEffect); | 235 RefPtr<CSSValue> styleValue = style->getPropertyCSSValue(CSSPropertyWebkitTe
xtDecorationsInEffect); |
| 223 if (!styleValue) | 236 if (!styleValue) |
| 224 styleValue = style->getPropertyCSSValue(CSSPropertyTextDecoration); | 237 styleValue = style->getPropertyCSSValue(textDecorationPropertyForEditing
()); |
| 225 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()); |
| 226 } | 239 } |
| 227 | 240 |
| 228 class HTMLAttributeEquivalent : public HTMLElementEquivalent { | 241 class HTMLAttributeEquivalent : public HTMLElementEquivalent { |
| 229 public: | 242 public: |
| 230 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) |
| 231 { | 244 { |
| 232 return adoptPtr(new HTMLAttributeEquivalent(propertyID, tagName, attrNam
e)); | 245 return adoptPtr(new HTMLAttributeEquivalent(propertyID, tagName, attrNam
e)); |
| 233 } | 246 } |
| 234 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... |
| 642 void EditingStyle::collapseTextDecorationProperties() | 655 void EditingStyle::collapseTextDecorationProperties() |
| 643 { | 656 { |
| 644 if (!m_mutableStyle) | 657 if (!m_mutableStyle) |
| 645 return; | 658 return; |
| 646 | 659 |
| 647 RefPtr<CSSValue> textDecorationsInEffect = m_mutableStyle->getPropertyCSSVal
ue(CSSPropertyWebkitTextDecorationsInEffect); | 660 RefPtr<CSSValue> textDecorationsInEffect = m_mutableStyle->getPropertyCSSVal
ue(CSSPropertyWebkitTextDecorationsInEffect); |
| 648 if (!textDecorationsInEffect) | 661 if (!textDecorationsInEffect) |
| 649 return; | 662 return; |
| 650 | 663 |
| 651 if (textDecorationsInEffect->isValueList()) | 664 if (textDecorationsInEffect->isValueList()) |
| 652 m_mutableStyle->setProperty(CSSPropertyTextDecoration, textDecorationsIn
Effect->cssText(), m_mutableStyle->propertyIsImportant(CSSPropertyTextDecoration
)); | 665 m_mutableStyle->setProperty(textDecorationPropertyForEditing(), textDeco
rationsInEffect->cssText(), m_mutableStyle->propertyIsImportant(textDecorationPr
opertyForEditing())); |
| 653 else | 666 else |
| 654 m_mutableStyle->removeProperty(CSSPropertyTextDecoration); | 667 m_mutableStyle->removeProperty(textDecorationPropertyForEditing()); |
| 655 m_mutableStyle->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); | 668 m_mutableStyle->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); |
| 656 } | 669 } |
| 657 | 670 |
| 658 // 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. |
| 659 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. |
| 660 CSSPropertyTextDecoration, | 675 CSSPropertyTextDecoration, |
| 676 CSSPropertyTextDecorationLine, |
| 661 CSSPropertyWebkitTextDecorationsInEffect, | 677 CSSPropertyWebkitTextDecorationsInEffect, |
| 662 CSSPropertyFontStyle, | 678 CSSPropertyFontStyle, |
| 663 CSSPropertyFontWeight, | 679 CSSPropertyFontWeight, |
| 664 CSSPropertyColor, | 680 CSSPropertyColor, |
| 665 }; | 681 }; |
| 666 | 682 |
| 667 TriState EditingStyle::triStateOfStyle(EditingStyle* style) const | 683 TriState EditingStyle::triStateOfStyle(EditingStyle* style) const |
| 668 { | 684 { |
| 669 if (!style || !style->m_mutableStyle) | 685 if (!style || !style->m_mutableStyle) |
| 670 return FalseTriState; | 686 return FalseTriState; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 return false; | 743 return false; |
| 728 | 744 |
| 729 unsigned propertyCount = m_mutableStyle->propertyCount(); | 745 unsigned propertyCount = m_mutableStyle->propertyCount(); |
| 730 for (unsigned i = 0; i < propertyCount; ++i) { | 746 for (unsigned i = 0; i < propertyCount; ++i) { |
| 731 CSSPropertyID propertyID = m_mutableStyle->propertyAt(i).id(); | 747 CSSPropertyID propertyID = m_mutableStyle->propertyAt(i).id(); |
| 732 | 748 |
| 733 // 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. |
| 734 if (propertyID == CSSPropertyWhiteSpace && isTabSpanNode(element)) | 750 if (propertyID == CSSPropertyWhiteSpace && isTabSpanNode(element)) |
| 735 continue; | 751 continue; |
| 736 | 752 |
| 737 if (propertyID == CSSPropertyWebkitTextDecorationsInEffect && inlineStyl
e->getPropertyCSSValue(CSSPropertyTextDecoration)) { | 753 if (propertyID == CSSPropertyWebkitTextDecorationsInEffect && inlineStyl
e->getPropertyCSSValue(textDecorationPropertyForEditing())) { |
| 738 if (!conflictingProperties) | 754 if (!conflictingProperties) |
| 739 return true; | 755 return true; |
| 740 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); |
| 741 if (extractedStyle) | 761 if (extractedStyle) |
| 742 extractedStyle->setProperty(CSSPropertyTextDecoration, inlineSty
le->getPropertyValue(CSSPropertyTextDecoration), inlineStyle->propertyIsImportan
t(CSSPropertyTextDecoration)); | 762 extractedStyle->setProperty(textDecorationPropertyForEditing(),
inlineStyle->getPropertyValue(textDecorationPropertyForEditing()), inlineStyle->
propertyIsImportant(textDecorationPropertyForEditing())); |
| 743 continue; | 763 continue; |
| 744 } | 764 } |
| 745 | 765 |
| 746 if (!inlineStyle->getPropertyCSSValue(propertyID)) | 766 if (!inlineStyle->getPropertyCSSValue(propertyID)) |
| 747 continue; | 767 continue; |
| 748 | 768 |
| 749 if (propertyID == CSSPropertyUnicodeBidi && inlineStyle->getPropertyCSSV
alue(CSSPropertyDirection)) { | 769 if (propertyID == CSSPropertyUnicodeBidi && inlineStyle->getPropertyCSSV
alue(CSSPropertyDirection)) { |
| 750 if (!conflictingProperties) | 770 if (!conflictingProperties) |
| 751 return true; | 771 return true; |
| 752 conflictingProperties->append(CSSPropertyDirection); | 772 conflictingProperties->append(CSSPropertyDirection); |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 m_mutableStyle = style->mutableCopy(); | 1110 m_mutableStyle = style->mutableCopy(); |
| 1091 return; | 1111 return; |
| 1092 } | 1112 } |
| 1093 | 1113 |
| 1094 unsigned propertyCount = style->propertyCount(); | 1114 unsigned propertyCount = style->propertyCount(); |
| 1095 for (unsigned i = 0; i < propertyCount; ++i) { | 1115 for (unsigned i = 0; i < propertyCount; ++i) { |
| 1096 StylePropertySet::PropertyReference property = style->propertyAt(i); | 1116 StylePropertySet::PropertyReference property = style->propertyAt(i); |
| 1097 RefPtr<CSSValue> value = m_mutableStyle->getPropertyCSSValue(property.id
()); | 1117 RefPtr<CSSValue> value = m_mutableStyle->getPropertyCSSValue(property.id
()); |
| 1098 | 1118 |
| 1099 // text decorations never override values | 1119 // text decorations never override values |
| 1100 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) { |
| 1101 if (value->isValueList()) { | 1121 if (value->isValueList()) { |
| 1102 mergeTextDecorationValues(toCSSValueList(value.get()), toCSSValu
eList(property.value())); | 1122 mergeTextDecorationValues(toCSSValueList(value.get()), toCSSValu
eList(property.value())); |
| 1103 continue; | 1123 continue; |
| 1104 } | 1124 } |
| 1105 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 |
| 1106 } | 1126 } |
| 1107 | 1127 |
| 1108 if (mode == OverrideValues || (mode == DoNotOverrideValues && !value)) | 1128 if (mode == OverrideValues || (mode == DoNotOverrideValues && !value)) |
| 1109 m_mutableStyle->setProperty(property.id(), property.value()->cssText
(), property.isImportant()); | 1129 m_mutableStyle->setProperty(property.id(), property.value()->cssText
(), property.isImportant()); |
| 1110 } | 1130 } |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1345 | 1365 |
| 1346 foundDirection = directionValue == CSSValueLtr ? LeftToRightWritingDirec
tion : RightToLeftWritingDirection; | 1366 foundDirection = directionValue == CSSValueLtr ? LeftToRightWritingDirec
tion : RightToLeftWritingDirection; |
| 1347 } | 1367 } |
| 1348 hasNestedOrMultipleEmbeddings = false; | 1368 hasNestedOrMultipleEmbeddings = false; |
| 1349 return foundDirection; | 1369 return foundDirection; |
| 1350 } | 1370 } |
| 1351 | 1371 |
| 1352 static void reconcileTextDecorationProperties(MutableStylePropertySet* style) | 1372 static void reconcileTextDecorationProperties(MutableStylePropertySet* style) |
| 1353 { | 1373 { |
| 1354 RefPtr<CSSValue> textDecorationsInEffect = style->getPropertyCSSValue(CSSPro
pertyWebkitTextDecorationsInEffect); | 1374 RefPtr<CSSValue> textDecorationsInEffect = style->getPropertyCSSValue(CSSPro
pertyWebkitTextDecorationsInEffect); |
| 1355 RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(CSSPropertyText
Decoration); | 1375 RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(textDecorationP
ropertyForEditing()); |
| 1356 // 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. |
| 1357 ASSERT(!textDecorationsInEffect || !textDecoration); | 1377 ASSERT(!textDecorationsInEffect || !textDecoration); |
| 1358 if (textDecorationsInEffect) { | 1378 if (textDecorationsInEffect) { |
| 1359 style->setProperty(CSSPropertyTextDecoration, textDecorationsInEffect->c
ssText()); | 1379 style->setProperty(textDecorationPropertyForEditing(), textDecorationsIn
Effect->cssText()); |
| 1360 style->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); | 1380 style->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); |
| 1361 textDecoration = textDecorationsInEffect; | 1381 textDecoration = textDecorationsInEffect; |
| 1362 } | 1382 } |
| 1363 | 1383 |
| 1364 // 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". |
| 1365 if (textDecoration && !textDecoration->isValueList()) | 1385 if (textDecoration && !textDecoration->isValueList()) |
| 1366 style->removeProperty(CSSPropertyTextDecoration); | 1386 style->removeProperty(textDecorationPropertyForEditing()); |
| 1367 } | 1387 } |
| 1368 | 1388 |
| 1369 StyleChange::StyleChange(EditingStyle* style, const Position& position) | 1389 StyleChange::StyleChange(EditingStyle* style, const Position& position) |
| 1370 : m_applyBold(false) | 1390 : m_applyBold(false) |
| 1371 , m_applyItalic(false) | 1391 , m_applyItalic(false) |
| 1372 , m_applyUnderline(false) | 1392 , m_applyUnderline(false) |
| 1373 , m_applyLineThrough(false) | 1393 , m_applyLineThrough(false) |
| 1374 , m_applySubscript(false) | 1394 , m_applySubscript(false) |
| 1375 , m_applySuperscript(false) | 1395 , m_applySuperscript(false) |
| 1376 { | 1396 { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1420 } | 1440 } |
| 1421 | 1441 |
| 1422 int fontStyle = getIdentifierValue(style, CSSPropertyFontStyle); | 1442 int fontStyle = getIdentifierValue(style, CSSPropertyFontStyle); |
| 1423 if (fontStyle == CSSValueItalic || fontStyle == CSSValueOblique) { | 1443 if (fontStyle == CSSValueItalic || fontStyle == CSSValueOblique) { |
| 1424 style->removeProperty(CSSPropertyFontStyle); | 1444 style->removeProperty(CSSPropertyFontStyle); |
| 1425 m_applyItalic = true; | 1445 m_applyItalic = true; |
| 1426 } | 1446 } |
| 1427 | 1447 |
| 1428 // 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 |
| 1429 // 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. |
| 1430 RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(CSSPropertyText
Decoration); | 1450 RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(textDecorationP
ropertyForEditing()); |
| 1431 if (textDecoration && textDecoration->isValueList()) { | 1451 if (textDecoration && textDecoration->isValueList()) { |
| 1432 DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, underline, (CSSPrimitiveV
alue::createIdentifier(CSSValueUnderline))); | 1452 DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, underline, (CSSPrimitiveV
alue::createIdentifier(CSSValueUnderline))); |
| 1433 DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, lineThrough, (CSSPrimitiv
eValue::createIdentifier(CSSValueLineThrough))); | 1453 DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, lineThrough, (CSSPrimitiv
eValue::createIdentifier(CSSValueLineThrough))); |
| 1434 | 1454 |
| 1435 RefPtr<CSSValueList> newTextDecoration = toCSSValueList(textDecoration.g
et())->copy(); | 1455 RefPtr<CSSValueList> newTextDecoration = toCSSValueList(textDecoration.g
et())->copy(); |
| 1436 if (newTextDecoration->removeAll(underline.get())) | 1456 if (newTextDecoration->removeAll(underline.get())) |
| 1437 m_applyUnderline = true; | 1457 m_applyUnderline = true; |
| 1438 if (newTextDecoration->removeAll(lineThrough.get())) | 1458 if (newTextDecoration->removeAll(lineThrough.get())) |
| 1439 m_applyLineThrough = true; | 1459 m_applyLineThrough = true; |
| 1440 | 1460 |
| 1441 // If trimTextDecorations, delete underline and line-through | 1461 // If trimTextDecorations, delete underline and line-through |
| 1442 setTextDecorationProperty(style, newTextDecoration.get(), CSSPropertyTex
tDecoration); | 1462 setTextDecorationProperty(style, newTextDecoration.get(), textDecoration
PropertyForEditing()); |
| 1443 } | 1463 } |
| 1444 | 1464 |
| 1445 int verticalAlign = getIdentifierValue(style, CSSPropertyVerticalAlign); | 1465 int verticalAlign = getIdentifierValue(style, CSSPropertyVerticalAlign); |
| 1446 switch (verticalAlign) { | 1466 switch (verticalAlign) { |
| 1447 case CSSValueSub: | 1467 case CSSValueSub: |
| 1448 style->removeProperty(CSSPropertyVerticalAlign); | 1468 style->removeProperty(CSSPropertyVerticalAlign); |
| 1449 m_applySubscript = true; | 1469 m_applySubscript = true; |
| 1450 break; | 1470 break; |
| 1451 case CSSValueSuper: | 1471 case CSSValueSuper: |
| 1452 style->removeProperty(CSSPropertyVerticalAlign); | 1472 style->removeProperty(CSSPropertyVerticalAlign); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1530 | 1550 |
| 1531 PassRefPtr<MutableStylePropertySet> getPropertiesNotIn(StylePropertySet* styleWi
thRedundantProperties, CSSStyleDeclaration* baseStyle) | 1551 PassRefPtr<MutableStylePropertySet> getPropertiesNotIn(StylePropertySet* styleWi
thRedundantProperties, CSSStyleDeclaration* baseStyle) |
| 1532 { | 1552 { |
| 1533 ASSERT(styleWithRedundantProperties); | 1553 ASSERT(styleWithRedundantProperties); |
| 1534 ASSERT(baseStyle); | 1554 ASSERT(baseStyle); |
| 1535 RefPtr<MutableStylePropertySet> result = styleWithRedundantProperties->mutab
leCopy(); | 1555 RefPtr<MutableStylePropertySet> result = styleWithRedundantProperties->mutab
leCopy(); |
| 1536 | 1556 |
| 1537 result->removeEquivalentProperties(baseStyle); | 1557 result->removeEquivalentProperties(baseStyle); |
| 1538 | 1558 |
| 1539 RefPtr<CSSValue> baseTextDecorationsInEffect = baseStyle->getPropertyCSSValu
eInternal(CSSPropertyWebkitTextDecorationsInEffect); | 1559 RefPtr<CSSValue> baseTextDecorationsInEffect = baseStyle->getPropertyCSSValu
eInternal(CSSPropertyWebkitTextDecorationsInEffect); |
| 1540 diffTextDecorations(result.get(), CSSPropertyTextDecoration, baseTextDecorat
ionsInEffect.get()); | 1560 diffTextDecorations(result.get(), textDecorationPropertyForEditing(), baseTe
xtDecorationsInEffect.get()); |
| 1541 diffTextDecorations(result.get(), CSSPropertyWebkitTextDecorationsInEffect,
baseTextDecorationsInEffect.get()); | 1561 diffTextDecorations(result.get(), CSSPropertyWebkitTextDecorationsInEffect,
baseTextDecorationsInEffect.get()); |
| 1542 | 1562 |
| 1543 if (RefPtr<CSSValue> baseFontWeight = baseStyle->getPropertyCSSValueInternal
(CSSPropertyFontWeight)) { | 1563 if (RefPtr<CSSValue> baseFontWeight = baseStyle->getPropertyCSSValueInternal
(CSSPropertyFontWeight)) { |
| 1544 if (RefPtr<CSSValue> fontWeight = result->getPropertyCSSValue(CSSPropert
yFontWeight)) { | 1564 if (RefPtr<CSSValue> fontWeight = result->getPropertyCSSValue(CSSPropert
yFontWeight)) { |
| 1545 if (!fontWeightNeedsResolving(fontWeight.get()) && (fontWeightIsBold
(fontWeight.get()) == fontWeightIsBold(baseFontWeight.get()))) | 1565 if (!fontWeightNeedsResolving(fontWeight.get()) && (fontWeightIsBold
(fontWeight.get()) == fontWeightIsBold(baseFontWeight.get()))) |
| 1546 result->removeProperty(CSSPropertyFontWeight); | 1566 result->removeProperty(CSSPropertyFontWeight); |
| 1547 } | 1567 } |
| 1548 } | 1568 } |
| 1549 | 1569 |
| 1550 if (baseStyle->getPropertyCSSValueInternal(CSSPropertyColor) && getRGBAFontC
olor(result.get()) == getRGBAFontColor(baseStyle)) | 1570 if (baseStyle->getPropertyCSSValueInternal(CSSPropertyColor) && getRGBAFontC
olor(result.get()) == getRGBAFontColor(baseStyle)) |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1632 { | 1652 { |
| 1633 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1653 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
| 1634 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); | 1654 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); |
| 1635 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1655 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
| 1636 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1656 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
| 1637 } | 1657 } |
| 1638 return 0; | 1658 return 0; |
| 1639 } | 1659 } |
| 1640 | 1660 |
| 1641 } | 1661 } |
| OLD | NEW |