Commit c3937b7c authored by rune's avatar rune Committed by Commit bot

::before/::after are not features for invalidation.

We store a flag for finding ::before or ::after in
InvalidationSetFeatures, yet they are not added as features to
invalidation sets. That means we need to handle *::before as a universal
selector and cause subtree invalidations.

R=ericwilligers@chromium.org
BUG=581675

Review URL: https://codereview.chromium.org/1639133003

Cr-Commit-Position: refs/heads/master@{#372035}
parent 718abf54
<!DOCTYPE html>
<p>You should see the word PASS below.</p>
PASS
<!DOCTYPE html>
<style>
.a + span::before { content: "PA" }
.b + ::before { content: "SS" }
</style>
<p>You should see the word PASS below.</p>
<span id="t1"></span><span></span><span id="t2"></span><span></span>
<script>
document.body.offsetTop;
t1.className = "a";
t2.className = "b";
</script>
...@@ -280,21 +280,29 @@ ALWAYS_INLINE InvalidationSet& RuleFeatureSet::ensurePseudoInvalidationSet(CSSSe ...@@ -280,21 +280,29 @@ ALWAYS_INLINE InvalidationSet& RuleFeatureSet::ensurePseudoInvalidationSet(CSSSe
bool RuleFeatureSet::extractInvalidationSetFeature(const CSSSelector& selector, InvalidationSetFeatures& features) bool RuleFeatureSet::extractInvalidationSetFeature(const CSSSelector& selector, InvalidationSetFeatures& features)
{ {
if (selector.match() == CSSSelector::Tag && selector.tagQName().localName() != starAtom) if (selector.match() == CSSSelector::Tag && selector.tagQName().localName() != starAtom) {
features.tagName = selector.tagQName().localName(); features.tagName = selector.tagQName().localName();
else if (selector.match() == CSSSelector::Id) return true;
}
if (selector.match() == CSSSelector::Id) {
features.id = selector.value(); features.id = selector.value();
else if (selector.match() == CSSSelector::Class) return true;
}
if (selector.match() == CSSSelector::Class) {
features.classes.append(selector.value()); features.classes.append(selector.value());
else if (selector.isAttributeSelector()) return true;
}
if (selector.isAttributeSelector()) {
features.attributes.append(selector.attribute().localName()); features.attributes.append(selector.attribute().localName());
else if (selector.pseudoType() == CSSSelector::PseudoWebKitCustomElement) return true;
}
if (selector.pseudoType() == CSSSelector::PseudoWebKitCustomElement) {
features.customPseudoElement = true; features.customPseudoElement = true;
else if (selector.pseudoType() == CSSSelector::PseudoBefore || selector.pseudoType() == CSSSelector::PseudoAfter) return true;
}
if (selector.pseudoType() == CSSSelector::PseudoBefore || selector.pseudoType() == CSSSelector::PseudoAfter)
features.hasBeforeOrAfter = true; features.hasBeforeOrAfter = true;
else return false;
return false;
return true;
} }
InvalidationSet* RuleFeatureSet::invalidationSetForSelector(const CSSSelector& selector, InvalidationType type) InvalidationSet* RuleFeatureSet::invalidationSetForSelector(const CSSSelector& selector, InvalidationType type)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment