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

Side by Side Diff: Source/core/css/RuleFeature.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/PropertySetCSSStyleDeclaration.cpp ('k') | Source/core/css/RuleSet.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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if (metadata.foundSiblingSelector) 153 if (metadata.foundSiblingSelector)
154 siblingRules.append(RuleFeature(ruleData.rule(), ruleData.selectorIndex( ), ruleData.hasDocumentSecurityOrigin())); 154 siblingRules.append(RuleFeature(ruleData.rule(), ruleData.selectorIndex( ), ruleData.hasDocumentSecurityOrigin()));
155 if (ruleData.containsUncommonAttributeSelector()) 155 if (ruleData.containsUncommonAttributeSelector())
156 uncommonAttributeRules.append(RuleFeature(ruleData.rule(), ruleData.sele ctorIndex(), ruleData.hasDocumentSecurityOrigin())); 156 uncommonAttributeRules.append(RuleFeature(ruleData.rule(), ruleData.sele ctorIndex(), ruleData.hasDocumentSecurityOrigin()));
157 } 157 }
158 158
159 DescendantInvalidationSet& RuleFeatureSet::ensureClassInvalidationSet(const Atom icString& className) 159 DescendantInvalidationSet& RuleFeatureSet::ensureClassInvalidationSet(const Atom icString& className)
160 { 160 {
161 InvalidationSetMap::AddResult addResult = m_classInvalidationSets.add(classN ame, 0); 161 InvalidationSetMap::AddResult addResult = m_classInvalidationSets.add(classN ame, 0);
162 if (addResult.isNewEntry) 162 if (addResult.isNewEntry)
163 addResult.iterator->value = DescendantInvalidationSet::create(); 163 addResult.storedValue->value = DescendantInvalidationSet::create();
164 return *addResult.iterator->value; 164 return *addResult.storedValue->value;
165 } 165 }
166 166
167 void RuleFeatureSet::collectFeaturesFromSelector(const CSSSelector& selector) 167 void RuleFeatureSet::collectFeaturesFromSelector(const CSSSelector& selector)
168 { 168 {
169 collectFeaturesFromSelector(selector, m_metadata); 169 collectFeaturesFromSelector(selector, m_metadata);
170 } 170 }
171 171
172 void RuleFeatureSet::collectFeaturesFromSelector(const CSSSelector& selector, Ru leFeatureSet::FeatureMetadata& metadata) 172 void RuleFeatureSet::collectFeaturesFromSelector(const CSSSelector& selector, Ru leFeatureSet::FeatureMetadata& metadata)
173 { 173 {
174 unsigned maxDirectAdjacentSelectors = 0; 174 unsigned maxDirectAdjacentSelectors = 0;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 if (DescendantInvalidationSet* invalidationSet = m_classInvalidationSets.get (className)) { 327 if (DescendantInvalidationSet* invalidationSet = m_classInvalidationSets.get (className)) {
328 ensurePendingInvalidationList(element).append(invalidationSet); 328 ensurePendingInvalidationList(element).append(invalidationSet);
329 element->setNeedsStyleInvalidation(); 329 element->setNeedsStyleInvalidation();
330 } 330 }
331 } 331 }
332 332
333 RuleFeatureSet::InvalidationList& RuleFeatureSet::ensurePendingInvalidationList( Element* element) 333 RuleFeatureSet::InvalidationList& RuleFeatureSet::ensurePendingInvalidationList( Element* element)
334 { 334 {
335 PendingInvalidationMap::AddResult addResult = m_pendingInvalidationMap.add(e lement, 0); 335 PendingInvalidationMap::AddResult addResult = m_pendingInvalidationMap.add(e lement, 0);
336 if (addResult.isNewEntry) 336 if (addResult.isNewEntry)
337 addResult.iterator->value = new InvalidationList; 337 addResult.storedValue->value = new InvalidationList;
338 return *addResult.iterator->value; 338 return *addResult.storedValue->value;
339 } 339 }
340 340
341 void RuleFeatureSet::computeStyleInvalidation(Document& document) 341 void RuleFeatureSet::computeStyleInvalidation(Document& document)
342 { 342 {
343 Vector<AtomicString> invalidationClasses; 343 Vector<AtomicString> invalidationClasses;
344 if (Element* documentElement = document.documentElement()) { 344 if (Element* documentElement = document.documentElement()) {
345 if (documentElement->childNeedsStyleInvalidation()) { 345 if (documentElement->childNeedsStyleInvalidation()) {
346 invalidateStyleForClassChange(documentElement, invalidationClasses, false); 346 invalidateStyleForClassChange(documentElement, invalidationClasses, false);
347 } 347 }
348 } 348 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 413
414 if (thisElementNeedsStyleRecalc) 414 if (thisElementNeedsStyleRecalc)
415 element->setNeedsStyleRecalc(LocalStyleChange); 415 element->setNeedsStyleRecalc(LocalStyleChange);
416 416
417 invalidationClasses.remove(oldSize, invalidationClasses.size() - oldSize); 417 invalidationClasses.remove(oldSize, invalidationClasses.size() - oldSize);
418 element->clearChildNeedsStyleInvalidation(); 418 element->clearChildNeedsStyleInvalidation();
419 return thisElementNeedsStyleRecalc; 419 return thisElementNeedsStyleRecalc;
420 } 420 }
421 421
422 } // namespace WebCore 422 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/PropertySetCSSStyleDeclaration.cpp ('k') | Source/core/css/RuleSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698