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

Side by Side Diff: Source/core/css/invalidation/StyleInvalidator.cpp

Issue 633343002: Use C++11 range based iteration for invalidation sets. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review issue: renamed variables 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
« no previous file with comments | « Source/core/css/invalidation/DescendantInvalidationSet.cpp ('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 2014 The Chromium Authors. All rights reserved. 2 // Copyright 2014 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 #include "config.h" 6 #include "config.h"
7 7
8 #include "core/css/invalidation/StyleInvalidator.h" 8 #include "core/css/invalidation/StyleInvalidator.h"
9 9
10 #include "core/css/invalidation/DescendantInvalidationSet.h" 10 #include "core/css/invalidation/DescendantInvalidationSet.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 m_invalidateCustomPseudo = invalidationSet.customPseudoInvalid(); 82 m_invalidateCustomPseudo = invalidationSet.customPseudoInvalid();
83 } 83 }
84 84
85 bool StyleInvalidator::RecursionData::matchesCurrentInvalidationSets(Element& el ement) 85 bool StyleInvalidator::RecursionData::matchesCurrentInvalidationSets(Element& el ement)
86 { 86 {
87 ASSERT(!m_wholeSubtreeInvalid); 87 ASSERT(!m_wholeSubtreeInvalid);
88 88
89 if (m_invalidateCustomPseudo && element.shadowPseudoId() != nullAtom) 89 if (m_invalidateCustomPseudo && element.shadowPseudoId() != nullAtom)
90 return true; 90 return true;
91 91
92 for (InvalidationSets::iterator it = m_invalidationSets.begin(); it != m_inv alidationSets.end(); ++it) { 92 for (const auto& invalidationSet : m_invalidationSets) {
93 if ((*it)->invalidatesElement(element)) 93 if (invalidationSet->invalidatesElement(element))
94 return true; 94 return true;
95 } 95 }
96 96
97 return false; 97 return false;
98 } 98 }
99 99
100 bool StyleInvalidator::checkInvalidationSetsAgainstElement(Element& element, Sty leInvalidator::RecursionData& recursionData) 100 bool StyleInvalidator::checkInvalidationSetsAgainstElement(Element& element, Sty leInvalidator::RecursionData& recursionData)
101 { 101 {
102 if (element.styleChangeType() >= SubtreeStyleChange || recursionData.wholeSu btreeInvalid()) { 102 if (element.styleChangeType() >= SubtreeStyleChange || recursionData.wholeSu btreeInvalid()) {
103 recursionData.setWholeSubtreeInvalid(); 103 recursionData.setWholeSubtreeInvalid();
104 return false; 104 return false;
105 } 105 }
106 if (element.needsStyleInvalidation()) { 106 if (element.needsStyleInvalidation()) {
107 if (InvalidationList* invalidationList = m_pendingInvalidationMap.get(&e lement)) { 107 if (InvalidationList* invalidationList = m_pendingInvalidationMap.get(&e lement)) {
108 for (InvalidationList::const_iterator it = invalidationList->begin() ; it != invalidationList->end(); ++it) 108 for (const auto& invalidationSet : *invalidationList)
109 recursionData.pushInvalidationSet(**it); 109 recursionData.pushInvalidationSet(*invalidationSet);
110 // FIXME: It's really only necessary to clone the render style for t his element, not full style recalc. 110 // FIXME: It's really only necessary to clone the render style for t his element, not full style recalc.
111 return true; 111 return true;
112 } 112 }
113 } 113 }
114 return recursionData.matchesCurrentInvalidationSets(element); 114 return recursionData.matchesCurrentInvalidationSets(element);
115 } 115 }
116 116
117 bool StyleInvalidator::invalidateChildren(Element& element, StyleInvalidator::Re cursionData& recursionData) 117 bool StyleInvalidator::invalidateChildren(Element& element, StyleInvalidator::Re cursionData& recursionData)
118 { 118 {
119 bool someChildrenNeedStyleRecalc = false; 119 bool someChildrenNeedStyleRecalc = false;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 161 }
162 162
163 void StyleInvalidator::trace(Visitor* visitor) 163 void StyleInvalidator::trace(Visitor* visitor)
164 { 164 {
165 #if ENABLE(OILPAN) 165 #if ENABLE(OILPAN)
166 visitor->trace(m_pendingInvalidationMap); 166 visitor->trace(m_pendingInvalidationMap);
167 #endif 167 #endif
168 } 168 }
169 169
170 } // namespace blink 170 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/invalidation/DescendantInvalidationSet.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698