| OLD | NEW |
| 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 Loading... |
| 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 ObjectTypeMightNeedPaintProperties( |
| 1211 const LayoutObject& object) { |
| 1212 return object.IsBoxModelObject() || object.IsSVG(); |
| 1213 } |
| 1214 |
| 1210 void PaintPropertyTreeBuilder::UpdatePropertiesForSelf( | 1215 void PaintPropertyTreeBuilder::UpdatePropertiesForSelf( |
| 1211 const LayoutObject& object, | 1216 const LayoutObject& object, |
| 1212 PaintPropertyTreeBuilderContext& full_context) { | 1217 PaintPropertyTreeBuilderContext& full_context) { |
| 1213 PaintPropertyTreeBuilderFragmentContext& context = full_context.fragments[0]; | 1218 PaintPropertyTreeBuilderFragmentContext& context = full_context.fragments[0]; |
| 1214 if (object.IsSVGHiddenContainer()) { | 1219 if (object.IsSVGHiddenContainer()) { |
| 1215 // SVG resources are painted within one or more other locations in the | 1220 // SVG resources are painted within one or more other locations in the |
| 1216 // SVG during paint, and hence have their own independent paint property | 1221 // SVG during paint, and hence have their own independent paint property |
| 1217 // trees, paint offset, etc. | 1222 // trees, paint offset, etc. |
| 1218 context = PaintPropertyTreeBuilderFragmentContext(); | 1223 context = PaintPropertyTreeBuilderFragmentContext(); |
| 1219 } | 1224 } |
| 1220 | 1225 |
| 1221 UpdatePaintProperties(object, full_context); | 1226 bool object_type_might_need_paint_properties = |
| 1227 ObjectTypeMightNeedPaintProperties(object); |
| 1228 |
| 1229 if (object_type_might_need_paint_properties) |
| 1230 UpdatePaintProperties(object, full_context); |
| 1222 | 1231 |
| 1223 bool is_actually_needed = false; | 1232 bool is_actually_needed = false; |
| 1224 #if DCHECK_IS_ON() | 1233 #if DCHECK_IS_ON() |
| 1225 is_actually_needed = full_context.is_actually_needed; | 1234 is_actually_needed = full_context.is_actually_needed; |
| 1226 #endif | 1235 #endif |
| 1227 | 1236 |
| 1228 // This is not in FindObjectPropertiesNeedingUpdateScope because paint offset | 1237 // This is not in FindObjectPropertiesNeedingUpdateScope because paint offset |
| 1229 // can change without needsPaintPropertyUpdate. | 1238 // can change without needsPaintPropertyUpdate. |
| 1230 UpdateForObjectLocationAndSize( | 1239 UpdateForObjectLocationAndSize( |
| 1231 object, full_context.container_for_absolute_position, is_actually_needed, | 1240 object, full_context.container_for_absolute_position, is_actually_needed, |
| 1232 context, full_context.force_subtree_update); | 1241 context, full_context.force_subtree_update); |
| 1233 | 1242 |
| 1234 #if DCHECK_IS_ON() | 1243 #if DCHECK_IS_ON() |
| 1235 FindObjectPropertiesNeedingUpdateScope check_needs_update_scope( | 1244 FindObjectPropertiesNeedingUpdateScope check_needs_update_scope( |
| 1236 object, full_context.force_subtree_update); | 1245 object, full_context.force_subtree_update); |
| 1237 #endif | 1246 #endif |
| 1238 | 1247 |
| 1239 if (object.IsBoxModelObject() || object.IsSVG()) { | 1248 if (object_type_might_need_paint_properties) { |
| 1240 UpdateTransform(object, context, full_context.force_subtree_update); | 1249 UpdateTransform(object, context, full_context.force_subtree_update); |
| 1241 UpdateCssClip(object, context, full_context.force_subtree_update); | 1250 UpdateCssClip(object, context, full_context.force_subtree_update); |
| 1242 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1251 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 1243 UpdateEffect(object, context, full_context.force_subtree_update); | 1252 UpdateEffect(object, context, full_context.force_subtree_update); |
| 1244 UpdateFilter(object, context, full_context.force_subtree_update); | 1253 UpdateFilter(object, context, full_context.force_subtree_update); |
| 1245 } | 1254 } |
| 1246 UpdateLocalBorderBoxContext(object, context, | 1255 UpdateLocalBorderBoxContext(object, context, |
| 1247 full_context.force_subtree_update); | 1256 full_context.force_subtree_update); |
| 1248 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1257 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 1249 UpdateScrollbarPaintOffset(object, context, | 1258 UpdateScrollbarPaintOffset(object, context, |
| 1250 full_context.force_subtree_update); | 1259 full_context.force_subtree_update); |
| 1251 } | 1260 } |
| 1252 } | 1261 } |
| 1253 } | 1262 } |
| 1254 | 1263 |
| 1255 void PaintPropertyTreeBuilder::UpdatePropertiesForChildren( | 1264 void PaintPropertyTreeBuilder::UpdatePropertiesForChildren( |
| 1256 const LayoutObject& object, | 1265 const LayoutObject& object, |
| 1257 PaintPropertyTreeBuilderContext& context) { | 1266 PaintPropertyTreeBuilderContext& context) { |
| 1258 if (!object.IsBoxModelObject() && !object.IsSVG()) | 1267 if (!ObjectTypeMightNeedPaintProperties(object)) |
| 1259 return; | 1268 return; |
| 1260 | 1269 |
| 1261 for (auto& fragment_context : context.fragments) { | 1270 for (auto& fragment_context : context.fragments) { |
| 1262 #if DCHECK_IS_ON() | 1271 #if DCHECK_IS_ON() |
| 1263 FindObjectPropertiesNeedingUpdateScope check_needs_update_scope( | 1272 FindObjectPropertiesNeedingUpdateScope check_needs_update_scope( |
| 1264 object, context.force_subtree_update); | 1273 object, context.force_subtree_update); |
| 1265 #endif | 1274 #endif |
| 1266 UpdateOverflowClip(object, fragment_context, context.force_subtree_update); | 1275 UpdateOverflowClip(object, fragment_context, context.force_subtree_update); |
| 1267 UpdatePerspective(object, fragment_context, context.force_subtree_update); | 1276 UpdatePerspective(object, fragment_context, context.force_subtree_update); |
| 1268 UpdateSvgLocalToBorderBoxTransform(object, fragment_context, | 1277 UpdateSvgLocalToBorderBoxTransform(object, fragment_context, |
| 1269 context.force_subtree_update); | 1278 context.force_subtree_update); |
| 1270 UpdateScrollAndScrollTranslation(object, fragment_context, | 1279 UpdateScrollAndScrollTranslation(object, fragment_context, |
| 1271 context.force_subtree_update); | 1280 context.force_subtree_update); |
| 1272 UpdateOutOfFlowContext(object, fragment_context, | 1281 UpdateOutOfFlowContext(object, fragment_context, |
| 1273 context.force_subtree_update); | 1282 context.force_subtree_update); |
| 1274 | 1283 |
| 1275 context.force_subtree_update |= object.SubtreeNeedsPaintPropertyUpdate(); | 1284 context.force_subtree_update |= object.SubtreeNeedsPaintPropertyUpdate(); |
| 1276 } | 1285 } |
| 1277 | 1286 |
| 1278 if (object.CanContainAbsolutePositionObjects()) | 1287 if (object.CanContainAbsolutePositionObjects()) |
| 1279 context.container_for_absolute_position = &object; | 1288 context.container_for_absolute_position = &object; |
| 1280 } | 1289 } |
| 1281 | 1290 |
| 1282 } // namespace blink | 1291 } // namespace blink |
| OLD | NEW |