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 "core/css/invalidation/StyleInvalidator.h" | 5 #include "core/css/invalidation/StyleInvalidator.h" |
6 | 6 |
7 #include "core/css/invalidation/InvalidationSet.h" | 7 #include "core/css/invalidation/InvalidationSet.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
10 #include "core/dom/ElementTraversal.h" | 10 #include "core/dom/ElementTraversal.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 SubtreeStyleChange, StyleChangeReasonForTracing::create( | 125 SubtreeStyleChange, StyleChangeReasonForTracing::create( |
126 StyleChangeReason::StyleInvalidator)); | 126 StyleChangeReason::StyleInvalidator)); |
127 return; | 127 return; |
128 } | 128 } |
129 if (!pendingInvalidations.descendants().contains(descendants)) | 129 if (!pendingInvalidations.descendants().contains(descendants)) |
130 pendingInvalidations.descendants().push_back(descendants); | 130 pendingInvalidations.descendants().push_back(descendants); |
131 } | 131 } |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 void StyleInvalidator::rescheduleSiblingInvalidationsAsDescendants( | |
136 Element& element) { | |
137 PendingInvalidations* pendingInvalidations = | |
138 m_pendingInvalidationMap.get(&element); | |
139 if (!pendingInvalidations || pendingInvalidations->siblings().isEmpty()) | |
140 return; | |
141 | |
142 InvalidationLists invalidationLists; | |
143 for (const auto& invalidationSet : pendingInvalidations->siblings()) { | |
144 invalidationLists.descendants.push_back(invalidationSet); | |
145 if (DescendantInvalidationSet* descendants = | |
146 toSiblingInvalidationSet(*invalidationSet).siblingDescendants()) { | |
147 invalidationLists.descendants.push_back(descendants); | |
148 } | |
149 } | |
150 DCHECK(element.parentNode()); | |
esprehn
2016/12/22 17:19:59
I personally like to put these at the top of the f
rune
2016/12/23 00:15:20
Done.
| |
151 scheduleInvalidationSetsForNode(invalidationLists, *element.parentNode()); | |
152 } | |
153 | |
135 void StyleInvalidator::clearInvalidation(ContainerNode& node) { | 154 void StyleInvalidator::clearInvalidation(ContainerNode& node) { |
136 if (!node.needsStyleInvalidation()) | 155 if (!node.needsStyleInvalidation()) |
137 return; | 156 return; |
138 m_pendingInvalidationMap.remove(&node); | 157 m_pendingInvalidationMap.remove(&node); |
139 node.clearNeedsStyleInvalidation(); | 158 node.clearNeedsStyleInvalidation(); |
140 } | 159 } |
141 | 160 |
142 PendingInvalidations& StyleInvalidator::ensurePendingInvalidations( | 161 PendingInvalidations& StyleInvalidator::ensurePendingInvalidations( |
143 ContainerNode& node) { | 162 ContainerNode& node) { |
144 PendingInvalidationMap::AddResult addResult = | 163 PendingInvalidationMap::AddResult addResult = |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
409 continue; | 428 continue; |
410 if (recursionData.matchesCurrentInvalidationSetsAsSlotted( | 429 if (recursionData.matchesCurrentInvalidationSetsAsSlotted( |
411 toElement(*distributedNode))) | 430 toElement(*distributedNode))) |
412 distributedNode->setNeedsStyleRecalc( | 431 distributedNode->setNeedsStyleRecalc( |
413 LocalStyleChange, StyleChangeReasonForTracing::create( | 432 LocalStyleChange, StyleChangeReasonForTracing::create( |
414 StyleChangeReason::StyleInvalidator)); | 433 StyleChangeReason::StyleInvalidator)); |
415 } | 434 } |
416 } | 435 } |
417 | 436 |
418 } // namespace blink | 437 } // namespace blink |
OLD | NEW |