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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 if (auto* existing_content_clip = frame_view.ContentClip()) { | 65 if (auto* existing_content_clip = frame_view.ContentClip()) { |
| 66 existing_content_clip->Update(std::move(parent), | 66 existing_content_clip->Update(std::move(parent), |
| 67 std::move(local_transform_space), clip_rect); | 67 std::move(local_transform_space), clip_rect); |
| 68 return false; | 68 return false; |
| 69 } | 69 } |
| 70 frame_view.SetContentClip(ClipPaintPropertyNode::Create( | 70 frame_view.SetContentClip(ClipPaintPropertyNode::Create( |
| 71 std::move(parent), std::move(local_transform_space), clip_rect)); | 71 std::move(parent), std::move(local_transform_space), clip_rect)); |
| 72 return true; | 72 return true; |
| 73 } | 73 } |
| 74 | 74 |
| 75 static CompositorElementId CreateDomNodeBasedCompositorElementId( | 75 static CompositorElementId CreateDomNodeBasedCompositorElementId( |
|
wkorman
2017/05/18 00:45:58
Suggest rename to CreatePaintLayerBasedCompositorE
chrishtr
2017/05/18 01:25:47
Done.
| |
| 76 const LayoutObject& object) { | 76 const LayoutObject& object) { |
| 77 DCHECK(object.IsBoxModelObject() && object.HasLayer()); | |
| 77 // TODO(wkorman): Centralize this implementation with similar across | 78 // TODO(wkorman): Centralize this implementation with similar across |
|
wkorman
2017/05/18 00:45:58
Maybe we can remove this now. It's not looking to
chrishtr
2017/05/18 01:25:47
Done.
| |
| 78 // animation, scrolling and compositing logic. | 79 // animation, scrolling and compositing logic. |
| 79 return CompositorElementIdFromDOMNodeId( | 80 return CompositorElementIdFromPaintLayerId( |
| 80 DOMNodeIds::IdForNode(object.GetNode()), | 81 ToLayoutBoxModelObject(object).Layer()->UniqueId(), |
| 81 CompositorElementIdNamespace::kPrimary); | 82 CompositorElementIdNamespace::kPrimary); |
| 82 } | 83 } |
| 83 | 84 |
| 84 // True if a new property was created or a main thread scrolling reason changed | 85 // True if a new property was created or a main thread scrolling reason changed |
| 85 // (which can affect descendants), false if an existing one was updated. | 86 // (which can affect descendants), false if an existing one was updated. |
| 86 static bool UpdateScrollTranslation( | 87 static bool UpdateScrollTranslation( |
| 87 FrameView& frame_view, | 88 FrameView& frame_view, |
| 88 PassRefPtr<const TransformPaintPropertyNode> parent, | 89 PassRefPtr<const TransformPaintPropertyNode> parent, |
| 89 const TransformationMatrix& matrix, | 90 const TransformationMatrix& matrix, |
| 90 const FloatPoint3D& origin, | 91 const FloatPoint3D& origin, |
| (...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1188 NeedsFilter(object) || NeedsCssClip(object) || | 1189 NeedsFilter(object) || NeedsCssClip(object) || |
| 1189 NeedsScrollbarPaintOffset(object) || NeedsOverflowClip(object) || | 1190 NeedsScrollbarPaintOffset(object) || NeedsOverflowClip(object) || |
| 1190 NeedsPerspective(object) || NeedsSVGLocalToBorderBoxTransform(object) || | 1191 NeedsPerspective(object) || NeedsSVGLocalToBorderBoxTransform(object) || |
| 1191 NeedsScrollTranslation(object) || NeedsCssClipFixedPosition(object); | 1192 NeedsScrollTranslation(object) || NeedsCssClipFixedPosition(object); |
| 1192 | 1193 |
| 1193 bool had_paint_properties = object.PaintProperties(); | 1194 bool had_paint_properties = object.PaintProperties(); |
| 1194 | 1195 |
| 1195 if (needs_paint_properties && !had_paint_properties) { | 1196 if (needs_paint_properties && !had_paint_properties) { |
| 1196 ObjectPaintProperties& paint_properties = | 1197 ObjectPaintProperties& paint_properties = |
| 1197 object.GetMutableForPainting().EnsurePaintProperties(); | 1198 object.GetMutableForPainting().EnsurePaintProperties(); |
| 1198 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 1199 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && object.HasLayer()) { |
|
wkorman
2017/05/18 00:45:58
This means we will stop setting compositor element
chrishtr
2017/05/18 01:25:47
No, because transforms and effects all induce Pain
| |
| 1199 paint_properties.SetCompositorElementId( | 1200 paint_properties.SetCompositorElementId( |
| 1200 CreateDomNodeBasedCompositorElementId(object)); | 1201 CreateDomNodeBasedCompositorElementId(object)); |
| 1201 } | 1202 } |
| 1202 } else if (!needs_paint_properties && had_paint_properties) { | 1203 } else if (!needs_paint_properties && had_paint_properties) { |
| 1203 object.GetMutableForPainting().ClearPaintProperties(); | 1204 object.GetMutableForPainting().ClearPaintProperties(); |
| 1204 full_context.force_subtree_update = true; | 1205 full_context.force_subtree_update = true; |
| 1205 } | 1206 } |
| 1206 } | 1207 } |
| 1207 | 1208 |
| 1208 static inline bool ObjectTypeMightNeedPaintProperties( | 1209 static inline bool ObjectTypeMightNeedPaintProperties( |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1280 context.force_subtree_update); | 1281 context.force_subtree_update); |
| 1281 | 1282 |
| 1282 context.force_subtree_update |= object.SubtreeNeedsPaintPropertyUpdate(); | 1283 context.force_subtree_update |= object.SubtreeNeedsPaintPropertyUpdate(); |
| 1283 } | 1284 } |
| 1284 | 1285 |
| 1285 if (object.CanContainAbsolutePositionObjects()) | 1286 if (object.CanContainAbsolutePositionObjects()) |
| 1286 context.container_for_absolute_position = &object; | 1287 context.container_for_absolute_position = &object; |
| 1287 } | 1288 } |
| 1288 | 1289 |
| 1289 } // namespace blink | 1290 } // namespace blink |
| OLD | NEW |