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

Side by Side Diff: Source/core/css/ElementRuleCollector.cpp

Issue 829393005: Don't match empty style rules. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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/platform/win/fast/css/first-letter-first-line-hover-expected.txt ('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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 return false; 273 return false;
274 return true; 274 return true;
275 } 275 }
276 276
277 void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, Cascad eScope cascadeScope, CascadeOrder cascadeOrder, const MatchRequest& matchRequest , RuleRange& ruleRange) 277 void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, Cascad eScope cascadeScope, CascadeOrder cascadeOrder, const MatchRequest& matchRequest , RuleRange& ruleRange)
278 { 278 {
279 if (m_canUseFastReject && m_selectorFilter.fastRejectSelector<RuleData::maxi mumIdentifierCount>(ruleData.descendantSelectorIdentifierHashes())) 279 if (m_canUseFastReject && m_selectorFilter.fastRejectSelector<RuleData::maxi mumIdentifierCount>(ruleData.descendantSelectorIdentifierHashes()))
280 return; 280 return;
281 281
282 StyleRule* rule = ruleData.rule(); 282 StyleRule* rule = ruleData.rule();
283
284 // If the rule has no properties to apply, then ignore it in the non-debug m ode.
285 const StylePropertySet& properties = rule->properties();
286 if (properties.isEmpty() && !matchRequest.includeEmptyRules)
287 return;
288
283 SelectorChecker::MatchResult result; 289 SelectorChecker::MatchResult result;
284 if (ruleMatches(ruleData, matchRequest.scope, &result)) { 290 if (ruleMatches(ruleData, matchRequest.scope, &result)) {
285 // If the rule has no properties to apply, then ignore it in the non-deb ug mode.
286 const StylePropertySet& properties = rule->properties();
287 if (properties.isEmpty() && !matchRequest.includeEmptyRules)
288 return;
289 // FIXME: Exposing the non-standard getMatchedCSSRules API to web is the only reason this is needed. 291 // FIXME: Exposing the non-standard getMatchedCSSRules API to web is the only reason this is needed.
290 if (m_sameOriginOnly && !ruleData.hasDocumentSecurityOrigin()) 292 if (m_sameOriginOnly && !ruleData.hasDocumentSecurityOrigin())
291 return; 293 return;
292 294
293 PseudoId dynamicPseudo = result.dynamicPseudo; 295 PseudoId dynamicPseudo = result.dynamicPseudo;
294 // If we're matching normal rules, set a pseudo bit if 296 // If we're matching normal rules, set a pseudo bit if
295 // we really just matched a pseudo-element. 297 // we really just matched a pseudo-element.
296 if (dynamicPseudo != NOPSEUDO && m_pseudoStyleRequest.pseudoId == NOPSEU DO) { 298 if (dynamicPseudo != NOPSEUDO && m_pseudoStyleRequest.pseudoId == NOPSEU DO) {
297 if (m_mode == SelectorChecker::CollectingCSSRules || m_mode == Selec torChecker::CollectingStyleRules) 299 if (m_mode == SelectorChecker::CollectingCSSRules || m_mode == Selec torChecker::CollectingStyleRules)
298 return; 300 return;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 // information about "scope". 345 // information about "scope".
344 int firstRuleIndex = -1, lastRuleIndex = -1; 346 int firstRuleIndex = -1, lastRuleIndex = -1;
345 RuleRange ruleRange(firstRuleIndex, lastRuleIndex); 347 RuleRange ruleRange(firstRuleIndex, lastRuleIndex);
346 // FIXME: Verify whether it's ok to ignore CascadeScope here. 348 // FIXME: Verify whether it's ok to ignore CascadeScope here.
347 collectMatchingRules(MatchRequest(ruleSet), ruleRange); 349 collectMatchingRules(MatchRequest(ruleSet), ruleRange);
348 350
349 return !m_matchedRules.isEmpty(); 351 return !m_matchedRules.isEmpty();
350 } 352 }
351 353
352 } // namespace blink 354 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/platform/win/fast/css/first-letter-first-line-hover-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698