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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp

Issue 2883153002: Don't bother checking for paint properties for classes that never need them. (Closed)
Patch Set: none Created 3 years, 7 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 | « no previous file | 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/PaintPropertyTreeBuilder.h" 5 #include "core/paint/PaintPropertyTreeBuilder.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "core/dom/DOMNodeIds.h" 8 #include "core/dom/DOMNodeIds.h"
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 paint_properties.SetCompositorElementId( 1200 paint_properties.SetCompositorElementId(
1201 CreateDomNodeBasedCompositorElementId(object)); 1201 CreateDomNodeBasedCompositorElementId(object));
1202 } 1202 }
1203 } else { 1203 } else {
1204 object.GetMutableForPainting().ClearPaintProperties(); 1204 object.GetMutableForPainting().ClearPaintProperties();
1205 if (had_paint_properties) 1205 if (had_paint_properties)
1206 full_context.force_subtree_update = true; 1206 full_context.force_subtree_update = true;
1207 } 1207 }
1208 } 1208 }
1209 1209
1210 static inline bool MightNeedPaintProperties(const LayoutObject& object) {
1211 return object.IsBoxModelObject() || object.IsSVG();
pdr. 2017/05/15 21:32:45 Why is IsSVG() needed?
chrishtr 2017/05/15 21:36:22 NeedsSVGLocalToBorderBoxTransform, NeedsTransformF
1212 }
1213
1210 void PaintPropertyTreeBuilder::UpdatePropertiesForSelf( 1214 void PaintPropertyTreeBuilder::UpdatePropertiesForSelf(
1211 const LayoutObject& object, 1215 const LayoutObject& object,
1212 PaintPropertyTreeBuilderContext& full_context) { 1216 PaintPropertyTreeBuilderContext& full_context) {
1213 PaintPropertyTreeBuilderFragmentContext& context = full_context.fragments[0]; 1217 PaintPropertyTreeBuilderFragmentContext& context = full_context.fragments[0];
1214 if (object.IsSVGHiddenContainer()) { 1218 if (object.IsSVGHiddenContainer()) {
1215 // SVG resources are painted within one or more other locations in the 1219 // SVG resources are painted within one or more other locations in the
1216 // SVG during paint, and hence have their own independent paint property 1220 // SVG during paint, and hence have their own independent paint property
1217 // trees, paint offset, etc. 1221 // trees, paint offset, etc.
1218 context = PaintPropertyTreeBuilderFragmentContext(); 1222 context = PaintPropertyTreeBuilderFragmentContext();
1219 } 1223 }
1220 1224
1221 UpdatePaintProperties(object, full_context); 1225 bool might_need_paint_properties = MightNeedPaintProperties(object);
pdr. 2017/05/15 21:32:45 It's important that this does not change between u
chrishtr 2017/05/15 21:36:22 Indeed. Changed.
1226
1227 if (might_need_paint_properties)
pdr. 2017/05/15 21:32:45 Is the perf win just reducing the calls to this fn
chrishtr 2017/05/15 21:36:22 No. the perf win is not calling UpdatePaintPropert
1228 UpdatePaintProperties(object, full_context);
1222 1229
1223 bool is_actually_needed = false; 1230 bool is_actually_needed = false;
1224 #if DCHECK_IS_ON() 1231 #if DCHECK_IS_ON()
1225 is_actually_needed = full_context.is_actually_needed; 1232 is_actually_needed = full_context.is_actually_needed;
1226 #endif 1233 #endif
1227 1234
1228 // This is not in FindObjectPropertiesNeedingUpdateScope because paint offset 1235 // This is not in FindObjectPropertiesNeedingUpdateScope because paint offset
1229 // can change without needsPaintPropertyUpdate. 1236 // can change without needsPaintPropertyUpdate.
1230 UpdateForObjectLocationAndSize( 1237 UpdateForObjectLocationAndSize(
1231 object, full_context.container_for_absolute_position, is_actually_needed, 1238 object, full_context.container_for_absolute_position, is_actually_needed,
1232 context, full_context.force_subtree_update); 1239 context, full_context.force_subtree_update);
1233 1240
1234 #if DCHECK_IS_ON() 1241 #if DCHECK_IS_ON()
1235 FindObjectPropertiesNeedingUpdateScope check_needs_update_scope( 1242 FindObjectPropertiesNeedingUpdateScope check_needs_update_scope(
1236 object, full_context.force_subtree_update); 1243 object, full_context.force_subtree_update);
1237 #endif 1244 #endif
1238 1245
1239 if (object.IsBoxModelObject() || object.IsSVG()) { 1246 if (might_need_paint_properties) {
1240 UpdateTransform(object, context, full_context.force_subtree_update); 1247 UpdateTransform(object, context, full_context.force_subtree_update);
1241 UpdateCssClip(object, context, full_context.force_subtree_update); 1248 UpdateCssClip(object, context, full_context.force_subtree_update);
1242 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1249 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1243 UpdateEffect(object, context, full_context.force_subtree_update); 1250 UpdateEffect(object, context, full_context.force_subtree_update);
1244 UpdateFilter(object, context, full_context.force_subtree_update); 1251 UpdateFilter(object, context, full_context.force_subtree_update);
1245 } 1252 }
1246 UpdateLocalBorderBoxContext(object, context, 1253 UpdateLocalBorderBoxContext(object, context,
1247 full_context.force_subtree_update); 1254 full_context.force_subtree_update);
1248 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1255 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1249 UpdateScrollbarPaintOffset(object, context, 1256 UpdateScrollbarPaintOffset(object, context,
1250 full_context.force_subtree_update); 1257 full_context.force_subtree_update);
1251 } 1258 }
1252 } 1259 }
1253 } 1260 }
1254 1261
1255 void PaintPropertyTreeBuilder::UpdatePropertiesForChildren( 1262 void PaintPropertyTreeBuilder::UpdatePropertiesForChildren(
1256 const LayoutObject& object, 1263 const LayoutObject& object,
1257 PaintPropertyTreeBuilderContext& context) { 1264 PaintPropertyTreeBuilderContext& context) {
1258 if (!object.IsBoxModelObject() && !object.IsSVG()) 1265 if (!MightNeedPaintProperties(object))
1259 return; 1266 return;
1260 1267
1261 for (auto& fragment_context : context.fragments) { 1268 for (auto& fragment_context : context.fragments) {
1262 #if DCHECK_IS_ON() 1269 #if DCHECK_IS_ON()
1263 FindObjectPropertiesNeedingUpdateScope check_needs_update_scope( 1270 FindObjectPropertiesNeedingUpdateScope check_needs_update_scope(
1264 object, context.force_subtree_update); 1271 object, context.force_subtree_update);
1265 #endif 1272 #endif
1266 UpdateOverflowClip(object, fragment_context, context.force_subtree_update); 1273 UpdateOverflowClip(object, fragment_context, context.force_subtree_update);
1267 UpdatePerspective(object, fragment_context, context.force_subtree_update); 1274 UpdatePerspective(object, fragment_context, context.force_subtree_update);
1268 UpdateSvgLocalToBorderBoxTransform(object, fragment_context, 1275 UpdateSvgLocalToBorderBoxTransform(object, fragment_context,
1269 context.force_subtree_update); 1276 context.force_subtree_update);
1270 UpdateScrollAndScrollTranslation(object, fragment_context, 1277 UpdateScrollAndScrollTranslation(object, fragment_context,
1271 context.force_subtree_update); 1278 context.force_subtree_update);
1272 UpdateOutOfFlowContext(object, fragment_context, 1279 UpdateOutOfFlowContext(object, fragment_context,
1273 context.force_subtree_update); 1280 context.force_subtree_update);
1274 1281
1275 context.force_subtree_update |= object.SubtreeNeedsPaintPropertyUpdate(); 1282 context.force_subtree_update |= object.SubtreeNeedsPaintPropertyUpdate();
1276 } 1283 }
1277 1284
1278 if (object.CanContainAbsolutePositionObjects()) 1285 if (object.CanContainAbsolutePositionObjects())
1279 context.container_for_absolute_position = &object; 1286 context.container_for_absolute_position = &object;
1280 } 1287 }
1281 1288
1282 } // namespace blink 1289 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698