| 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 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1062 } | 1062 } |
| 1063 object.getMutableForPainting().setPaintOffset(context.current.paintOffset); | 1063 object.getMutableForPainting().setPaintOffset(context.current.paintOffset); |
| 1064 } | 1064 } |
| 1065 | 1065 |
| 1066 if (!object.isBox()) | 1066 if (!object.isBox()) |
| 1067 return; | 1067 return; |
| 1068 const LayoutBox& box = toLayoutBox(object); | 1068 const LayoutBox& box = toLayoutBox(object); |
| 1069 if (box.size() == box.previousSize()) | 1069 if (box.size() == box.previousSize()) |
| 1070 return; | 1070 return; |
| 1071 | 1071 |
| 1072 // CSS mask and clip-path comes with an implicit clip to the border box. |
| 1073 // Currently only SPv2 generate and take advantage of those. |
| 1074 const bool boxGeneratesPropertyNodesForMaskAndClipPath = |
| 1075 RuntimeEnabledFeatures::slimmingPaintV2Enabled() && |
| 1076 (box.hasMask() || box.hasClipPath()); |
| 1072 // The overflow clip paint property depends on the border box rect through | 1077 // The overflow clip paint property depends on the border box rect through |
| 1073 // overflowClipRect(). The border box rect's size equals the frame rect's | 1078 // overflowClipRect(). The border box rect's size equals the frame rect's |
| 1074 // size so we trigger a paint property update when the frame rect changes. | 1079 // size so we trigger a paint property update when the frame rect changes. |
| 1075 if (box.shouldClipOverflow() || | 1080 if (box.shouldClipOverflow() || |
| 1076 // The used value of CSS clip may depend on size of the box, e.g. for | 1081 // The used value of CSS clip may depend on size of the box, e.g. for |
| 1077 // clip: rect(auto auto auto -5px). | 1082 // clip: rect(auto auto auto -5px). |
| 1078 box.hasClip() || | 1083 box.hasClip() || |
| 1079 // Relative lengths (e.g., percentage values) in transform, perspective, | 1084 // Relative lengths (e.g., percentage values) in transform, perspective, |
| 1080 // transform-origin, and perspective-origin can depend on the size of the | 1085 // transform-origin, and perspective-origin can depend on the size of the |
| 1081 // frame rect, so force a property update if it changes. TODO(pdr): We | 1086 // frame rect, so force a property update if it changes. TODO(pdr): We |
| 1082 // only need to update properties if there are relative lengths. | 1087 // only need to update properties if there are relative lengths. |
| 1083 box.styleRef().hasTransform() || box.styleRef().hasPerspective()) | 1088 box.styleRef().hasTransform() || box.styleRef().hasPerspective() || |
| 1089 boxGeneratesPropertyNodesForMaskAndClipPath) |
| 1084 box.getMutableForPainting().setNeedsPaintPropertyUpdate(); | 1090 box.getMutableForPainting().setNeedsPaintPropertyUpdate(); |
| 1085 } | 1091 } |
| 1086 | 1092 |
| 1087 void PaintPropertyTreeBuilder::updatePropertiesForSelf( | 1093 void PaintPropertyTreeBuilder::updatePropertiesForSelf( |
| 1088 const LayoutObject& object, | 1094 const LayoutObject& object, |
| 1089 PaintPropertyTreeBuilderContext& context) { | 1095 PaintPropertyTreeBuilderContext& context) { |
| 1090 // This is not in FindObjectPropertiesNeedingUpdateScope because paint offset | 1096 // This is not in FindObjectPropertiesNeedingUpdateScope because paint offset |
| 1091 // can change without needsPaintPropertyUpdate. | 1097 // can change without needsPaintPropertyUpdate. |
| 1092 updateForObjectLocationAndSize(object, context); | 1098 updateForObjectLocationAndSize(object, context); |
| 1093 | 1099 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1121 updateOverflowClip(object, context); | 1127 updateOverflowClip(object, context); |
| 1122 updatePerspective(object, context); | 1128 updatePerspective(object, context); |
| 1123 updateSvgLocalToBorderBoxTransform(object, context); | 1129 updateSvgLocalToBorderBoxTransform(object, context); |
| 1124 updateScrollAndScrollTranslation(object, context); | 1130 updateScrollAndScrollTranslation(object, context); |
| 1125 updateOutOfFlowContext(object, context); | 1131 updateOutOfFlowContext(object, context); |
| 1126 | 1132 |
| 1127 context.forceSubtreeUpdate |= object.subtreeNeedsPaintPropertyUpdate(); | 1133 context.forceSubtreeUpdate |= object.subtreeNeedsPaintPropertyUpdate(); |
| 1128 } | 1134 } |
| 1129 | 1135 |
| 1130 } // namespace blink | 1136 } // namespace blink |
| OLD | NEW |