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

Side by Side Diff: sky/engine/core/css/ElementRuleCollector.cpp

Issue 801283006: Get rid of SelectorCheckingContext. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: missing static. 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 | « no previous file | sky/engine/core/css/SelectorChecker.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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 // Now transfer the set of matched rules over to our list of declarations. 124 // Now transfer the set of matched rules over to our list of declarations.
125 for (unsigned i = 0; i < matchedRules.size(); i++) { 125 for (unsigned i = 0; i < matchedRules.size(); i++) {
126 const RuleData* ruleData = matchedRules[i].ruleData(); 126 const RuleData* ruleData = matchedRules[i].ruleData();
127 m_result.addMatchedProperties(&ruleData->rule()->properties()); 127 m_result.addMatchedProperties(&ruleData->rule()->properties());
128 } 128 }
129 } 129 }
130 130
131 inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData, const Co ntainerNode* scope) 131 inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData, const Co ntainerNode* scope)
132 { 132 {
133 SelectorChecker selectorChecker; 133 SelectorChecker checker(*m_context.element());
134 SelectorChecker::SelectorCheckingContext context(ruleData.selector(), m_cont ext.element()); 134 if (checker.match(ruleData.selector(), scope)) {
135 context.scope = scope; 135 if (checker.matchedAttributeSelector())
136 if (selectorChecker.match(context)) {
137 if (selectorChecker.matchedAttributeSelector())
138 m_style->setUnique(); 136 m_style->setUnique();
139 if (selectorChecker.matchedFocusSelector()) 137 if (checker.matchedFocusSelector())
140 m_style->setAffectedByFocus(); 138 m_style->setAffectedByFocus();
141 if (selectorChecker.matchedHoverSelector()) 139 if (checker.matchedHoverSelector())
142 m_style->setAffectedByHover(); 140 m_style->setAffectedByHover();
143 if (selectorChecker.matchedActiveSelector()) 141 if (checker.matchedActiveSelector())
144 m_style->setAffectedByActive(); 142 m_style->setAffectedByActive();
145 return true; 143 return true;
146 } 144 }
147 return false; 145 return false;
148 } 146 }
149 147
150 void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, Cascad eOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange) 148 void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, Cascad eOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange)
151 { 149 {
152 StyleRule* rule = ruleData.rule(); 150 StyleRule* rule = ruleData.rule();
153 if (ruleMatches(ruleData, matchRequest.scope)) { 151 if (ruleMatches(ruleData, matchRequest.scope)) {
(...skipping 17 matching lines...) Expand all
171 return matchedRule1.position() < matchedRule2.position(); 169 return matchedRule1.position() < matchedRule2.position();
172 } 170 }
173 171
174 void ElementRuleCollector::sortMatchedRules() 172 void ElementRuleCollector::sortMatchedRules()
175 { 173 {
176 ASSERT(m_matchedRules); 174 ASSERT(m_matchedRules);
177 std::sort(m_matchedRules->begin(), m_matchedRules->end(), compareRules); 175 std::sort(m_matchedRules->begin(), m_matchedRules->end(), compareRules);
178 } 176 }
179 177
180 } // namespace blink 178 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/css/SelectorChecker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698