Chromium Code Reviews| Index: Source/core/css/RuleFeature.cpp |
| diff --git a/Source/core/css/RuleFeature.cpp b/Source/core/css/RuleFeature.cpp |
| index 6867a79efa45b493905d8b8eb4201b38b3456d54..c7da88e148d484e4371fc2ae4b9973c40229ff84 100644 |
| --- a/Source/core/css/RuleFeature.cpp |
| +++ b/Source/core/css/RuleFeature.cpp |
| @@ -32,7 +32,9 @@ |
| #include "core/HTMLNames.h" |
| #include "core/css/CSSSelector.h" |
| #include "core/css/CSSSelectorList.h" |
| +#include "core/css/CSSValueList.h" |
| #include "core/css/RuleSet.h" |
| +#include "core/css/StylePropertySet.h" |
| #include "core/css/StyleRule.h" |
| #include "core/css/invalidation/DescendantInvalidationSet.h" |
| #include "core/dom/Element.h" |
| @@ -286,6 +288,32 @@ void RuleFeatureSet::updateInvalidationSets(const CSSSelector& selector) |
| } |
| } |
| +void RuleFeatureSet::updateInvalidationSetsForContentAttribute(StyleRule* styleRule) |
| +{ |
| + const StylePropertySet& propertySet = styleRule->properties(); |
| + |
| + int propertyIndex = propertySet.findPropertyIndex(CSSPropertyContent); |
| + |
| + if (propertyIndex == -1) |
| + return; |
| + |
| + StylePropertySet::PropertyReference contentProperty = propertySet.propertyAt(propertyIndex); |
| + CSSValue* contentValue = contentProperty.value(); |
| + |
| + if (!contentValue->isValueList()) |
| + return; |
| + |
| + for (CSSValueListIterator i = contentValue; i.hasMore(); i.advance()) { |
| + CSSValue* item = i.value(); |
| + if (!item->isPrimitiveValue()) |
| + continue; |
| + CSSPrimitiveValue* primitiveItem = toCSSPrimitiveValue(item); |
| + if (!primitiveItem->isAttr()) |
| + continue; |
| + ensureAttributeInvalidationSet(AtomicString(primitiveItem->getStringValue())); |
| + } |
| +} |
| + |
| std::pair<const CSSSelector*, RuleFeatureSet::UseFeaturesType> |
| RuleFeatureSet::extractInvalidationSetFeatures(const CSSSelector& selector, InvalidationSetFeatures& features, bool negated) |
| { |
| @@ -392,14 +420,10 @@ void RuleFeatureSet::addFeaturesToInvalidationSets(const CSSSelector& selector, |
| } |
| } |
| -void RuleFeatureSet::addContentAttr(const AtomicString& attributeName) |
| -{ |
| - ensureAttributeInvalidationSet(attributeName); |
| -} |
| - |
| void RuleFeatureSet::collectFeaturesFromRuleData(const RuleData& ruleData) |
| { |
| updateInvalidationSets(ruleData.selector()); |
| + updateInvalidationSetsForContentAttribute(ruleData.rule()); |
|
rune
2014/12/10 13:03:55
There's one RuleData per selector in the selector
|
| FeatureMetadata metadata; |
| collectFeaturesFromSelector(ruleData.selector(), metadata); |