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

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

Issue 645743003: Use C++11 range-based loop for core/css (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: better variable names Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/RemoteFontFaceSource.cpp ('k') | Source/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 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 } 324 }
325 325
326 void RuleSet::addStyleRule(StyleRule* rule, AddRuleFlags addRuleFlags) 326 void RuleSet::addStyleRule(StyleRule* rule, AddRuleFlags addRuleFlags)
327 { 327 {
328 for (size_t selectorIndex = 0; selectorIndex != kNotFound; selectorIndex = r ule->selectorList().indexOfNextSelectorAfter(selectorIndex)) 328 for (size_t selectorIndex = 0; selectorIndex != kNotFound; selectorIndex = r ule->selectorList().indexOfNextSelectorAfter(selectorIndex))
329 addRule(rule, selectorIndex, addRuleFlags); 329 addRule(rule, selectorIndex, addRuleFlags);
330 } 330 }
331 331
332 void RuleSet::compactPendingRules(PendingRuleMap& pendingMap, CompactRuleMap& co mpactMap) 332 void RuleSet::compactPendingRules(PendingRuleMap& pendingMap, CompactRuleMap& co mpactMap)
333 { 333 {
334 PendingRuleMap::iterator end = pendingMap.end(); 334 for (auto& item : pendingMap) {
335 for (PendingRuleMap::iterator it = pendingMap.begin(); it != end; ++it) { 335 OwnPtrWillBeRawPtr<WillBeHeapLinkedStack<RuleData> > pendingRules = item .value.release();
336 OwnPtrWillBeRawPtr<WillBeHeapLinkedStack<RuleData> > pendingRules = it-> value.release(); 336 CompactRuleMap::ValueType* compactRules = compactMap.add(item.key, nullp tr).storedValue;
337 CompactRuleMap::ValueType* compactRules = compactMap.add(it->key, nullpt r).storedValue;
338 337
339 WillBeHeapTerminatedArrayBuilder<RuleData> builder(compactRules->value.r elease()); 338 WillBeHeapTerminatedArrayBuilder<RuleData> builder(compactRules->value.r elease());
340 builder.grow(pendingRules->size()); 339 builder.grow(pendingRules->size());
341 while (!pendingRules->isEmpty()) { 340 while (!pendingRules->isEmpty()) {
342 builder.append(pendingRules->peek()); 341 builder.append(pendingRules->peek());
343 pendingRules->pop(); 342 pendingRules->pop();
344 } 343 }
345 344
346 compactRules->value = builder.release(); 345 compactRules->value = builder.release();
347 } 346 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 visitor->trace(m_pendingRules); 408 visitor->trace(m_pendingRules);
410 #ifndef NDEBUG 409 #ifndef NDEBUG
411 visitor->trace(m_allRules); 410 visitor->trace(m_allRules);
412 #endif 411 #endif
413 #endif 412 #endif
414 } 413 }
415 414
416 #ifndef NDEBUG 415 #ifndef NDEBUG
417 void RuleSet::show() 416 void RuleSet::show()
418 { 417 {
419 for (WillBeHeapVector<RuleData>::const_iterator it = m_allRules.begin(); it != m_allRules.end(); ++it) 418 for (const auto& rule: m_allRules)
420 it->selector().show(); 419 rule.selector().show();
421 } 420 }
422 #endif 421 #endif
423 422
424 } // namespace blink 423 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/RemoteFontFaceSource.cpp ('k') | Source/core/css/SelectorChecker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698