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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp

Issue 2859483004: Revert of Don't pass subpixel offsets through non-translation transforms (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 (object.IsLayoutView() || 258 (object.IsLayoutView() ||
259 context.current.paint_offset != LayoutPoint())) { 259 context.current.paint_offset != LayoutPoint())) {
260 auto& properties = *object.GetMutableForPainting().PaintProperties(); 260 auto& properties = *object.GetMutableForPainting().PaintProperties();
261 // We should use the same subpixel paint offset values for snapping 261 // We should use the same subpixel paint offset values for snapping
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 LayoutPoint used_paint_offset(context.current.paint_offset.X().Round(), 268 IntPoint rounded_paint_offset =
269 context.current.paint_offset.Y().Round()); 269 RoundedIntPoint(context.current.paint_offset);
270 LayoutPoint remainder_paint_offset = 270 LayoutPoint fractional_paint_offset =
271 LayoutPoint(context.current.paint_offset - used_paint_offset); 271 LayoutPoint(context.current.paint_offset - rounded_paint_offset);
272
273 if (remainder_paint_offset != LayoutPoint()) {
274 // However, if the object has a non-translation transform, we can't pass
275 // subpixel offsets through the transform to descendants.
276 TransformationMatrix matrix;
277 object.StyleRef().ApplyTransform(
278 matrix, LayoutSize(), ComputedStyle::kExcludeTransformOrigin,
279 ComputedStyle::kIncludeMotionPath,
280 ComputedStyle::kIncludeIndependentTransformProperties);
281 if (!matrix.IsIdentityOrTranslation()) {
282 remainder_paint_offset = LayoutPoint();
283 used_paint_offset = context.current.paint_offset;
284 }
285 }
286 272
287 force_subtree_update |= properties.UpdatePaintOffsetTranslation( 273 force_subtree_update |= properties.UpdatePaintOffsetTranslation(
288 context.current.transform, 274 context.current.transform,
289 TransformationMatrix().Translate(used_paint_offset.X().ToDouble(), 275 TransformationMatrix().Translate(rounded_paint_offset.X(),
290 used_paint_offset.Y().ToDouble()), 276 rounded_paint_offset.Y()),
291 FloatPoint3D(), context.current.should_flatten_inherited_transform, 277 FloatPoint3D(), context.current.should_flatten_inherited_transform,
292 context.current.rendering_context_id); 278 context.current.rendering_context_id);
293 279
294 context.current.transform = properties.PaintOffsetTranslation(); 280 context.current.transform = properties.PaintOffsetTranslation();
295 context.current.paint_offset = remainder_paint_offset; 281 context.current.paint_offset = fractional_paint_offset;
296 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() && 282 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&
297 object.IsLayoutView()) { 283 object.IsLayoutView()) {
298 context.absolute_position.transform = properties.PaintOffsetTranslation(); 284 context.absolute_position.transform = properties.PaintOffsetTranslation();
299 context.fixed_position.transform = properties.PaintOffsetTranslation(); 285 context.fixed_position.transform = properties.PaintOffsetTranslation();
300 context.absolute_position.paint_offset = remainder_paint_offset; 286 context.absolute_position.paint_offset = LayoutPoint();
301 context.fixed_position.paint_offset = remainder_paint_offset; 287 context.fixed_position.paint_offset = LayoutPoint();
302 } 288 }
303 } else { 289 } else {
304 if (auto* properties = object.GetMutableForPainting().PaintProperties()) 290 if (auto* properties = object.GetMutableForPainting().PaintProperties())
305 force_subtree_update |= properties->ClearPaintOffsetTranslation(); 291 force_subtree_update |= properties->ClearPaintOffsetTranslation();
306 } 292 }
307 } 293 }
308 294
309 static bool NeedsTransformForNonRootSVG(const LayoutObject& object) { 295 static bool NeedsTransformForNonRootSVG(const LayoutObject& object) {
310 // TODO(pdr): Check for the presence of a transform instead of the value. 296 // TODO(pdr): Check for the presence of a transform instead of the value.
311 // Checking for an identity matrix will cause the property tree structure 297 // Checking for an identity matrix will cause the property tree structure
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 context.force_subtree_update); 1270 context.force_subtree_update);
1285 1271
1286 context.force_subtree_update |= object.SubtreeNeedsPaintPropertyUpdate(); 1272 context.force_subtree_update |= object.SubtreeNeedsPaintPropertyUpdate();
1287 } 1273 }
1288 1274
1289 if (object.CanContainAbsolutePositionObjects()) 1275 if (object.CanContainAbsolutePositionObjects())
1290 context.container_for_absolute_position = &object; 1276 context.container_for_absolute_position = &object;
1291 } 1277 }
1292 1278
1293 } // namespace blink 1279 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698