Chromium Code Reviews| 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 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1185 bool needs_paint_properties = | 1185 bool needs_paint_properties = |
| 1186 NeedsPaintOffsetTranslation(object) || NeedsTransform(object) || | 1186 NeedsPaintOffsetTranslation(object) || NeedsTransform(object) || |
| 1187 NeedsEffect(object) || NeedsTransformForNonRootSVG(object) || | 1187 NeedsEffect(object) || NeedsTransformForNonRootSVG(object) || |
| 1188 NeedsFilter(object) || NeedsCssClip(object) || | 1188 NeedsFilter(object) || NeedsCssClip(object) || |
| 1189 NeedsScrollbarPaintOffset(object) || NeedsOverflowScroll(object) || | 1189 NeedsScrollbarPaintOffset(object) || NeedsOverflowScroll(object) || |
| 1190 NeedsPerspective(object) || NeedsSVGLocalToBorderBoxTransform(object) || | 1190 NeedsPerspective(object) || NeedsSVGLocalToBorderBoxTransform(object) || |
| 1191 NeedsScrollTranslation(object) || NeedsCssClipFixedPosition(object); | 1191 NeedsScrollTranslation(object) || NeedsCssClipFixedPosition(object); |
| 1192 | 1192 |
| 1193 bool had_paint_properties = object.PaintProperties(); | 1193 bool had_paint_properties = object.PaintProperties(); |
| 1194 | 1194 |
| 1195 if (needs_paint_properties) { | 1195 if (needs_paint_properties && !had_paint_properties) { |
| 1196 ObjectPaintProperties& paint_properties = | 1196 ObjectPaintProperties& paint_properties = |
| 1197 object.GetMutableForPainting().EnsurePaintProperties(); | 1197 object.GetMutableForPainting().EnsurePaintProperties(); |
| 1198 if (!had_paint_properties && | 1198 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 1199 RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | |
| 1200 paint_properties.SetCompositorElementId( | 1199 paint_properties.SetCompositorElementId( |
| 1201 CreateDomNodeBasedCompositorElementId(object)); | 1200 CreateDomNodeBasedCompositorElementId(object)); |
|
pdr.
2017/05/15 19:52:19
I think avoiding ClearPaintProperties is a nice cl
| |
| 1202 } | 1201 } |
| 1203 } else { | 1202 } else if (!needs_paint_properties && had_paint_properties) { |
| 1204 object.GetMutableForPainting().ClearPaintProperties(); | 1203 object.GetMutableForPainting().ClearPaintProperties(); |
| 1205 if (had_paint_properties) | 1204 full_context.force_subtree_update = true; |
| 1206 full_context.force_subtree_update = true; | |
| 1207 } | 1205 } |
| 1208 } | 1206 } |
| 1209 | 1207 |
| 1210 void PaintPropertyTreeBuilder::UpdatePropertiesForSelf( | 1208 void PaintPropertyTreeBuilder::UpdatePropertiesForSelf( |
| 1211 const LayoutObject& object, | 1209 const LayoutObject& object, |
| 1212 PaintPropertyTreeBuilderContext& full_context) { | 1210 PaintPropertyTreeBuilderContext& full_context) { |
| 1213 PaintPropertyTreeBuilderFragmentContext& context = full_context.fragments[0]; | 1211 PaintPropertyTreeBuilderFragmentContext& context = full_context.fragments[0]; |
| 1214 if (object.IsSVGHiddenContainer()) { | 1212 if (object.IsSVGHiddenContainer()) { |
| 1215 // SVG resources are painted within one or more other locations in the | 1213 // SVG resources are painted within one or more other locations in the |
| 1216 // SVG during paint, and hence have their own independent paint property | 1214 // SVG during paint, and hence have their own independent paint property |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1273 context.force_subtree_update); | 1271 context.force_subtree_update); |
| 1274 | 1272 |
| 1275 context.force_subtree_update |= object.SubtreeNeedsPaintPropertyUpdate(); | 1273 context.force_subtree_update |= object.SubtreeNeedsPaintPropertyUpdate(); |
| 1276 } | 1274 } |
| 1277 | 1275 |
| 1278 if (object.CanContainAbsolutePositionObjects()) | 1276 if (object.CanContainAbsolutePositionObjects()) |
| 1279 context.container_for_absolute_position = &object; | 1277 context.container_for_absolute_position = &object; |
| 1280 } | 1278 } |
| 1281 | 1279 |
| 1282 } // namespace blink | 1280 } // namespace blink |
| OLD | NEW |