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

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

Issue 149513011: Pass around CSSSelector by reference instead of pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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 | « Source/core/css/CSSStyleRule.cpp ('k') | Source/core/css/RuleFeature.h » ('j') | 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 // We know this selector does not include any pseudo elements. 279 // We know this selector does not include any pseudo elements.
280 if (m_pseudoStyleRequest.pseudoId != NOPSEUDO) 280 if (m_pseudoStyleRequest.pseudoId != NOPSEUDO)
281 return false; 281 return false;
282 // We know a sufficiently simple single part selector matches simply bec ause we found it from the rule hash. 282 // We know a sufficiently simple single part selector matches simply bec ause we found it from the rule hash.
283 // This is limited to HTML only so we don't need to check the namespace. 283 // This is limited to HTML only so we don't need to check the namespace.
284 ASSERT(m_context.element()); 284 ASSERT(m_context.element());
285 if (ruleData.hasRightmostSelectorMatchingHTMLBasedOnRuleHash() && m_cont ext.element()->isHTMLElement()) { 285 if (ruleData.hasRightmostSelectorMatchingHTMLBasedOnRuleHash() && m_cont ext.element()->isHTMLElement()) {
286 if (!ruleData.hasMultipartSelector()) 286 if (!ruleData.hasMultipartSelector())
287 return true; 287 return true;
288 } 288 }
289 if (ruleData.selector()->m_match == CSSSelector::Tag && !SelectorChecker ::tagMatches(*m_context.element(), ruleData.selector()->tagQName())) 289 if (ruleData.selector().m_match == CSSSelector::Tag && !SelectorChecker: :tagMatches(*m_context.element(), ruleData.selector().tagQName()))
290 return false; 290 return false;
291 SelectorCheckerFastPath selectorCheckerFastPath(ruleData.selector(), *m_ context.element()); 291 SelectorCheckerFastPath selectorCheckerFastPath(ruleData.selector(), *m_ context.element());
292 if (!selectorCheckerFastPath.matchesRightmostAttributeSelector()) 292 if (!selectorCheckerFastPath.matchesRightmostAttributeSelector())
293 return false; 293 return false;
294 294
295 return selectorCheckerFastPath.matches(); 295 return selectorCheckerFastPath.matches();
296 } 296 }
297 297
298 // Slow path. 298 // Slow path.
299 SelectorChecker selectorChecker(m_context.element()->document(), m_mode); 299 SelectorChecker selectorChecker(m_context.element()->document(), m_mode);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 // information about "scope". 400 // information about "scope".
401 int firstRuleIndex = -1, lastRuleIndex = -1; 401 int firstRuleIndex = -1, lastRuleIndex = -1;
402 RuleRange ruleRange(firstRuleIndex, lastRuleIndex); 402 RuleRange ruleRange(firstRuleIndex, lastRuleIndex);
403 // FIXME: Verify whether it's ok to ignore CascadeScope here. 403 // FIXME: Verify whether it's ok to ignore CascadeScope here.
404 collectMatchingRules(MatchRequest(ruleSet), ruleRange, SelectorChecker::Stay sWithinTreeScope); 404 collectMatchingRules(MatchRequest(ruleSet), ruleRange, SelectorChecker::Stay sWithinTreeScope);
405 405
406 return m_matchedRules && !m_matchedRules->isEmpty(); 406 return m_matchedRules && !m_matchedRules->isEmpty();
407 } 407 }
408 408
409 } // namespace WebCore 409 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/CSSStyleRule.cpp ('k') | Source/core/css/RuleFeature.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698