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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 return; | 53 return; |
54 } | 54 } |
55 | 55 |
56 if (invalidationSet->invalidatesSelf()) | 56 if (invalidationSet->invalidatesSelf()) |
57 element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTr
acing::create(StyleChangeReason::StyleInvalidator)); | 57 element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTr
acing::create(StyleChangeReason::StyleInvalidator)); |
58 | 58 |
59 if (!invalidationSet->isEmpty()) | 59 if (!invalidationSet->isEmpty()) |
60 requiresDescendantInvalidation = true; | 60 requiresDescendantInvalidation = true; |
61 } | 61 } |
62 | 62 |
63 if (invalidationLists.siblings.isEmpty() && !requiresDescendantInvalidation) | 63 if (!requiresDescendantInvalidation && (invalidationLists.siblings.isEmpty()
|| !element.nextSibling())) |
64 return; | 64 return; |
65 | 65 |
66 element.setNeedsStyleInvalidation(); | 66 element.setNeedsStyleInvalidation(); |
| 67 |
67 PendingInvalidations& pendingInvalidations = ensurePendingInvalidations(elem
ent); | 68 PendingInvalidations& pendingInvalidations = ensurePendingInvalidations(elem
ent); |
68 for (auto& invalidationSet : invalidationLists.siblings) { | 69 if (element.nextSibling()) { |
69 if (pendingInvalidations.siblings().contains(invalidationSet)) | 70 for (auto& invalidationSet : invalidationLists.siblings) { |
70 continue; | 71 if (pendingInvalidations.siblings().contains(invalidationSet)) |
71 pendingInvalidations.siblings().append(invalidationSet); | 72 continue; |
| 73 pendingInvalidations.siblings().append(invalidationSet); |
| 74 } |
72 } | 75 } |
73 | 76 |
74 if (!requiresDescendantInvalidation) | 77 if (!requiresDescendantInvalidation) |
75 return; | 78 return; |
76 | 79 |
77 for (auto& invalidationSet : invalidationLists.descendants) { | 80 for (auto& invalidationSet : invalidationLists.descendants) { |
78 ASSERT(!invalidationSet->wholeSubtreeInvalid()); | 81 ASSERT(!invalidationSet->wholeSubtreeInvalid()); |
79 if (invalidationSet->isEmpty()) | 82 if (invalidationSet->isEmpty()) |
80 continue; | 83 continue; |
81 if (pendingInvalidations.descendants().contains(invalidationSet)) | 84 if (pendingInvalidations.descendants().contains(invalidationSet)) |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 } | 296 } |
294 | 297 |
295 DEFINE_TRACE(StyleInvalidator) | 298 DEFINE_TRACE(StyleInvalidator) |
296 { | 299 { |
297 #if ENABLE(OILPAN) | 300 #if ENABLE(OILPAN) |
298 visitor->trace(m_pendingInvalidationMap); | 301 visitor->trace(m_pendingInvalidationMap); |
299 #endif | 302 #endif |
300 } | 303 } |
301 | 304 |
302 } // namespace blink | 305 } // namespace blink |
OLD | NEW |