OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "core/css/invalidation/StyleInvalidator.h" | 7 #include "core/css/invalidation/StyleInvalidator.h" |
8 | 8 |
9 #include "core/css/invalidation/InvalidationSet.h" | 9 #include "core/css/invalidation/InvalidationSet.h" |
10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 m_invalidationEntries[index] = m_invalidationEntries.last(); | 158 m_invalidationEntries[index] = m_invalidationEntries.last(); |
159 m_invalidationEntries.removeLast(); | 159 m_invalidationEntries.removeLast(); |
160 continue; | 160 continue; |
161 } | 161 } |
162 | 162 |
163 const SiblingInvalidationSet& invalidationSet = *m_invalidationEntries[i ndex].m_invalidationSet; | 163 const SiblingInvalidationSet& invalidationSet = *m_invalidationEntries[i ndex].m_invalidationSet; |
164 | 164 |
165 if (invalidationSet.invalidatesElement(element)) { | 165 if (invalidationSet.invalidatesElement(element)) { |
166 const DescendantInvalidationSet& descendants = invalidationSet.desce ndants(); | 166 const DescendantInvalidationSet& descendants = invalidationSet.desce ndants(); |
167 if (descendants.wholeSubtreeInvalid()) { | 167 if (descendants.wholeSubtreeInvalid()) { |
168 // Avoid directly setting SubtreeStyleChange on element, or Cont ainerNode::checkForChildrenAdjacentRuleChanges() | 168 element.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReaso nForTracing::create(StyleChangeReason::StyleInvalidator)); |
169 // may propagate the SubtreeStyleChange to our own siblings' sub trees. | |
170 | |
171 for (Element* child = ElementTraversal::firstChild(element); chi ld; child = ElementTraversal::nextSibling(*child)) { | |
172 child->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeRe asonForTracing::create(StyleChangeReason::SiblingSelector)); | |
173 } | |
174 return true; | 169 return true; |
175 } | 170 } |
176 | 171 |
177 if (descendants.invalidatesSelf()) | 172 if (descendants.invalidatesSelf()) |
178 thisElementNeedsStyleRecalc = true; | 173 thisElementNeedsStyleRecalc = true; |
179 | 174 |
180 if (!descendants.isEmpty()) | 175 if (!descendants.isEmpty()) |
181 recursionData.pushInvalidationSet(descendants); | 176 recursionData.pushInvalidationSet(descendants); |
182 } | 177 } |
183 | 178 |
(...skipping 27 matching lines...) Expand all Loading... | |
211 if (element.styleChangeType() >= SubtreeStyleChange || recursionData.wholeSu btreeInvalid()) { | 206 if (element.styleChangeType() >= SubtreeStyleChange || recursionData.wholeSu btreeInvalid()) { |
212 recursionData.setWholeSubtreeInvalid(); | 207 recursionData.setWholeSubtreeInvalid(); |
213 return false; | 208 return false; |
214 } | 209 } |
215 | 210 |
216 bool thisElementNeedsStyleRecalc = recursionData.matchesCurrentInvalidationS ets(element); | 211 bool thisElementNeedsStyleRecalc = recursionData.matchesCurrentInvalidationS ets(element); |
217 if (UNLIKELY(!siblingData.isEmpty())) | 212 if (UNLIKELY(!siblingData.isEmpty())) |
218 thisElementNeedsStyleRecalc |= siblingData.matchCurrentInvalidationSets( element, recursionData); | 213 thisElementNeedsStyleRecalc |= siblingData.matchCurrentInvalidationSets( element, recursionData); |
219 | 214 |
220 if (UNLIKELY(element.needsStyleInvalidation())) | 215 if (UNLIKELY(element.needsStyleInvalidation())) |
221 pushInvalidationSetsForElement(element, recursionData, siblingData); | 216 pushInvalidationSetsForElement(element, recursionData, siblingData); |
rune
2015/12/17 00:09:24
Pushing sibling sets here must happen before the e
rune
2015/12/17 12:55:00
Done.
| |
222 return thisElementNeedsStyleRecalc; | 217 return thisElementNeedsStyleRecalc; |
223 } | 218 } |
224 | 219 |
225 bool StyleInvalidator::invalidateShadowRootChildren(Element& element, RecursionD ata& recursionData) | 220 bool StyleInvalidator::invalidateShadowRootChildren(Element& element, RecursionD ata& recursionData) |
226 { | 221 { |
227 bool someChildrenNeedStyleRecalc = false; | 222 bool someChildrenNeedStyleRecalc = false; |
228 for (ShadowRoot* root = element.youngestShadowRoot(); root; root = root->old erShadowRoot()) { | 223 for (ShadowRoot* root = element.youngestShadowRoot(); root; root = root->old erShadowRoot()) { |
229 if (!recursionData.treeBoundaryCrossing() && !root->childNeedsStyleInval idation() && !root->needsStyleInvalidation()) | 224 if (!recursionData.treeBoundaryCrossing() && !root->childNeedsStyleInval idation() && !root->needsStyleInvalidation()) |
230 continue; | 225 continue; |
231 SiblingData siblingData; | 226 SiblingData siblingData; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
288 } | 283 } |
289 | 284 |
290 DEFINE_TRACE(StyleInvalidator) | 285 DEFINE_TRACE(StyleInvalidator) |
291 { | 286 { |
292 #if ENABLE(OILPAN) | 287 #if ENABLE(OILPAN) |
293 visitor->trace(m_pendingInvalidationMap); | 288 visitor->trace(m_pendingInvalidationMap); |
294 #endif | 289 #endif |
295 } | 290 } |
296 | 291 |
297 } // namespace blink | 292 } // namespace blink |
OLD | NEW |