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

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

Issue 899163003: Move rendering/RenderObject to layout/LayoutObject. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/SelectorChecker.cpp ('k') | Source/core/css/resolver/StyleResolver.cpp » ('j') | 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"
11 #include "core/dom/Document.h" 11 #include "core/dom/Document.h"
12 #include "core/dom/Element.h" 12 #include "core/dom/Element.h"
13 #include "core/dom/ElementTraversal.h" 13 #include "core/dom/ElementTraversal.h"
14 #include "core/dom/shadow/ElementShadow.h" 14 #include "core/dom/shadow/ElementShadow.h"
15 #include "core/dom/shadow/ShadowRoot.h" 15 #include "core/dom/shadow/ShadowRoot.h"
16 #include "core/inspector/InspectorTraceEvents.h" 16 #include "core/inspector/InspectorTraceEvents.h"
17 #include "core/rendering/RenderObject.h" 17 #include "core/layout/LayoutObject.h"
18 18
19 namespace blink { 19 namespace blink {
20 20
21 // StyleInvalidator methods are super sensitive to performance benchmarks. 21 // StyleInvalidator methods are super sensitive to performance benchmarks.
22 // We easily get 1% regression per additional if statement on recursive 22 // We easily get 1% regression per additional if statement on recursive
23 // invalidate methods. 23 // invalidate methods.
24 // To minimize performance impact, we wrap trace events with a lookup of 24 // To minimize performance impact, we wrap trace events with a lookup of
25 // cached flag. The cached flag is made "static const" and is not shared 25 // cached flag. The cached flag is made "static const" and is not shared
26 // with DescendantInvalidationSet to avoid additional GOT lookup cost. 26 // with DescendantInvalidationSet to avoid additional GOT lookup cost.
27 static const unsigned char* s_tracingEnabled = nullptr; 27 static const unsigned char* s_tracingEnabled = nullptr;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 bool thisElementNeedsStyleRecalc = checkInvalidationSetsAgainstElement(eleme nt, recursionData); 168 bool thisElementNeedsStyleRecalc = checkInvalidationSetsAgainstElement(eleme nt, recursionData);
169 169
170 bool someChildrenNeedStyleRecalc = false; 170 bool someChildrenNeedStyleRecalc = false;
171 if (recursionData.hasInvalidationSets() || element.childNeedsStyleInvalidati on()) 171 if (recursionData.hasInvalidationSets() || element.childNeedsStyleInvalidati on())
172 someChildrenNeedStyleRecalc = invalidateChildren(element, recursionData) ; 172 someChildrenNeedStyleRecalc = invalidateChildren(element, recursionData) ;
173 173
174 if (thisElementNeedsStyleRecalc) { 174 if (thisElementNeedsStyleRecalc) {
175 element.setNeedsStyleRecalc(recursionData.wholeSubtreeInvalid() ? Subtre eStyleChange : LocalStyleChange, StyleChangeReasonForTracing::create(StyleChange Reason::StyleInvalidator)); 175 element.setNeedsStyleRecalc(recursionData.wholeSubtreeInvalid() ? Subtre eStyleChange : LocalStyleChange, StyleChangeReasonForTracing::create(StyleChange Reason::StyleInvalidator));
176 } else if (recursionData.hasInvalidationSets() && someChildrenNeedStyleRecal c) { 176 } else if (recursionData.hasInvalidationSets() && someChildrenNeedStyleRecal c) {
177 // Clone the RenderStyle in order to preserve correct style sharing, if possible. Otherwise recalc style. 177 // Clone the RenderStyle in order to preserve correct style sharing, if possible. Otherwise recalc style.
178 if (RenderObject* renderer = element.renderer()) { 178 if (LayoutObject* renderer = element.renderer()) {
179 renderer->setStyleInternal(RenderStyle::clone(renderer->style())); 179 renderer->setStyleInternal(RenderStyle::clone(renderer->style()));
180 } else { 180 } else {
181 TRACE_STYLE_INVALIDATOR_INVALIDATION_IF_ENABLED(element, PreventStyl eSharingForParent); 181 TRACE_STYLE_INVALIDATOR_INVALIDATION_IF_ENABLED(element, PreventStyl eSharingForParent);
182 element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTr acing::create(StyleChangeReason::StyleInvalidator)); 182 element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTr acing::create(StyleChangeReason::StyleInvalidator));
183 } 183 }
184 } 184 }
185 185
186 if (recursionData.insertionPointCrossing() && element.isInsertionPoint()) 186 if (recursionData.insertionPointCrossing() && element.isInsertionPoint())
187 element.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTrac ing::create(StyleChangeReason::StyleInvalidator)); 187 element.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTrac ing::create(StyleChangeReason::StyleInvalidator));
188 188
189 element.clearChildNeedsStyleInvalidation(); 189 element.clearChildNeedsStyleInvalidation();
190 element.clearNeedsStyleInvalidation(); 190 element.clearNeedsStyleInvalidation();
191 191
192 return thisElementNeedsStyleRecalc; 192 return thisElementNeedsStyleRecalc;
193 } 193 }
194 194
195 void StyleInvalidator::trace(Visitor* visitor) 195 void StyleInvalidator::trace(Visitor* visitor)
196 { 196 {
197 #if ENABLE(OILPAN) 197 #if ENABLE(OILPAN)
198 visitor->trace(m_pendingInvalidationMap); 198 visitor->trace(m_pendingInvalidationMap);
199 #endif 199 #endif
200 } 200 }
201 201
202 } // namespace blink 202 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/SelectorChecker.cpp ('k') | Source/core/css/resolver/StyleResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698