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/dom/Document.h" | 10 #include "core/dom/Document.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 StyleInvalidator::InvalidationList& StyleInvalidator::ensurePendingInvalidationL
ist(Element& element) | 34 StyleInvalidator::InvalidationList& StyleInvalidator::ensurePendingInvalidationL
ist(Element& element) |
35 { | 35 { |
36 PendingInvalidationMap::AddResult addResult = m_pendingInvalidationMap.add(&
element, nullptr); | 36 PendingInvalidationMap::AddResult addResult = m_pendingInvalidationMap.add(&
element, nullptr); |
37 if (addResult.isNewEntry) | 37 if (addResult.isNewEntry) |
38 addResult.storedValue->value = adoptPtr(new InvalidationList); | 38 addResult.storedValue->value = adoptPtr(new InvalidationList); |
39 return *addResult.storedValue->value; | 39 return *addResult.storedValue->value; |
40 } | 40 } |
41 | 41 |
42 void StyleInvalidator::clearInvalidation(Node& node) | 42 void StyleInvalidator::clearInvalidation(Node& node) |
43 { | 43 { |
| 44 if (node.isElementNode() && node.needsStyleInvalidation()) |
| 45 m_pendingInvalidationMap.remove(toElement(&node)); |
44 node.clearChildNeedsStyleInvalidation(); | 46 node.clearChildNeedsStyleInvalidation(); |
45 node.clearNeedsStyleInvalidation(); | 47 node.clearNeedsStyleInvalidation(); |
46 if (node.isElementNode()) | |
47 m_pendingInvalidationMap.remove(toElement(&node)); | |
48 } | 48 } |
49 | 49 |
50 void StyleInvalidator::clearPendingInvalidations() | 50 void StyleInvalidator::clearPendingInvalidations() |
51 { | 51 { |
52 m_pendingInvalidationMap.clear(); | 52 m_pendingInvalidationMap.clear(); |
53 } | 53 } |
54 | 54 |
55 StyleInvalidator::StyleInvalidator() | 55 StyleInvalidator::StyleInvalidator() |
56 { } | 56 { } |
57 | 57 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 element.clearChildNeedsStyleInvalidation(); | 151 element.clearChildNeedsStyleInvalidation(); |
152 element.clearNeedsStyleInvalidation(); | 152 element.clearNeedsStyleInvalidation(); |
153 | 153 |
154 return thisElementNeedsStyleRecalc; | 154 return thisElementNeedsStyleRecalc; |
155 } | 155 } |
156 | 156 |
157 } // namespace WebCore | 157 } // namespace WebCore |
OLD | NEW |