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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 properties.remove(index); | 115 properties.remove(index); |
116 continue; | 116 continue; |
117 } | 117 } |
118 ++index; | 118 ++index; |
119 } | 119 } |
120 } | 120 } |
121 return properties; | 121 return properties; |
122 } | 122 } |
123 | 123 |
124 template <class StyleDeclarationType> | 124 template <class StyleDeclarationType> |
125 static PassRefPtr<MutableStylePropertySet> copyEditingProperties(StyleDeclaratio
nType* style, EditingPropertiesType type = OnlyInheritableEditingProperties) | 125 static PassRefPtrWillBeRawPtr<MutableStylePropertySet> copyEditingProperties(Sty
leDeclarationType* style, EditingPropertiesType type = OnlyInheritableEditingPro
perties) |
126 { | 126 { |
127 if (type == AllEditingProperties) | 127 if (type == AllEditingProperties) |
128 return style->copyPropertiesInSet(allEditingProperties()); | 128 return style->copyPropertiesInSet(allEditingProperties()); |
129 return style->copyPropertiesInSet(inheritableEditingProperties()); | 129 return style->copyPropertiesInSet(inheritableEditingProperties()); |
130 } | 130 } |
131 | 131 |
132 static inline bool isEditingProperty(int id) | 132 static inline bool isEditingProperty(int id) |
133 { | 133 { |
134 return allEditingProperties().contains(static_cast<CSSPropertyID>(id)); | 134 return allEditingProperties().contains(static_cast<CSSPropertyID>(id)); |
135 } | 135 } |
136 | 136 |
137 static PassRefPtr<MutableStylePropertySet> editingStyleFromComputedStyle(PassRef
Ptr<CSSComputedStyleDeclaration> style, EditingPropertiesType type = OnlyInherit
ableEditingProperties) | 137 static PassRefPtrWillBeRawPtr<MutableStylePropertySet> editingStyleFromComputedS
tyle(PassRefPtr<CSSComputedStyleDeclaration> style, EditingPropertiesType type =
OnlyInheritableEditingProperties) |
138 { | 138 { |
139 if (!style) | 139 if (!style) |
140 return MutableStylePropertySet::create(); | 140 return MutableStylePropertySet::create(); |
141 return copyEditingProperties(style.get(), type); | 141 return copyEditingProperties(style.get(), type); |
142 } | 142 } |
143 | 143 |
144 static PassRefPtr<MutableStylePropertySet> getPropertiesNotIn(StylePropertySet*
styleWithRedundantProperties, CSSStyleDeclaration* baseStyle); | 144 static PassRefPtrWillBeRawPtr<MutableStylePropertySet> getPropertiesNotIn(StyleP
ropertySet* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle); |
145 enum LegacyFontSizeMode { AlwaysUseLegacyFontSize, UseLegacyFontSizeOnlyIfPixelV
aluesMatch }; | 145 enum LegacyFontSizeMode { AlwaysUseLegacyFontSize, UseLegacyFontSizeOnlyIfPixelV
aluesMatch }; |
146 static int legacyFontSizeFromCSSValue(Document*, CSSPrimitiveValue*, bool should
UseFixedFontDefaultSize, LegacyFontSizeMode); | 146 static int legacyFontSizeFromCSSValue(Document*, CSSPrimitiveValue*, bool should
UseFixedFontDefaultSize, LegacyFontSizeMode); |
147 static bool isTransparentColorValue(CSSValue*); | 147 static bool isTransparentColorValue(CSSValue*); |
148 static bool hasTransparentBackgroundColor(CSSStyleDeclaration*); | 148 static bool hasTransparentBackgroundColor(CSSStyleDeclaration*); |
149 static bool hasTransparentBackgroundColor(StylePropertySet*); | 149 static bool hasTransparentBackgroundColor(StylePropertySet*); |
150 static PassRefPtrWillBeRawPtr<CSSValue> backgroundColorInEffect(Node*); | 150 static PassRefPtrWillBeRawPtr<CSSValue> backgroundColorInEffect(Node*); |
151 | 151 |
152 class HTMLElementEquivalent { | 152 class HTMLElementEquivalent { |
153 WTF_MAKE_FAST_ALLOCATED; | 153 WTF_MAKE_FAST_ALLOCATED; |
154 public: | 154 public: |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 style->setProperty(m_propertyID, value->cssText()); | 287 style->setProperty(m_propertyID, value->cssText()); |
288 } | 288 } |
289 | 289 |
290 PassRefPtrWillBeRawPtr<CSSValue> HTMLAttributeEquivalent::attributeValueAsCSSVal
ue(Element* element) const | 290 PassRefPtrWillBeRawPtr<CSSValue> HTMLAttributeEquivalent::attributeValueAsCSSVal
ue(Element* element) const |
291 { | 291 { |
292 ASSERT(element); | 292 ASSERT(element); |
293 const AtomicString& value = element->getAttribute(m_attrName); | 293 const AtomicString& value = element->getAttribute(m_attrName); |
294 if (value.isNull()) | 294 if (value.isNull()) |
295 return nullptr; | 295 return nullptr; |
296 | 296 |
297 RefPtr<MutableStylePropertySet> dummyStyle; | 297 RefPtrWillBeRawPtr<MutableStylePropertySet> dummyStyle; |
298 dummyStyle = MutableStylePropertySet::create(); | 298 dummyStyle = MutableStylePropertySet::create(); |
299 dummyStyle->setProperty(m_propertyID, value); | 299 dummyStyle->setProperty(m_propertyID, value); |
300 return dummyStyle->getPropertyCSSValue(m_propertyID); | 300 return dummyStyle->getPropertyCSSValue(m_propertyID); |
301 } | 301 } |
302 | 302 |
303 class HTMLFontSizeEquivalent FINAL : public HTMLAttributeEquivalent { | 303 class HTMLFontSizeEquivalent FINAL : public HTMLAttributeEquivalent { |
304 public: | 304 public: |
305 static PassOwnPtr<HTMLFontSizeEquivalent> create() | 305 static PassOwnPtr<HTMLFontSizeEquivalent> create() |
306 { | 306 { |
307 return adoptPtr(new HTMLFontSizeEquivalent()); | 307 return adoptPtr(new HTMLFontSizeEquivalent()); |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 if (!m_mutableStyle) | 609 if (!m_mutableStyle) |
610 return; | 610 return; |
611 | 611 |
612 m_mutableStyle->removeBlockProperties(); | 612 m_mutableStyle->removeBlockProperties(); |
613 } | 613 } |
614 | 614 |
615 void EditingStyle::removeStyleAddedByNode(Node* node) | 615 void EditingStyle::removeStyleAddedByNode(Node* node) |
616 { | 616 { |
617 if (!node || !node->parentNode()) | 617 if (!node || !node->parentNode()) |
618 return; | 618 return; |
619 RefPtr<MutableStylePropertySet> parentStyle = editingStyleFromComputedStyle(
CSSComputedStyleDeclaration::create(node->parentNode()), AllEditingProperties); | 619 RefPtrWillBeRawPtr<MutableStylePropertySet> parentStyle = editingStyleFromCo
mputedStyle(CSSComputedStyleDeclaration::create(node->parentNode()), AllEditingP
roperties); |
620 RefPtr<MutableStylePropertySet> nodeStyle = editingStyleFromComputedStyle(CS
SComputedStyleDeclaration::create(node), AllEditingProperties); | 620 RefPtrWillBeRawPtr<MutableStylePropertySet> nodeStyle = editingStyleFromComp
utedStyle(CSSComputedStyleDeclaration::create(node), AllEditingProperties); |
621 nodeStyle->removeEquivalentProperties(parentStyle.get()); | 621 nodeStyle->removeEquivalentProperties(parentStyle.get()); |
622 m_mutableStyle->removeEquivalentProperties(nodeStyle.get()); | 622 m_mutableStyle->removeEquivalentProperties(nodeStyle.get()); |
623 } | 623 } |
624 | 624 |
625 void EditingStyle::removeStyleConflictingWithStyleOfNode(Node* node) | 625 void EditingStyle::removeStyleConflictingWithStyleOfNode(Node* node) |
626 { | 626 { |
627 if (!node || !node->parentNode() || !m_mutableStyle) | 627 if (!node || !node->parentNode() || !m_mutableStyle) |
628 return; | 628 return; |
629 | 629 |
630 RefPtr<MutableStylePropertySet> parentStyle = editingStyleFromComputedStyle(
CSSComputedStyleDeclaration::create(node->parentNode()), AllEditingProperties); | 630 RefPtrWillBeRawPtr<MutableStylePropertySet> parentStyle = editingStyleFromCo
mputedStyle(CSSComputedStyleDeclaration::create(node->parentNode()), AllEditingP
roperties); |
631 RefPtr<MutableStylePropertySet> nodeStyle = editingStyleFromComputedStyle(CS
SComputedStyleDeclaration::create(node), AllEditingProperties); | 631 RefPtrWillBeRawPtr<MutableStylePropertySet> nodeStyle = editingStyleFromComp
utedStyle(CSSComputedStyleDeclaration::create(node), AllEditingProperties); |
632 nodeStyle->removeEquivalentProperties(parentStyle.get()); | 632 nodeStyle->removeEquivalentProperties(parentStyle.get()); |
633 | 633 |
634 unsigned propertyCount = nodeStyle->propertyCount(); | 634 unsigned propertyCount = nodeStyle->propertyCount(); |
635 for (unsigned i = 0; i < propertyCount; ++i) | 635 for (unsigned i = 0; i < propertyCount; ++i) |
636 m_mutableStyle->removeProperty(nodeStyle->propertyAt(i).id()); | 636 m_mutableStyle->removeProperty(nodeStyle->propertyAt(i).id()); |
637 } | 637 } |
638 | 638 |
639 void EditingStyle::collapseTextDecorationProperties() | 639 void EditingStyle::collapseTextDecorationProperties() |
640 { | 640 { |
641 if (!m_mutableStyle) | 641 if (!m_mutableStyle) |
(...skipping 24 matching lines...) Expand all Loading... |
666 | 666 |
667 TriState EditingStyle::triStateOfStyle(EditingStyle* style) const | 667 TriState EditingStyle::triStateOfStyle(EditingStyle* style) const |
668 { | 668 { |
669 if (!style || !style->m_mutableStyle) | 669 if (!style || !style->m_mutableStyle) |
670 return FalseTriState; | 670 return FalseTriState; |
671 return triStateOfStyle(style->m_mutableStyle->ensureCSSStyleDeclaration(), D
oNotIgnoreTextOnlyProperties); | 671 return triStateOfStyle(style->m_mutableStyle->ensureCSSStyleDeclaration(), D
oNotIgnoreTextOnlyProperties); |
672 } | 672 } |
673 | 673 |
674 TriState EditingStyle::triStateOfStyle(CSSStyleDeclaration* styleToCompare, Shou
ldIgnoreTextOnlyProperties shouldIgnoreTextOnlyProperties) const | 674 TriState EditingStyle::triStateOfStyle(CSSStyleDeclaration* styleToCompare, Shou
ldIgnoreTextOnlyProperties shouldIgnoreTextOnlyProperties) const |
675 { | 675 { |
676 RefPtr<MutableStylePropertySet> difference = getPropertiesNotIn(m_mutableSty
le.get(), styleToCompare); | 676 RefPtrWillBeRawPtr<MutableStylePropertySet> difference = getPropertiesNotIn(
m_mutableStyle.get(), styleToCompare); |
677 | 677 |
678 if (shouldIgnoreTextOnlyProperties == IgnoreTextOnlyProperties) | 678 if (shouldIgnoreTextOnlyProperties == IgnoreTextOnlyProperties) |
679 difference->removePropertiesInSet(textOnlyProperties, WTF_ARRAY_LENGTH(t
extOnlyProperties)); | 679 difference->removePropertiesInSet(textOnlyProperties, WTF_ARRAY_LENGTH(t
extOnlyProperties)); |
680 | 680 |
681 if (difference->isEmpty()) | 681 if (difference->isEmpty()) |
682 return TrueTriState; | 682 return TrueTriState; |
683 if (difference->propertyCount() == m_mutableStyle->propertyCount()) | 683 if (difference->propertyCount() == m_mutableStyle->propertyCount()) |
684 return FalseTriState; | 684 return FalseTriState; |
685 | 685 |
686 return MixedTriState; | 686 return MixedTriState; |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 } | 995 } |
996 } | 996 } |
997 | 997 |
998 static inline bool elementMatchesAndPropertyIsNotInInlineStyleDecl(const HTMLEle
mentEquivalent* equivalent, const Element* element, | 998 static inline bool elementMatchesAndPropertyIsNotInInlineStyleDecl(const HTMLEle
mentEquivalent* equivalent, const Element* element, |
999 EditingStyle::CSSPropertyOverrideMode mode, StylePropertySet* style) | 999 EditingStyle::CSSPropertyOverrideMode mode, StylePropertySet* style) |
1000 { | 1000 { |
1001 return equivalent->matches(element) && (!element->inlineStyle() || !equivale
nt->propertyExistsInStyle(element->inlineStyle())) | 1001 return equivalent->matches(element) && (!element->inlineStyle() || !equivale
nt->propertyExistsInStyle(element->inlineStyle())) |
1002 && (mode == EditingStyle::OverrideValues || !equivalent->propertyExistsI
nStyle(style)); | 1002 && (mode == EditingStyle::OverrideValues || !equivalent->propertyExistsI
nStyle(style)); |
1003 } | 1003 } |
1004 | 1004 |
1005 static PassRefPtr<MutableStylePropertySet> extractEditingProperties(const StyleP
ropertySet* style, EditingStyle::PropertiesToInclude propertiesToInclude) | 1005 static PassRefPtrWillBeRawPtr<MutableStylePropertySet> extractEditingProperties(
const StylePropertySet* style, EditingStyle::PropertiesToInclude propertiesToInc
lude) |
1006 { | 1006 { |
1007 if (!style) | 1007 if (!style) |
1008 return nullptr; | 1008 return nullptr; |
1009 | 1009 |
1010 switch (propertiesToInclude) { | 1010 switch (propertiesToInclude) { |
1011 case EditingStyle::AllProperties: | 1011 case EditingStyle::AllProperties: |
1012 case EditingStyle::EditingPropertiesInEffect: | 1012 case EditingStyle::EditingPropertiesInEffect: |
1013 return copyEditingProperties(style, AllEditingProperties); | 1013 return copyEditingProperties(style, AllEditingProperties); |
1014 case EditingStyle::OnlyEditingInheritableProperties: | 1014 case EditingStyle::OnlyEditingInheritableProperties: |
1015 return copyEditingProperties(style, OnlyInheritableEditingProperties); | 1015 return copyEditingProperties(style, OnlyInheritableEditingProperties); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 continue; | 1108 continue; |
1109 } | 1109 } |
1110 value = nullptr; // text-decoration: none is equivalent to not havin
g the property | 1110 value = nullptr; // text-decoration: none is equivalent to not havin
g the property |
1111 } | 1111 } |
1112 | 1112 |
1113 if (mode == OverrideValues || (mode == DoNotOverrideValues && !value)) | 1113 if (mode == OverrideValues || (mode == DoNotOverrideValues && !value)) |
1114 m_mutableStyle->setProperty(property.id(), property.value()->cssText
(), property.isImportant()); | 1114 m_mutableStyle->setProperty(property.id(), property.value()->cssText
(), property.isImportant()); |
1115 } | 1115 } |
1116 } | 1116 } |
1117 | 1117 |
1118 static PassRefPtr<MutableStylePropertySet> styleFromMatchedRulesForElement(Eleme
nt* element, unsigned rulesToInclude) | 1118 static PassRefPtrWillBeRawPtr<MutableStylePropertySet> styleFromMatchedRulesForE
lement(Element* element, unsigned rulesToInclude) |
1119 { | 1119 { |
1120 RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create(); | 1120 RefPtrWillBeRawPtr<MutableStylePropertySet> style = MutableStylePropertySet:
:create(); |
1121 RefPtr<StyleRuleList> matchedRules = element->document().ensureStyleResolver
().styleRulesForElement(element, rulesToInclude); | 1121 RefPtr<StyleRuleList> matchedRules = element->document().ensureStyleResolver
().styleRulesForElement(element, rulesToInclude); |
1122 if (matchedRules) { | 1122 if (matchedRules) { |
1123 for (unsigned i = 0; i < matchedRules->m_list.size(); ++i) | 1123 for (unsigned i = 0; i < matchedRules->m_list.size(); ++i) |
1124 style->mergeAndOverrideOnConflict(&matchedRules->m_list[i]->properti
es()); | 1124 style->mergeAndOverrideOnConflict(&matchedRules->m_list[i]->properti
es()); |
1125 } | 1125 } |
1126 return style.release(); | 1126 return style.release(); |
1127 } | 1127 } |
1128 | 1128 |
1129 void EditingStyle::mergeStyleFromRules(Element* element) | 1129 void EditingStyle::mergeStyleFromRules(Element* element) |
1130 { | 1130 { |
1131 RefPtr<MutableStylePropertySet> styleFromMatchedRules = styleFromMatchedRule
sForElement(element, | 1131 RefPtrWillBeRawPtr<MutableStylePropertySet> styleFromMatchedRules = styleFro
mMatchedRulesForElement(element, |
1132 StyleResolver::AuthorCSSRules | StyleResolver::CrossOriginCSSRules); | 1132 StyleResolver::AuthorCSSRules | StyleResolver::CrossOriginCSSRules); |
1133 // Styles from the inline style declaration, held in the variable "style", t
ake precedence | 1133 // Styles from the inline style declaration, held in the variable "style", t
ake precedence |
1134 // over those from matched rules. | 1134 // over those from matched rules. |
1135 if (m_mutableStyle) | 1135 if (m_mutableStyle) |
1136 styleFromMatchedRules->mergeAndOverrideOnConflict(m_mutableStyle.get()); | 1136 styleFromMatchedRules->mergeAndOverrideOnConflict(m_mutableStyle.get()); |
1137 | 1137 |
1138 clear(); | 1138 clear(); |
1139 m_mutableStyle = styleFromMatchedRules; | 1139 m_mutableStyle = styleFromMatchedRules; |
1140 } | 1140 } |
1141 | 1141 |
1142 void EditingStyle::mergeStyleFromRulesForSerialization(Element* element) | 1142 void EditingStyle::mergeStyleFromRulesForSerialization(Element* element) |
1143 { | 1143 { |
1144 mergeStyleFromRules(element); | 1144 mergeStyleFromRules(element); |
1145 | 1145 |
1146 // The property value, if it's a percentage, may not reflect the actual comp
uted value. | 1146 // The property value, if it's a percentage, may not reflect the actual comp
uted value. |
1147 // For example: style="height: 1%; overflow: visible;" in quirksmode | 1147 // For example: style="height: 1%; overflow: visible;" in quirksmode |
1148 // FIXME: There are others like this, see <rdar://problem/5195123> Slashdot
copy/paste fidelity problem | 1148 // FIXME: There are others like this, see <rdar://problem/5195123> Slashdot
copy/paste fidelity problem |
1149 RefPtr<CSSComputedStyleDeclaration> computedStyleForElement = CSSComputedSty
leDeclaration::create(element); | 1149 RefPtr<CSSComputedStyleDeclaration> computedStyleForElement = CSSComputedSty
leDeclaration::create(element); |
1150 RefPtr<MutableStylePropertySet> fromComputedStyle = MutableStylePropertySet:
:create(); | 1150 RefPtrWillBeRawPtr<MutableStylePropertySet> fromComputedStyle = MutableStyle
PropertySet::create(); |
1151 { | 1151 { |
1152 unsigned propertyCount = m_mutableStyle->propertyCount(); | 1152 unsigned propertyCount = m_mutableStyle->propertyCount(); |
1153 for (unsigned i = 0; i < propertyCount; ++i) { | 1153 for (unsigned i = 0; i < propertyCount; ++i) { |
1154 StylePropertySet::PropertyReference property = m_mutableStyle->prope
rtyAt(i); | 1154 StylePropertySet::PropertyReference property = m_mutableStyle->prope
rtyAt(i); |
1155 CSSValue* value = property.value(); | 1155 CSSValue* value = property.value(); |
1156 if (!value->isPrimitiveValue()) | 1156 if (!value->isPrimitiveValue()) |
1157 continue; | 1157 continue; |
1158 if (toCSSPrimitiveValue(value)->isPercentage()) { | 1158 if (toCSSPrimitiveValue(value)->isPercentage()) { |
1159 if (RefPtrWillBeRawPtr<CSSValue> computedPropertyValue = compute
dStyleForElement->getPropertyCSSValue(property.id())) | 1159 if (RefPtrWillBeRawPtr<CSSValue> computedPropertyValue = compute
dStyleForElement->getPropertyCSSValue(property.id())) |
1160 fromComputedStyle->addParsedProperty(CSSProperty(property.id
(), computedPropertyValue)); | 1160 fromComputedStyle->addParsedProperty(CSSProperty(property.id
(), computedPropertyValue)); |
(...skipping 13 matching lines...) Expand all Loading... |
1174 styleToRemovePropertiesFrom->removePropertiesInSet(propertiesToRemove.data()
, propertiesToRemove.size()); | 1174 styleToRemovePropertiesFrom->removePropertiesInSet(propertiesToRemove.data()
, propertiesToRemove.size()); |
1175 } | 1175 } |
1176 | 1176 |
1177 void EditingStyle::removeStyleFromRulesAndContext(Element* element, Node* contex
t) | 1177 void EditingStyle::removeStyleFromRulesAndContext(Element* element, Node* contex
t) |
1178 { | 1178 { |
1179 ASSERT(element); | 1179 ASSERT(element); |
1180 if (!m_mutableStyle) | 1180 if (!m_mutableStyle) |
1181 return; | 1181 return; |
1182 | 1182 |
1183 // 1. Remove style from matched rules because style remain without repeating
it in inline style declaration | 1183 // 1. Remove style from matched rules because style remain without repeating
it in inline style declaration |
1184 RefPtr<MutableStylePropertySet> styleFromMatchedRules = styleFromMatchedRule
sForElement(element, StyleResolver::AllButEmptyCSSRules); | 1184 RefPtrWillBeRawPtr<MutableStylePropertySet> styleFromMatchedRules = styleFro
mMatchedRulesForElement(element, StyleResolver::AllButEmptyCSSRules); |
1185 if (styleFromMatchedRules && !styleFromMatchedRules->isEmpty()) | 1185 if (styleFromMatchedRules && !styleFromMatchedRules->isEmpty()) |
1186 m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), styleFromMatch
edRules->ensureCSSStyleDeclaration()); | 1186 m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), styleFromMatch
edRules->ensureCSSStyleDeclaration()); |
1187 | 1187 |
1188 // 2. Remove style present in context and not overriden by matched rules. | 1188 // 2. Remove style present in context and not overriden by matched rules. |
1189 RefPtr<EditingStyle> computedStyle = EditingStyle::create(context, EditingPr
opertiesInEffect); | 1189 RefPtr<EditingStyle> computedStyle = EditingStyle::create(context, EditingPr
opertiesInEffect); |
1190 if (computedStyle->m_mutableStyle) { | 1190 if (computedStyle->m_mutableStyle) { |
1191 if (!computedStyle->m_mutableStyle->getPropertyCSSValue(CSSPropertyBackg
roundColor)) | 1191 if (!computedStyle->m_mutableStyle->getPropertyCSSValue(CSSPropertyBackg
roundColor)) |
1192 computedStyle->m_mutableStyle->setProperty(CSSPropertyBackgroundColo
r, CSSValueTransparent); | 1192 computedStyle->m_mutableStyle->setProperty(CSSPropertyBackgroundColo
r, CSSValueTransparent); |
1193 | 1193 |
1194 removePropertiesInStyle(computedStyle->m_mutableStyle.get(), styleFromMa
tchedRules.get()); | 1194 removePropertiesInStyle(computedStyle->m_mutableStyle.get(), styleFromMa
tchedRules.get()); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1376 , m_applyLineThrough(false) | 1376 , m_applyLineThrough(false) |
1377 , m_applySubscript(false) | 1377 , m_applySubscript(false) |
1378 , m_applySuperscript(false) | 1378 , m_applySuperscript(false) |
1379 { | 1379 { |
1380 Document* document = position.document(); | 1380 Document* document = position.document(); |
1381 if (!style || !style->style() || !document || !document->frame()) | 1381 if (!style || !style->style() || !document || !document->frame()) |
1382 return; | 1382 return; |
1383 | 1383 |
1384 RefPtr<CSSComputedStyleDeclaration> computedStyle = position.computedStyle()
; | 1384 RefPtr<CSSComputedStyleDeclaration> computedStyle = position.computedStyle()
; |
1385 // FIXME: take care of background-color in effect | 1385 // FIXME: take care of background-color in effect |
1386 RefPtr<MutableStylePropertySet> mutableStyle = getPropertiesNotIn(style->sty
le(), computedStyle.get()); | 1386 RefPtrWillBeRawPtr<MutableStylePropertySet> mutableStyle = getPropertiesNotI
n(style->style(), computedStyle.get()); |
1387 | 1387 |
1388 reconcileTextDecorationProperties(mutableStyle.get()); | 1388 reconcileTextDecorationProperties(mutableStyle.get()); |
1389 if (!document->frame()->editor().shouldStyleWithCSS()) | 1389 if (!document->frame()->editor().shouldStyleWithCSS()) |
1390 extractTextStyles(document, mutableStyle.get(), computedStyle->useFixedF
ontDefaultSize()); | 1390 extractTextStyles(document, mutableStyle.get(), computedStyle->useFixedF
ontDefaultSize()); |
1391 | 1391 |
1392 // Changing the whitespace style in a tab span would collapse the tab into a
space. | 1392 // Changing the whitespace style in a tab span would collapse the tab into a
space. |
1393 if (isTabSpanTextNode(position.deprecatedNode()) || isTabSpanNode((position.
deprecatedNode()))) | 1393 if (isTabSpanTextNode(position.deprecatedNode()) || isTabSpanNode((position.
deprecatedNode()))) |
1394 mutableStyle->removeProperty(CSSPropertyWhiteSpace); | 1394 mutableStyle->removeProperty(CSSPropertyWhiteSpace); |
1395 | 1395 |
1396 // If unicode-bidi is present in mutableStyle and direction is not, then add
direction to mutableStyle. | 1396 // If unicode-bidi is present in mutableStyle and direction is not, then add
direction to mutableStyle. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 | 1523 |
1524 static bool fontWeightNeedsResolving(CSSValue* fontWeight) | 1524 static bool fontWeightNeedsResolving(CSSValue* fontWeight) |
1525 { | 1525 { |
1526 if (!fontWeight->isPrimitiveValue()) | 1526 if (!fontWeight->isPrimitiveValue()) |
1527 return true; | 1527 return true; |
1528 | 1528 |
1529 CSSValueID value = toCSSPrimitiveValue(fontWeight)->getValueID(); | 1529 CSSValueID value = toCSSPrimitiveValue(fontWeight)->getValueID(); |
1530 return value == CSSValueLighter || value == CSSValueBolder; | 1530 return value == CSSValueLighter || value == CSSValueBolder; |
1531 } | 1531 } |
1532 | 1532 |
1533 PassRefPtr<MutableStylePropertySet> getPropertiesNotIn(StylePropertySet* styleWi
thRedundantProperties, CSSStyleDeclaration* baseStyle) | 1533 PassRefPtrWillBeRawPtr<MutableStylePropertySet> getPropertiesNotIn(StyleProperty
Set* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle) |
1534 { | 1534 { |
1535 ASSERT(styleWithRedundantProperties); | 1535 ASSERT(styleWithRedundantProperties); |
1536 ASSERT(baseStyle); | 1536 ASSERT(baseStyle); |
1537 RefPtr<MutableStylePropertySet> result = styleWithRedundantProperties->mutab
leCopy(); | 1537 RefPtrWillBeRawPtr<MutableStylePropertySet> result = styleWithRedundantPrope
rties->mutableCopy(); |
1538 | 1538 |
1539 result->removeEquivalentProperties(baseStyle); | 1539 result->removeEquivalentProperties(baseStyle); |
1540 | 1540 |
1541 RefPtrWillBeRawPtr<CSSValue> baseTextDecorationsInEffect = baseStyle->getPro
pertyCSSValueInternal(CSSPropertyWebkitTextDecorationsInEffect); | 1541 RefPtrWillBeRawPtr<CSSValue> baseTextDecorationsInEffect = baseStyle->getPro
pertyCSSValueInternal(CSSPropertyWebkitTextDecorationsInEffect); |
1542 diffTextDecorations(result.get(), textDecorationPropertyForEditing(), baseTe
xtDecorationsInEffect.get()); | 1542 diffTextDecorations(result.get(), textDecorationPropertyForEditing(), baseTe
xtDecorationsInEffect.get()); |
1543 diffTextDecorations(result.get(), CSSPropertyWebkitTextDecorationsInEffect,
baseTextDecorationsInEffect.get()); | 1543 diffTextDecorations(result.get(), CSSPropertyWebkitTextDecorationsInEffect,
baseTextDecorationsInEffect.get()); |
1544 | 1544 |
1545 if (RefPtrWillBeRawPtr<CSSValue> baseFontWeight = baseStyle->getPropertyCSSV
alueInternal(CSSPropertyFontWeight)) { | 1545 if (RefPtrWillBeRawPtr<CSSValue> baseFontWeight = baseStyle->getPropertyCSSV
alueInternal(CSSPropertyFontWeight)) { |
1546 if (RefPtrWillBeRawPtr<CSSValue> fontWeight = result->getPropertyCSSValu
e(CSSPropertyFontWeight)) { | 1546 if (RefPtrWillBeRawPtr<CSSValue> fontWeight = result->getPropertyCSSValu
e(CSSPropertyFontWeight)) { |
1547 if (!fontWeightNeedsResolving(fontWeight.get()) && (fontWeightIsBold
(fontWeight.get()) == fontWeightIsBold(baseFontWeight.get()))) | 1547 if (!fontWeightNeedsResolving(fontWeight.get()) && (fontWeightIsBold
(fontWeight.get()) == fontWeightIsBold(baseFontWeight.get()))) |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 { | 1634 { |
1635 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1635 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
1636 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); | 1636 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); |
1637 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1637 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
1638 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1638 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
1639 } | 1639 } |
1640 return nullptr; | 1640 return nullptr; |
1641 } | 1641 } |
1642 | 1642 |
1643 } | 1643 } |
OLD | NEW |