Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Unified Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp

Issue 2847873002: Don't pass subpixel offsets through non-translation transforms (Closed)
Patch Set: - Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
index 5fabc8b6b331dd680bc71dcfeb766323e5534803..4430b0150fea03eddcb2864a791bd0fb96c5f401 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
@@ -265,26 +265,40 @@ void PaintPropertyTreeBuilder::UpdatePaintOffsetTranslation(
// called "subpixel accumulation". For more information, see
// PaintLayer::subpixelAccumulation() and
// PaintLayerPainter::paintFragmentByApplyingTransform.
- IntPoint rounded_paint_offset =
- RoundedIntPoint(context.current.paint_offset);
- LayoutPoint fractional_paint_offset =
- LayoutPoint(context.current.paint_offset - rounded_paint_offset);
+ LayoutPoint used_paint_offset(context.current.paint_offset.X().Round(),
+ context.current.paint_offset.Y().Round());
+ LayoutPoint remainder_paint_offset =
+ LayoutPoint(context.current.paint_offset - used_paint_offset);
+
+ if (remainder_paint_offset != LayoutPoint()) {
+ // However, if the object has a non-translation transform, we can't pass
+ // subpixel offsets through the transform to descendants.
+ TransformationMatrix matrix;
+ object.StyleRef().ApplyTransform(
+ matrix, LayoutSize(), ComputedStyle::kExcludeTransformOrigin,
+ ComputedStyle::kIncludeMotionPath,
+ ComputedStyle::kIncludeIndependentTransformProperties);
+ if (!matrix.IsIdentityOrTranslation()) {
+ remainder_paint_offset = LayoutPoint();
+ used_paint_offset = context.current.paint_offset;
+ }
+ }
force_subtree_update |= properties.UpdatePaintOffsetTranslation(
context.current.transform,
- TransformationMatrix().Translate(rounded_paint_offset.X(),
- rounded_paint_offset.Y()),
+ TransformationMatrix().Translate(used_paint_offset.X().ToDouble(),
+ used_paint_offset.Y().ToDouble()),
FloatPoint3D(), context.current.should_flatten_inherited_transform,
context.current.rendering_context_id);
context.current.transform = properties.PaintOffsetTranslation();
- context.current.paint_offset = fractional_paint_offset;
+ context.current.paint_offset = remainder_paint_offset;
if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&
object.IsLayoutView()) {
context.absolute_position.transform = properties.PaintOffsetTranslation();
context.fixed_position.transform = properties.PaintOffsetTranslation();
- context.absolute_position.paint_offset = LayoutPoint();
- context.fixed_position.paint_offset = LayoutPoint();
+ context.absolute_position.paint_offset = remainder_paint_offset;
+ context.fixed_position.paint_offset = remainder_paint_offset;
}
} else {
if (auto* properties = object.GetMutableForPainting().PaintProperties())

Powered by Google App Engine
This is Rietveld 408576698