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

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

Issue 828373005: Remove includeEmptyRules. (Closed) Base URL: git@github.com:domokit/mojo.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 | « no previous file | sky/engine/core/css/resolver/MatchRequest.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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 context.scope = scope; 137 context.scope = scope;
138 return selectorChecker.match(context); 138 return selectorChecker.match(context);
139 } 139 }
140 140
141 void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, Cascad eScope cascadeScope, CascadeOrder cascadeOrder, const MatchRequest& matchRequest , RuleRange& ruleRange) 141 void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, Cascad eScope cascadeScope, CascadeOrder cascadeOrder, const MatchRequest& matchRequest , RuleRange& ruleRange)
142 { 142 {
143 StyleRule* rule = ruleData.rule(); 143 StyleRule* rule = ruleData.rule();
144 if (ruleMatches(ruleData, matchRequest.scope)) { 144 if (ruleMatches(ruleData, matchRequest.scope)) {
145 // If the rule has no properties to apply, then ignore it in the non-deb ug mode. 145 // If the rule has no properties to apply, then ignore it in the non-deb ug mode.
146 const StylePropertySet& properties = rule->properties(); 146 const StylePropertySet& properties = rule->properties();
147 if (properties.isEmpty() && !matchRequest.includeEmptyRules) 147 if (properties.isEmpty())
148 return; 148 return;
149 149
150 // Update our first/last rule indices in the matched rules array. 150 // Update our first/last rule indices in the matched rules array.
151 ++ruleRange.lastRuleIndex; 151 ++ruleRange.lastRuleIndex;
152 if (ruleRange.firstRuleIndex == -1) 152 if (ruleRange.firstRuleIndex == -1)
153 ruleRange.firstRuleIndex = ruleRange.lastRuleIndex; 153 ruleRange.firstRuleIndex = ruleRange.lastRuleIndex;
154 154
155 // Add this rule to our list of matched rules. 155 // Add this rule to our list of matched rules.
156 addMatchedRule(&ruleData, cascadeScope, cascadeOrder, matchRequest.style SheetIndex, matchRequest.styleSheet); 156 addMatchedRule(&ruleData, cascadeScope, cascadeOrder, matchRequest.style SheetIndex, matchRequest.styleSheet);
157 } 157 }
158 } 158 }
159 159
160 static inline bool compareRules(const MatchedRule& matchedRule1, const MatchedRu le& matchedRule2) 160 static inline bool compareRules(const MatchedRule& matchedRule1, const MatchedRu le& matchedRule2)
161 { 161 {
162 if (matchedRule1.cascadeScope() != matchedRule2.cascadeScope()) 162 if (matchedRule1.cascadeScope() != matchedRule2.cascadeScope())
163 return matchedRule1.cascadeScope() > matchedRule2.cascadeScope(); 163 return matchedRule1.cascadeScope() > matchedRule2.cascadeScope();
164 164
165 return matchedRule1.position() < matchedRule2.position(); 165 return matchedRule1.position() < matchedRule2.position();
166 } 166 }
167 167
168 void ElementRuleCollector::sortMatchedRules() 168 void ElementRuleCollector::sortMatchedRules()
169 { 169 {
170 ASSERT(m_matchedRules); 170 ASSERT(m_matchedRules);
171 std::sort(m_matchedRules->begin(), m_matchedRules->end(), compareRules); 171 std::sort(m_matchedRules->begin(), m_matchedRules->end(), compareRules);
172 } 172 }
173 173
174 } // namespace blink 174 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/css/resolver/MatchRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698