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

Unified Diff: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp

Issue 1782713003: [SPv2] Reverse PaintArtifactCompositor clip layer origin undo order (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: do the right thing Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
index 67b1e5f8539825b2258a3d439ce5a11d2b387c46..49d990afa08cb8f32770c2f5d757f84402a69cb2 100644
--- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
+++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
@@ -177,11 +177,13 @@ scoped_refptr<cc::Layer> createClipLayer(const ClipPaintPropertyNode* node)
// necessarily true, and this should be fixed.
gfx::Transform transform = transformToTransformSpace(localTransformSpace(node), localTransformSpace(node->parent()));
gfx::Vector2dF offset = clipRect.OffsetFromOrigin();
+ transform.Translate(offset.x(), offset.y());
if (node->parent()) {
FloatPoint offsetDueToParentClipOffset = node->parent()->clipRect().rect().location();
- offset -= gfx::Vector2dF(offsetDueToParentClipOffset.x(), offsetDueToParentClipOffset.y());
+ gfx::Transform undoClipOffset;
+ undoClipOffset.Translate(-offsetDueToParentClipOffset.x(), -offsetDueToParentClipOffset.y());
+ transform.PreconcatTransform(undoClipOffset);
}
- transform.Translate(offset.x(), offset.y());
scoped_refptr<cc::Layer> layer = cc::Layer::Create(cc::LayerSettings());
layer->SetIsDrawable(false);
@@ -293,13 +295,16 @@ scoped_refptr<cc::Layer> PaintArtifactCompositor::layerForPaintChunk(const Paint
// this layer's transform space (whereas layer position applies in its
// parent's transform space).
gfx::Vector2dF offset = gfx::PointF(combinedBounds.origin()).OffsetFromOrigin();
+ transform.Translate(offset.x(), offset.y());
+
+ // If a clip was applied, its origin needs to be cancelled out in
+ // this transform.
if (const auto* clip = paintChunk.properties.clip.get()) {
- // If a clip was applied, its origin needs to be cancelled out in
- // this transform.
FloatPoint offsetDueToClipOffset = clip->clipRect().rect().location();
- offset -= gfx::Vector2dF(offsetDueToClipOffset.x(), offsetDueToClipOffset.y());
+ gfx::Transform undoClipOffset;
+ undoClipOffset.Translate(-offsetDueToClipOffset.x(), -offsetDueToClipOffset.y());
+ transform.PreconcatTransform(undoClipOffset);
}
- transform.Translate(offset.x(), offset.y());
scoped_refptr<cc::PictureLayer> layer = cc::PictureLayer::Create(cc::LayerSettings(), contentLayerClient.get());
layer->SetBounds(combinedBounds.size());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698