Index: Source/core/css/ElementRuleCollector.cpp |
diff --git a/Source/core/css/ElementRuleCollector.cpp b/Source/core/css/ElementRuleCollector.cpp |
index e421fbb7e5f520afda79d359612f3b52af914737..13152a76ffac50eae60b4558fc1d5e838a6db140 100644 |
--- a/Source/core/css/ElementRuleCollector.cpp |
+++ b/Source/core/css/ElementRuleCollector.cpp |
@@ -299,8 +299,11 @@ void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, Select |
if (m_mode == SelectorChecker::CollectingCSSRules || m_mode == SelectorChecker::CollectingStyleRules) |
return; |
// FIXME: Matching should not modify the style directly. |
- if (m_style && dynamicPseudo < FIRST_INTERNAL_PSEUDOID) |
- m_style->setHasPseudoStyle(dynamicPseudo); |
+ if (!m_style || dynamicPseudo >= FIRST_INTERNAL_PSEUDOID) |
+ return; |
+ if ((dynamicPseudo == BEFORE || dynamicPseudo == AFTER) && !ruleData.rule()->properties().hasProperty(CSSPropertyContent)) |
+ return; |
+ m_style->setHasPseudoStyle(dynamicPseudo); |
} else { |
// Update our first/last rule indices in the matched rules array. |
++ruleRange.lastRuleIndex; |