| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 // regardless of whether a transform is present. If there is a transform | 262 // regardless of whether a transform is present. If there is a transform |
| 263 // we round the paint offset but keep around the residual fractional | 263 // we round the paint offset but keep around the residual fractional |
| 264 // component for the transformed content to paint with. In spv1 this was | 264 // component for the transformed content to paint with. In spv1 this was |
| 265 // called "subpixel accumulation". For more information, see | 265 // called "subpixel accumulation". For more information, see |
| 266 // PaintLayer::subpixelAccumulation() and | 266 // PaintLayer::subpixelAccumulation() and |
| 267 // PaintLayerPainter::paintFragmentByApplyingTransform. | 267 // PaintLayerPainter::paintFragmentByApplyingTransform. |
| 268 IntPoint rounded_paint_offset = | 268 IntPoint rounded_paint_offset = |
| 269 RoundedIntPoint(context.current.paint_offset); | 269 RoundedIntPoint(context.current.paint_offset); |
| 270 LayoutPoint fractional_paint_offset = | 270 LayoutPoint fractional_paint_offset = |
| 271 LayoutPoint(context.current.paint_offset - rounded_paint_offset); | 271 LayoutPoint(context.current.paint_offset - rounded_paint_offset); |
| 272 if (fractional_paint_offset != LayoutPoint()) { |
| 273 // If the object has a non-translation transform, discard the fractional |
| 274 // paint offset which can't be transformed by the transform. |
| 275 TransformationMatrix matrix; |
| 276 object.StyleRef().ApplyTransform( |
| 277 matrix, LayoutSize(), ComputedStyle::kExcludeTransformOrigin, |
| 278 ComputedStyle::kIncludeMotionPath, |
| 279 ComputedStyle::kIncludeIndependentTransformProperties); |
| 280 if (!matrix.IsIdentityOrTranslation()) |
| 281 fractional_paint_offset = LayoutPoint(); |
| 282 } |
| 272 | 283 |
| 273 force_subtree_update |= properties.UpdatePaintOffsetTranslation( | 284 force_subtree_update |= properties.UpdatePaintOffsetTranslation( |
| 274 context.current.transform, | 285 context.current.transform, |
| 275 TransformationMatrix().Translate(rounded_paint_offset.X(), | 286 TransformationMatrix().Translate(rounded_paint_offset.X(), |
| 276 rounded_paint_offset.Y()), | 287 rounded_paint_offset.Y()), |
| 277 FloatPoint3D(), context.current.should_flatten_inherited_transform, | 288 FloatPoint3D(), context.current.should_flatten_inherited_transform, |
| 278 context.current.rendering_context_id); | 289 context.current.rendering_context_id); |
| 279 | 290 |
| 280 context.current.transform = properties.PaintOffsetTranslation(); | 291 context.current.transform = properties.PaintOffsetTranslation(); |
| 281 context.current.paint_offset = fractional_paint_offset; | 292 context.current.paint_offset = fractional_paint_offset; |
| 282 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() && | 293 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() && |
| 283 object.IsLayoutView()) { | 294 object.IsLayoutView()) { |
| 284 context.absolute_position.transform = properties.PaintOffsetTranslation(); | 295 context.absolute_position.transform = properties.PaintOffsetTranslation(); |
| 285 context.fixed_position.transform = properties.PaintOffsetTranslation(); | 296 context.fixed_position.transform = properties.PaintOffsetTranslation(); |
| 286 context.absolute_position.paint_offset = LayoutPoint(); | 297 context.absolute_position.paint_offset = fractional_paint_offset; |
| 287 context.fixed_position.paint_offset = LayoutPoint(); | 298 context.fixed_position.paint_offset = fractional_paint_offset; |
| 288 } | 299 } |
| 289 } else { | 300 } else { |
| 290 if (auto* properties = object.GetMutableForPainting().PaintProperties()) | 301 if (auto* properties = object.GetMutableForPainting().PaintProperties()) |
| 291 force_subtree_update |= properties->ClearPaintOffsetTranslation(); | 302 force_subtree_update |= properties->ClearPaintOffsetTranslation(); |
| 292 } | 303 } |
| 293 } | 304 } |
| 294 | 305 |
| 295 static bool NeedsTransformForNonRootSVG(const LayoutObject& object) { | 306 static bool NeedsTransformForNonRootSVG(const LayoutObject& object) { |
| 296 // TODO(pdr): Check for the presence of a transform instead of the value. | 307 // TODO(pdr): Check for the presence of a transform instead of the value. |
| 297 // Checking for an identity matrix will cause the property tree structure | 308 // Checking for an identity matrix will cause the property tree structure |
| (...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 context.force_subtree_update); | 1281 context.force_subtree_update); |
| 1271 | 1282 |
| 1272 context.force_subtree_update |= object.SubtreeNeedsPaintPropertyUpdate(); | 1283 context.force_subtree_update |= object.SubtreeNeedsPaintPropertyUpdate(); |
| 1273 } | 1284 } |
| 1274 | 1285 |
| 1275 if (object.CanContainAbsolutePositionObjects()) | 1286 if (object.CanContainAbsolutePositionObjects()) |
| 1276 context.container_for_absolute_position = &object; | 1287 context.container_for_absolute_position = &object; |
| 1277 } | 1288 } |
| 1278 | 1289 |
| 1279 } // namespace blink | 1290 } // namespace blink |
| OLD | NEW |