| OLD | NEW |
| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 } | 61 } |
| 62 | 62 |
| 63 StyleInvalidator::InvalidationList& StyleInvalidator::ensurePendingInvalidationL
ist(Element& element) | 63 StyleInvalidator::InvalidationList& StyleInvalidator::ensurePendingInvalidationL
ist(Element& element) |
| 64 { | 64 { |
| 65 PendingInvalidationMap::AddResult addResult = m_pendingInvalidationMap.add(&
element, nullptr); | 65 PendingInvalidationMap::AddResult addResult = m_pendingInvalidationMap.add(&
element, nullptr); |
| 66 if (addResult.isNewEntry) | 66 if (addResult.isNewEntry) |
| 67 addResult.storedValue->value = adoptPtrWillBeNoop(new InvalidationList); | 67 addResult.storedValue->value = adoptPtrWillBeNoop(new InvalidationList); |
| 68 return *addResult.storedValue->value; | 68 return *addResult.storedValue->value; |
| 69 } | 69 } |
| 70 | 70 |
| 71 void StyleInvalidator::clearInvalidation(Node& node) | 71 void StyleInvalidator::clearInvalidation(Element& element) |
| 72 { | 72 { |
| 73 if (node.isElementNode() && node.needsStyleInvalidation()) | 73 if (!element.needsStyleInvalidation()) |
| 74 m_pendingInvalidationMap.remove(toElement(&node)); | 74 return; |
| 75 m_pendingInvalidationMap.remove(&element); |
| 76 element.clearNeedsStyleInvalidation(); |
| 75 } | 77 } |
| 76 | 78 |
| 77 void StyleInvalidator::clearPendingInvalidations() | 79 void StyleInvalidator::clearPendingInvalidations() |
| 78 { | 80 { |
| 79 m_pendingInvalidationMap.clear(); | 81 m_pendingInvalidationMap.clear(); |
| 80 } | 82 } |
| 81 | 83 |
| 82 StyleInvalidator::StyleInvalidator() | 84 StyleInvalidator::StyleInvalidator() |
| 83 { | 85 { |
| 84 s_tracingEnabled = TRACE_EVENT_API_GET_CATEGORY_ENABLED(TRACE_DISABLED_BY_DE
FAULT("devtools.timeline.invalidationTracking")); | 86 s_tracingEnabled = TRACE_EVENT_API_GET_CATEGORY_ENABLED(TRACE_DISABLED_BY_DE
FAULT("devtools.timeline.invalidationTracking")); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 198 } |
| 197 | 199 |
| 198 DEFINE_TRACE(StyleInvalidator) | 200 DEFINE_TRACE(StyleInvalidator) |
| 199 { | 201 { |
| 200 #if ENABLE(OILPAN) | 202 #if ENABLE(OILPAN) |
| 201 visitor->trace(m_pendingInvalidationMap); | 203 visitor->trace(m_pendingInvalidationMap); |
| 202 #endif | 204 #endif |
| 203 } | 205 } |
| 204 | 206 |
| 205 } // namespace blink | 207 } // namespace blink |
| OLD | NEW |