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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 StyleInvalidator::~StyleInvalidator() | 77 StyleInvalidator::~StyleInvalidator() |
78 { | 78 { |
79 } | 79 } |
80 | 80 |
81 void StyleInvalidator::RecursionData::pushInvalidationSet(const DescendantInvali
dationSet& invalidationSet) | 81 void StyleInvalidator::RecursionData::pushInvalidationSet(const DescendantInvali
dationSet& invalidationSet) |
82 { | 82 { |
83 ASSERT(!m_wholeSubtreeInvalid); | 83 ASSERT(!m_wholeSubtreeInvalid); |
84 if (invalidationSet.treeBoundaryCrossing()) | 84 if (invalidationSet.treeBoundaryCrossing()) |
85 m_treeBoundaryCrossing = true; | 85 m_treeBoundaryCrossing = true; |
| 86 if (invalidationSet.insertionPointCrossing()) |
| 87 m_insertionPointCrossing = true; |
86 if (invalidationSet.wholeSubtreeInvalid()) { | 88 if (invalidationSet.wholeSubtreeInvalid()) { |
87 m_wholeSubtreeInvalid = true; | 89 m_wholeSubtreeInvalid = true; |
88 return; | 90 return; |
89 } | 91 } |
90 m_invalidationSets.append(&invalidationSet); | 92 m_invalidationSets.append(&invalidationSet); |
91 m_invalidateCustomPseudo = invalidationSet.customPseudoInvalid(); | 93 m_invalidateCustomPseudo = invalidationSet.customPseudoInvalid(); |
92 } | 94 } |
93 | 95 |
94 ALWAYS_INLINE bool StyleInvalidator::RecursionData::matchesCurrentInvalidationSe
ts(Element& element) | 96 ALWAYS_INLINE bool StyleInvalidator::RecursionData::matchesCurrentInvalidationSe
ts(Element& element) |
95 { | 97 { |
96 ASSERT(!m_wholeSubtreeInvalid); | 98 ASSERT(!m_wholeSubtreeInvalid); |
97 | 99 |
98 if (m_invalidateCustomPseudo && element.shadowPseudoId() != nullAtom) { | 100 if (m_invalidateCustomPseudo && element.shadowPseudoId() != nullAtom) { |
99 TRACE_STYLE_INVALIDATOR_INVALIDATION_IF_ENABLED(element, InvalidateCusto
mPseudo); | 101 TRACE_STYLE_INVALIDATOR_INVALIDATION_IF_ENABLED(element, InvalidateCusto
mPseudo); |
100 return true; | 102 return true; |
101 } | 103 } |
102 | 104 |
| 105 if (m_insertionPointCrossing && element.isInsertionPoint()) |
| 106 return true; |
| 107 |
103 for (const auto& invalidationSet : m_invalidationSets) { | 108 for (const auto& invalidationSet : m_invalidationSets) { |
104 if (invalidationSet->invalidatesElement(element)) | 109 if (invalidationSet->invalidatesElement(element)) |
105 return true; | 110 return true; |
106 } | 111 } |
107 | 112 |
108 return false; | 113 return false; |
109 } | 114 } |
110 | 115 |
111 ALWAYS_INLINE bool StyleInvalidator::checkInvalidationSetsAgainstElement(Element
& element, StyleInvalidator::RecursionData& recursionData) | 116 ALWAYS_INLINE bool StyleInvalidator::checkInvalidationSetsAgainstElement(Element
& element, StyleInvalidator::RecursionData& recursionData) |
112 { | 117 { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } else if (recursionData.hasInvalidationSets() && someChildrenNeedStyleRecal
c) { | 171 } else if (recursionData.hasInvalidationSets() && someChildrenNeedStyleRecal
c) { |
167 // Clone the RenderStyle in order to preserve correct style sharing, if
possible. Otherwise recalc style. | 172 // Clone the RenderStyle in order to preserve correct style sharing, if
possible. Otherwise recalc style. |
168 if (RenderObject* renderer = element.renderer()) { | 173 if (RenderObject* renderer = element.renderer()) { |
169 renderer->setStyleInternal(RenderStyle::clone(renderer->style())); | 174 renderer->setStyleInternal(RenderStyle::clone(renderer->style())); |
170 } else { | 175 } else { |
171 TRACE_STYLE_INVALIDATOR_INVALIDATION_IF_ENABLED(element, PreventStyl
eSharingForParent); | 176 TRACE_STYLE_INVALIDATOR_INVALIDATION_IF_ENABLED(element, PreventStyl
eSharingForParent); |
172 element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTr
acing::create(StyleChangeReason::StyleInvalidator)); | 177 element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTr
acing::create(StyleChangeReason::StyleInvalidator)); |
173 } | 178 } |
174 } | 179 } |
175 | 180 |
| 181 if (recursionData.insertionPointCrossing() && element.isInsertionPoint()) |
| 182 element.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTrac
ing::create(StyleChangeReason::StyleInvalidator)); |
| 183 |
176 element.clearChildNeedsStyleInvalidation(); | 184 element.clearChildNeedsStyleInvalidation(); |
177 element.clearNeedsStyleInvalidation(); | 185 element.clearNeedsStyleInvalidation(); |
178 | 186 |
179 return thisElementNeedsStyleRecalc; | 187 return thisElementNeedsStyleRecalc; |
180 } | 188 } |
181 | 189 |
182 void StyleInvalidator::trace(Visitor* visitor) | 190 void StyleInvalidator::trace(Visitor* visitor) |
183 { | 191 { |
184 #if ENABLE(OILPAN) | 192 #if ENABLE(OILPAN) |
185 visitor->trace(m_pendingInvalidationMap); | 193 visitor->trace(m_pendingInvalidationMap); |
186 #endif | 194 #endif |
187 } | 195 } |
188 | 196 |
189 } // namespace blink | 197 } // namespace blink |
OLD | NEW |