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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 bool thisElementNeedsStyleRecalc = checkInvalidationSetsAgainstElement(eleme
nt, recursionData); | 169 bool thisElementNeedsStyleRecalc = checkInvalidationSetsAgainstElement(eleme
nt, recursionData); |
170 | 170 |
171 bool someChildrenNeedStyleRecalc = false; | 171 bool someChildrenNeedStyleRecalc = false; |
172 if (recursionData.hasInvalidationSets() || element.childNeedsStyleInvalidati
on()) | 172 if (recursionData.hasInvalidationSets() || element.childNeedsStyleInvalidati
on()) |
173 someChildrenNeedStyleRecalc = invalidateChildren(element, recursionData)
; | 173 someChildrenNeedStyleRecalc = invalidateChildren(element, recursionData)
; |
174 | 174 |
175 if (thisElementNeedsStyleRecalc) { | 175 if (thisElementNeedsStyleRecalc) { |
176 ASSERT(!recursionData.wholeSubtreeInvalid()); | 176 ASSERT(!recursionData.wholeSubtreeInvalid()); |
177 element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracin
g::create(StyleChangeReason::StyleInvalidator)); | 177 element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracin
g::create(StyleChangeReason::StyleInvalidator)); |
178 } else if (recursionData.hasInvalidationSets() && someChildrenNeedStyleRecal
c) { | 178 } else if (recursionData.hasInvalidationSets() && someChildrenNeedStyleRecal
c) { |
179 // Clone the LayoutStyle in order to preserve correct style sharing, if
possible. Otherwise recalc style. | 179 // Clone the ComputedStyle in order to preserve correct style sharing, i
f possible. Otherwise recalc style. |
180 if (LayoutObject* renderer = element.layoutObject()) { | 180 if (LayoutObject* renderer = element.layoutObject()) { |
181 renderer->setStyleInternal(LayoutStyle::clone(renderer->styleRef()))
; | 181 renderer->setStyleInternal(ComputedStyle::clone(renderer->styleRef()
)); |
182 } else { | 182 } else { |
183 TRACE_STYLE_INVALIDATOR_INVALIDATION_IF_ENABLED(element, PreventStyl
eSharingForParent); | 183 TRACE_STYLE_INVALIDATOR_INVALIDATION_IF_ENABLED(element, PreventStyl
eSharingForParent); |
184 element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTr
acing::create(StyleChangeReason::StyleInvalidator)); | 184 element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTr
acing::create(StyleChangeReason::StyleInvalidator)); |
185 } | 185 } |
186 } | 186 } |
187 | 187 |
188 if (recursionData.insertionPointCrossing() && element.isInsertionPoint()) | 188 if (recursionData.insertionPointCrossing() && element.isInsertionPoint()) |
189 element.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTrac
ing::create(StyleChangeReason::StyleInvalidator)); | 189 element.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTrac
ing::create(StyleChangeReason::StyleInvalidator)); |
190 | 190 |
191 element.clearChildNeedsStyleInvalidation(); | 191 element.clearChildNeedsStyleInvalidation(); |
192 element.clearNeedsStyleInvalidation(); | 192 element.clearNeedsStyleInvalidation(); |
193 | 193 |
194 return thisElementNeedsStyleRecalc; | 194 return thisElementNeedsStyleRecalc; |
195 } | 195 } |
196 | 196 |
197 DEFINE_TRACE(StyleInvalidator) | 197 DEFINE_TRACE(StyleInvalidator) |
198 { | 198 { |
199 #if ENABLE(OILPAN) | 199 #if ENABLE(OILPAN) |
200 visitor->trace(m_pendingInvalidationMap); | 200 visitor->trace(m_pendingInvalidationMap); |
201 #endif | 201 #endif |
202 } | 202 } |
203 | 203 |
204 } // namespace blink | 204 } // namespace blink |
OLD | NEW |