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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 if (m_sameOriginOnly && !ruleData.hasDocumentSecurityOrigin()) 292 if (m_sameOriginOnly && !ruleData.hasDocumentSecurityOrigin())
293 return; 293 return;
294 294
295 PseudoId dynamicPseudo = result.dynamicPseudo; 295 PseudoId dynamicPseudo = result.dynamicPseudo;
296 // If we're matching normal rules, set a pseudo bit if 296 // If we're matching normal rules, set a pseudo bit if
297 // we really just matched a pseudo-element. 297 // we really just matched a pseudo-element.
298 if (dynamicPseudo != NOPSEUDO && m_pseudoStyleRequest.pseudoId == NOPSEU DO) { 298 if (dynamicPseudo != NOPSEUDO && m_pseudoStyleRequest.pseudoId == NOPSEU DO) {
299 if (m_mode == SelectorChecker::CollectingCSSRules || m_mode == Selec torChecker::CollectingStyleRules) 299 if (m_mode == SelectorChecker::CollectingCSSRules || m_mode == Selec torChecker::CollectingStyleRules)
300 return; 300 return;
301 // FIXME: Matching should not modify the style directly. 301 // FIXME: Matching should not modify the style directly.
302 if (m_style && dynamicPseudo < FIRST_INTERNAL_PSEUDOID) 302 if (!m_style || dynamicPseudo >= FIRST_INTERNAL_PSEUDOID)
303 m_style->setHasPseudoStyle(dynamicPseudo); 303 return;
304 if ((dynamicPseudo == BEFORE || dynamicPseudo == AFTER) && !ruleData .rule()->properties().hasProperty(CSSPropertyContent))
305 return;
306 m_style->setHasPseudoStyle(dynamicPseudo);
304 } else { 307 } else {
305 // Update our first/last rule indices in the matched rules array. 308 // Update our first/last rule indices in the matched rules array.
306 ++ruleRange.lastRuleIndex; 309 ++ruleRange.lastRuleIndex;
307 if (ruleRange.firstRuleIndex == -1) 310 if (ruleRange.firstRuleIndex == -1)
308 ruleRange.firstRuleIndex = ruleRange.lastRuleIndex; 311 ruleRange.firstRuleIndex = ruleRange.lastRuleIndex;
309 312
310 // Add this rule to our list of matched rules. 313 // Add this rule to our list of matched rules.
311 addMatchedRule(&ruleData, result.specificity, cascadeScope, cascadeO rder, matchRequest.styleSheetIndex, matchRequest.styleSheet); 314 addMatchedRule(&ruleData, result.specificity, cascadeScope, cascadeO rder, matchRequest.styleSheetIndex, matchRequest.styleSheet);
312 return; 315 return;
313 } 316 }
(...skipping 29 matching lines...) Expand all
343 // information about "scope". 346 // information about "scope".
344 int firstRuleIndex = -1, lastRuleIndex = -1; 347 int firstRuleIndex = -1, lastRuleIndex = -1;
345 RuleRange ruleRange(firstRuleIndex, lastRuleIndex); 348 RuleRange ruleRange(firstRuleIndex, lastRuleIndex);
346 // FIXME: Verify whether it's ok to ignore CascadeScope here. 349 // FIXME: Verify whether it's ok to ignore CascadeScope here.
347 collectMatchingRules(MatchRequest(ruleSet), ruleRange, SelectorChecker::Defa ultBehavior); 350 collectMatchingRules(MatchRequest(ruleSet), ruleRange, SelectorChecker::Defa ultBehavior);
348 351
349 return m_matchedRules && !m_matchedRules->isEmpty(); 352 return m_matchedRules && !m_matchedRules->isEmpty();
350 } 353 }
351 354
352 } // namespace blink 355 } // namespace blink
OLDNEW
« 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