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

Side by Side Diff: third_party/WebKit/Source/core/css/RuleSet.cpp

Issue 2308313002: Clean up RuleSet::addChildRules() (Closed)
Patch Set: Created 4 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 | « third_party/WebKit/Source/core/css/CSSSelectorList.h ('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 Apple Inc. All r ights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 250
251 void RuleSet::addChildRules(const HeapVector<Member<StyleRuleBase>>& rules, cons t MediaQueryEvaluator& medium, AddRuleFlags addRuleFlags) 251 void RuleSet::addChildRules(const HeapVector<Member<StyleRuleBase>>& rules, cons t MediaQueryEvaluator& medium, AddRuleFlags addRuleFlags)
252 { 252 {
253 for (unsigned i = 0; i < rules.size(); ++i) { 253 for (unsigned i = 0; i < rules.size(); ++i) {
254 StyleRuleBase* rule = rules[i].get(); 254 StyleRuleBase* rule = rules[i].get();
255 255
256 if (rule->isStyleRule()) { 256 if (rule->isStyleRule()) {
257 StyleRule* styleRule = toStyleRule(rule); 257 StyleRule* styleRule = toStyleRule(rule);
258 258
259 const CSSSelectorList& selectorList = styleRule->selectorList(); 259 const CSSSelectorList& selectorList = styleRule->selectorList();
260 for (size_t selectorIndex = 0; selectorIndex != kNotFound; selectorI ndex = selectorList.indexOfNextSelectorAfter(selectorIndex)) { 260 for (const CSSSelector* selector = selectorList.first(); selector; s elector = selectorList.next(*selector)) {
261 if (selectorList.selectorAt(selectorIndex).hasDeepCombinatorOrSh adowPseudo()) { 261 size_t selectorIndex = selectorList.selectorIndex(*selector);
262 if (selector->hasDeepCombinatorOrShadowPseudo()) {
262 m_deepCombinatorOrShadowPseudoRules.append(MinimalRuleData(s tyleRule, selectorIndex, addRuleFlags)); 263 m_deepCombinatorOrShadowPseudoRules.append(MinimalRuleData(s tyleRule, selectorIndex, addRuleFlags));
263 } else if (selectorList.selectorAt(selectorIndex).hasContentPseu do()) { 264 } else if (selector->hasContentPseudo()) {
264 m_contentPseudoElementRules.append(MinimalRuleData(styleRule , selectorIndex, addRuleFlags)); 265 m_contentPseudoElementRules.append(MinimalRuleData(styleRule , selectorIndex, addRuleFlags));
265 } else if (selectorList.selectorAt(selectorIndex).hasSlottedPseu do()) { 266 } else if (selector->hasSlottedPseudo()) {
266 m_slottedPseudoElementRules.append(MinimalRuleData(styleRule , selectorIndex, addRuleFlags)); 267 m_slottedPseudoElementRules.append(MinimalRuleData(styleRule , selectorIndex, addRuleFlags));
267 } else { 268 } else {
268 addRule(styleRule, selectorIndex, addRuleFlags); 269 addRule(styleRule, selectorIndex, addRuleFlags);
269 } 270 }
270 } 271 }
271 } else if (rule->isPageRule()) { 272 } else if (rule->isPageRule()) {
272 addPageRule(toStyleRulePage(rule)); 273 addPageRule(toStyleRulePage(rule));
273 } else if (rule->isMediaRule()) { 274 } else if (rule->isMediaRule()) {
274 StyleRuleMedia* mediaRule = toStyleRuleMedia(rule); 275 StyleRuleMedia* mediaRule = toStyleRuleMedia(rule);
275 if ((!mediaRule->mediaQueries() || medium.eval(mediaRule->mediaQueri es(), &m_viewportDependentMediaQueryResults, &m_deviceDependentMediaQueryResults ))) 276 if ((!mediaRule->mediaQueries() || medium.eval(mediaRule->mediaQueri es(), &m_viewportDependentMediaQueryResults, &m_deviceDependentMediaQueryResults )))
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 395
395 #ifndef NDEBUG 396 #ifndef NDEBUG
396 void RuleSet::show() const 397 void RuleSet::show() const
397 { 398 {
398 for (const auto& rule: m_allRules) 399 for (const auto& rule: m_allRules)
399 rule.selector().show(); 400 rule.selector().show();
400 } 401 }
401 #endif 402 #endif
402 403
403 } // namespace blink 404 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSSelectorList.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698