Chromium Code Reviews| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 return someChildrenNeedStyleRecalc; | 133 return someChildrenNeedStyleRecalc; |
| 134 } | 134 } |
| 135 | 135 |
| 136 bool StyleInvalidator::invalidate(Element& element) | 136 bool StyleInvalidator::invalidate(Element& element) |
| 137 { | 137 { |
| 138 RecursionCheckpoint checkpoint(&m_recursionData); | 138 RecursionCheckpoint checkpoint(&m_recursionData); |
| 139 | 139 |
| 140 bool thisElementNeedsStyleRecalc = checkInvalidationSetsAgainstElement(eleme nt); | 140 bool thisElementNeedsStyleRecalc = checkInvalidationSetsAgainstElement(eleme nt); |
| 141 | 141 |
| 142 bool someChildrenNeedStyleRecalc = false; | 142 bool someChildrenNeedStyleRecalc = false; |
| 143 if (m_recursionData.hasInvalidationSets() || element.childNeedsStyleInvalida tion()) | 143 if ((!m_recursionData.wholeSubtreeInvalid() && m_recursionData.hasInvalidati onSets()) || element.childNeedsStyleInvalidation()) |
|
esprehn
2014/06/05 09:40:24
I think we should just return false from hasInvali
rune
2014/06/05 09:52:26
Done.
| |
| 144 someChildrenNeedStyleRecalc = invalidateChildren(element); | 144 someChildrenNeedStyleRecalc = invalidateChildren(element); |
| 145 | 145 |
| 146 if (thisElementNeedsStyleRecalc) { | 146 if (thisElementNeedsStyleRecalc) { |
| 147 element.setNeedsStyleRecalc(m_recursionData.wholeSubtreeInvalid() ? Subt reeStyleChange : LocalStyleChange); | 147 element.setNeedsStyleRecalc(m_recursionData.wholeSubtreeInvalid() ? Subt reeStyleChange : LocalStyleChange); |
| 148 } else if (m_recursionData.hasInvalidationSets() && someChildrenNeedStyleRec alc) { | 148 } else if (m_recursionData.hasInvalidationSets() && someChildrenNeedStyleRec alc) { |
| 149 // Clone the RenderStyle in order to preserve correct style sharing, if possible. Otherwise recalc style. | 149 // Clone the RenderStyle in order to preserve correct style sharing, if possible. Otherwise recalc style. |
| 150 if (RenderObject* renderer = element.renderer()) | 150 if (RenderObject* renderer = element.renderer()) |
| 151 renderer->setStyleInternal(RenderStyle::clone(renderer->style())); | 151 renderer->setStyleInternal(RenderStyle::clone(renderer->style())); |
| 152 else | 152 else |
| 153 element.setNeedsStyleRecalc(LocalStyleChange); | 153 element.setNeedsStyleRecalc(LocalStyleChange); |
| 154 } | 154 } |
| 155 | 155 |
| 156 element.clearChildNeedsStyleInvalidation(); | 156 element.clearChildNeedsStyleInvalidation(); |
| 157 element.clearNeedsStyleInvalidation(); | 157 element.clearNeedsStyleInvalidation(); |
| 158 | 158 |
| 159 return thisElementNeedsStyleRecalc; | 159 return thisElementNeedsStyleRecalc; |
| 160 } | 160 } |
| 161 | 161 |
| 162 void StyleInvalidator::trace(Visitor* visitor) | 162 void StyleInvalidator::trace(Visitor* visitor) |
| 163 { | 163 { |
| 164 visitor->trace(m_pendingInvalidationMap); | 164 visitor->trace(m_pendingInvalidationMap); |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace WebCore | 167 } // namespace WebCore |
| OLD | NEW |