Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Unified Diff: Source/core/css/ElementRuleCollector.cpp

Issue 570713002: Avoid calculating style for ::before/::after without content. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/css-generated-content/before-after-no-content-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « LayoutTests/fast/css-generated-content/before-after-no-content-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698