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 25 matching lines...) Expand all Loading... |
36 if (Element* documentElement = document.documentElement()) | 36 if (Element* documentElement = document.documentElement()) |
37 invalidate(*documentElement, recursionData, siblingData); | 37 invalidate(*documentElement, recursionData, siblingData); |
38 document.clearChildNeedsStyleInvalidation(); | 38 document.clearChildNeedsStyleInvalidation(); |
39 document.clearNeedsStyleInvalidation(); | 39 document.clearNeedsStyleInvalidation(); |
40 m_pendingInvalidationMap.clear(); | 40 m_pendingInvalidationMap.clear(); |
41 } | 41 } |
42 | 42 |
43 void StyleInvalidator::scheduleInvalidationSetsForElement(const InvalidationList
s& invalidationLists, Element& element) | 43 void StyleInvalidator::scheduleInvalidationSetsForElement(const InvalidationList
s& invalidationLists, Element& element) |
44 { | 44 { |
45 ASSERT(element.inActiveDocument()); | 45 ASSERT(element.inActiveDocument()); |
46 if (element.styleChangeType() >= SubtreeStyleChange) | |
47 return; | |
48 | |
49 bool requiresDescendantInvalidation = false; | 46 bool requiresDescendantInvalidation = false; |
50 | 47 |
51 for (auto& invalidationSet : invalidationLists.descendants) { | 48 if (element.styleChangeType() < SubtreeStyleChange) { |
52 if (invalidationSet->wholeSubtreeInvalid()) { | 49 for (auto& invalidationSet : invalidationLists.descendants) { |
53 element.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonFor
Tracing::create(StyleChangeReason::StyleInvalidator)); | 50 if (invalidationSet->wholeSubtreeInvalid()) { |
54 clearInvalidation(element); | 51 element.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReaso
nForTracing::create(StyleChangeReason::StyleInvalidator)); |
55 return; | 52 requiresDescendantInvalidation = false; |
| 53 break; |
| 54 } |
| 55 |
| 56 if (invalidationSet->invalidatesSelf()) |
| 57 element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonF
orTracing::create(StyleChangeReason::StyleInvalidator)); |
| 58 |
| 59 if (!invalidationSet->isEmpty()) |
| 60 requiresDescendantInvalidation = true; |
56 } | 61 } |
57 | |
58 if (invalidationSet->invalidatesSelf()) | |
59 element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTr
acing::create(StyleChangeReason::StyleInvalidator)); | |
60 | |
61 if (!invalidationSet->isEmpty()) | |
62 requiresDescendantInvalidation = true; | |
63 } | 62 } |
64 | 63 |
65 if (!requiresDescendantInvalidation && (invalidationLists.siblings.isEmpty()
|| !element.nextSibling())) | 64 if (!requiresDescendantInvalidation && (invalidationLists.siblings.isEmpty()
|| !element.nextSibling())) |
66 return; | 65 return; |
67 | 66 |
68 element.setNeedsStyleInvalidation(); | 67 element.setNeedsStyleInvalidation(); |
69 | 68 |
70 PendingInvalidations& pendingInvalidations = ensurePendingInvalidations(elem
ent); | 69 PendingInvalidations& pendingInvalidations = ensurePendingInvalidations(elem
ent); |
71 if (element.nextSibling()) { | 70 if (element.nextSibling()) { |
72 for (auto& invalidationSet : invalidationLists.siblings) | 71 for (auto& invalidationSet : invalidationLists.siblings) |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 } | 291 } |
293 | 292 |
294 DEFINE_TRACE(StyleInvalidator) | 293 DEFINE_TRACE(StyleInvalidator) |
295 { | 294 { |
296 #if ENABLE(OILPAN) | 295 #if ENABLE(OILPAN) |
297 visitor->trace(m_pendingInvalidationMap); | 296 visitor->trace(m_pendingInvalidationMap); |
298 #endif | 297 #endif |
299 } | 298 } |
300 | 299 |
301 } // namespace blink | 300 } // namespace blink |
OLD | NEW |