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

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

Issue 138643003: Simpler return value of HashTable::add/HashMap:add and others (Closed)
Patch Set: Daily master update (now with base url?) 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/RuleFeature.cpp ('k') | Source/core/css/StyleSheetContents.cpp » ('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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 , m_hasDocumentSecurityOrigin(addRuleFlags & RuleHasDocumentSecurityOrigin) 205 , m_hasDocumentSecurityOrigin(addRuleFlags & RuleHasDocumentSecurityOrigin)
206 , m_propertyWhitelistType(determinePropertyWhitelistType(addRuleFlags, selec tor())) 206 , m_propertyWhitelistType(determinePropertyWhitelistType(addRuleFlags, selec tor()))
207 { 207 {
208 ASSERT(m_position == position); 208 ASSERT(m_position == position);
209 ASSERT(m_selectorIndex == selectorIndex); 209 ASSERT(m_selectorIndex == selectorIndex);
210 SelectorFilter::collectIdentifierHashes(selector(), m_descendantSelectorIden tifierHashes, maximumIdentifierCount); 210 SelectorFilter::collectIdentifierHashes(selector(), m_descendantSelectorIden tifierHashes, maximumIdentifierCount);
211 } 211 }
212 212
213 void RuleSet::addToRuleSet(const AtomicString& key, PendingRuleMap& map, const R uleData& ruleData) 213 void RuleSet::addToRuleSet(const AtomicString& key, PendingRuleMap& map, const R uleData& ruleData)
214 { 214 {
215 OwnPtr<LinkedStack<RuleData> >& rules = map.add(key, nullptr).iterator->valu e; 215 OwnPtr<LinkedStack<RuleData> >& rules = map.add(key, nullptr).storedValue->v alue;
216 if (!rules) 216 if (!rules)
217 rules = adoptPtr(new LinkedStack<RuleData>); 217 rules = adoptPtr(new LinkedStack<RuleData>);
218 rules->push(ruleData); 218 rules->push(ruleData);
219 } 219 }
220 220
221 static void extractValuesforSelector(const CSSSelector* selector, AtomicString& id, AtomicString& className, AtomicString& customPseudoElementName, AtomicString & tagName) 221 static void extractValuesforSelector(const CSSSelector* selector, AtomicString& id, AtomicString& className, AtomicString& customPseudoElementName, AtomicString & tagName)
222 { 222 {
223 switch (selector->m_match) { 223 switch (selector->m_match) {
224 case CSSSelector::Id: 224 case CSSSelector::Id:
225 id = selector->value(); 225 id = selector->value();
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 { 419 {
420 for (size_t selectorIndex = 0; selectorIndex != kNotFound; selectorIndex = r ule->selectorList().indexOfNextSelectorAfter(selectorIndex)) 420 for (size_t selectorIndex = 0; selectorIndex != kNotFound; selectorIndex = r ule->selectorList().indexOfNextSelectorAfter(selectorIndex))
421 addRule(rule, selectorIndex, addRuleFlags); 421 addRule(rule, selectorIndex, addRuleFlags);
422 } 422 }
423 423
424 void RuleSet::compactPendingRules(PendingRuleMap& pendingMap, CompactRuleMap& co mpactMap) 424 void RuleSet::compactPendingRules(PendingRuleMap& pendingMap, CompactRuleMap& co mpactMap)
425 { 425 {
426 PendingRuleMap::iterator end = pendingMap.end(); 426 PendingRuleMap::iterator end = pendingMap.end();
427 for (PendingRuleMap::iterator it = pendingMap.begin(); it != end; ++it) { 427 for (PendingRuleMap::iterator it = pendingMap.begin(); it != end; ++it) {
428 OwnPtr<LinkedStack<RuleData> > pendingRules = it->value.release(); 428 OwnPtr<LinkedStack<RuleData> > pendingRules = it->value.release();
429 CompactRuleMap::iterator compactRules = compactMap.add(it->key, nullptr) .iterator; 429 CompactRuleMap::ValueType* compactRules = compactMap.add(it->key, nullpt r).storedValue;
430 430
431 TerminatedArrayBuilder<RuleData> builder(compactRules->value.release()); 431 TerminatedArrayBuilder<RuleData> builder(compactRules->value.release());
432 builder.grow(pendingRules->size()); 432 builder.grow(pendingRules->size());
433 while (!pendingRules->isEmpty()) { 433 while (!pendingRules->isEmpty()) {
434 builder.append(pendingRules->peek()); 434 builder.append(pendingRules->peek());
435 pendingRules->pop(); 435 pendingRules->pop();
436 } 436 }
437 437
438 compactRules->value = builder.release(); 438 compactRules->value = builder.release();
439 } 439 }
(...skipping 22 matching lines...) Expand all
462 #ifndef NDEBUG 462 #ifndef NDEBUG
463 463
464 void RuleSet::show() 464 void RuleSet::show()
465 { 465 {
466 for (Vector<RuleData>::const_iterator it = m_allRules.begin(); it != m_allRu les.end(); ++it) 466 for (Vector<RuleData>::const_iterator it = m_allRules.begin(); it != m_allRu les.end(); ++it)
467 it->selector().show(); 467 it->selector().show();
468 } 468 }
469 #endif 469 #endif
470 470
471 } // namespace WebCore 471 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/RuleFeature.cpp ('k') | Source/core/css/StyleSheetContents.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698