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