Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: Source/core/css/invalidation/StyleInvalidator.cpp

Issue 317133002: Skip traversing wholeSubtree subtrees with clean invalidation bits. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/fast/css/invalidation/targeted-class-whole-subtree-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « LayoutTests/fast/css/invalidation/targeted-class-whole-subtree-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698