Chromium Code Reviews| Index: Source/core/css/StylePropertySet.cpp |
| diff --git a/Source/core/css/StylePropertySet.cpp b/Source/core/css/StylePropertySet.cpp |
| index 310c2a543c87b6d3dad8f560b3fe8410f56ad5d3..2b70616ac4e0246e6aff6539e43c58cd1b65ff6b 100644 |
| --- a/Source/core/css/StylePropertySet.cpp |
| +++ b/Source/core/css/StylePropertySet.cpp |
| @@ -269,6 +269,16 @@ void MutableStylePropertySet::setProperty(CSSPropertyID propertyID, PassRefPtrWi |
| m_propertyVector.append(CSSProperty(shorthand.properties()[i], value, important)); |
| } |
| +unsigned getIndexInShorthandVector(const CSSProperty& property) |
| +{ |
| + if (!property.isSetFromShorthand()) |
| + return 0; |
| + |
| + Vector<StylePropertyShorthand, 4> shorthands; |
| + getMatchingShorthandsForLonghand(property.id(), &shorthands); |
| + return indexOfShorthandForLonghand(property.id(), shorthands); |
| +} |
| + |
| bool MutableStylePropertySet::setProperty(const CSSProperty& property, CSSProperty* slot) |
| { |
| if (!removeShorthandProperty(property.id())) { |
| @@ -276,7 +286,12 @@ bool MutableStylePropertySet::setProperty(const CSSProperty& property, CSSProper |
| if (toReplace && *toReplace == property) |
| return false; |
| if (toReplace) { |
| - *toReplace = property; |
| + // Clear the important flag if the new property is not important |
| + if (!property.isImportant() && toReplace->isImportant()) { |
| + *toReplace = CSSProperty(property.id(), property.value(), false, property.isSetFromShorthand(), getIndexInShorthandVector(property), property.metadata().m_implicit); |
|
Timothy Loh
2015/04/23 05:42:03
Isn't this just the same as the other branch?
sashab
2015/04/23 05:59:05
Oh, nice. Good point :D
|
| + } else { |
| + *toReplace = property; |
| + } |
| return true; |
| } |
| } |
| @@ -314,10 +329,7 @@ bool MutableStylePropertySet::addParsedProperties(const WillBeHeapVector<CSSProp |
| bool MutableStylePropertySet::addParsedProperty(const CSSProperty& property) |
| { |
| - // Only add properties that have no !important counterpart present |
| - if (!propertyIsImportant(property.id()) || property.isImportant()) |
| - return setProperty(property); |
| - return false; |
| + return setProperty(property); |
| } |
| String StylePropertySet::asText() const |