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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp

Issue 1805823002: [SPv2] Fix PaintArtifactCompositor clip layer origin undo order (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "platform/graphics/compositing/PaintArtifactCompositor.h" 5 #include "platform/graphics/compositing/PaintArtifactCompositor.h"
6 6
7 #include "cc/layers/layer.h" 7 #include "cc/layers/layer.h"
8 #include "platform/RuntimeEnabledFeatures.h" 8 #include "platform/RuntimeEnabledFeatures.h"
9 #include "platform/graphics/paint/PaintArtifact.h" 9 #include "platform/graphics/paint/PaintArtifact.h"
10 #include "platform/testing/PictureMatchers.h" 10 #include "platform/testing/PictureMatchers.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 { 137 {
138 const cc::Layer* layer = rootLayer()->child_at(1); 138 const cc::Layer* layer = rootLayer()->child_at(1);
139 EXPECT_THAT(layer->GetPicture(), 139 EXPECT_THAT(layer->GetPicture(),
140 Pointee(drawsRectangle(FloatRect(0, 0, 300, 200), Color::black))); 140 Pointee(drawsRectangle(FloatRect(0, 0, 300, 200), Color::black)));
141 gfx::RectF mappedRect(0, 0, 300, 200); 141 gfx::RectF mappedRect(0, 0, 300, 200);
142 layer->transform().TransformRect(&mappedRect); 142 layer->transform().TransformRect(&mappedRect);
143 EXPECT_EQ(gfx::RectF(0, 0, 600, 400), mappedRect); 143 EXPECT_EQ(gfx::RectF(0, 0, 600, 400), mappedRect);
144 } 144 }
145 } 145 }
146 146
147 TEST_F(PaintArtifactCompositorTest, LayerOriginCancellation)
148 {
149 RefPtr<ClipPaintPropertyNode> clip = ClipPaintPropertyNode::create(
150 nullptr, FloatRoundedRect(100, 100, 100, 100));
151 RefPtr<TransformPaintPropertyNode> transform = TransformPaintPropertyNode::c reate(
152 TransformationMatrix().scale(2), FloatPoint3D());
153
154 TestPaintArtifact artifact;
155 artifact.chunk(transform, clip, nullptr)
156 .rectDrawing(FloatRect(12, 34, 56, 78), Color::white);
157 update(artifact.build());
158
159 ASSERT_EQ(1u, rootLayer()->children().size());
160 cc::Layer* clipLayer = rootLayer()->child_at(0);
161 EXPECT_EQ(gfx::Size(100, 100), clipLayer->bounds());
162 EXPECT_EQ(translation(100, 100), clipLayer->transform());
163 EXPECT_TRUE(clipLayer->masks_to_bounds());
164
165 ASSERT_EQ(1u, clipLayer->children().size());
166 cc::Layer* layer = clipLayer->child_at(0);
167 EXPECT_EQ(gfx::Size(56, 78), layer->bounds());
168 gfx::Transform expectedTransform;
169 expectedTransform.Translate(-100, -100);
170 expectedTransform.Scale(2, 2);
171 expectedTransform.Translate(12, 34);
172 EXPECT_EQ(expectedTransform, layer->transform());
173 }
174
147 TEST_F(PaintArtifactCompositorTest, OneClip) 175 TEST_F(PaintArtifactCompositorTest, OneClip)
148 { 176 {
149 RefPtr<ClipPaintPropertyNode> clip = ClipPaintPropertyNode::create( 177 RefPtr<ClipPaintPropertyNode> clip = ClipPaintPropertyNode::create(
150 nullptr, FloatRoundedRect(100, 100, 300, 200)); 178 nullptr, FloatRoundedRect(100, 100, 300, 200));
151 179
152 TestPaintArtifact artifact; 180 TestPaintArtifact artifact;
153 artifact.chunk(nullptr, clip, nullptr) 181 artifact.chunk(nullptr, clip, nullptr)
154 .rectDrawing(FloatRect(220, 80, 300, 200), Color::black); 182 .rectDrawing(FloatRect(220, 80, 300, 200), Color::black);
155 update(artifact.build()); 183 update(artifact.build());
156 184
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 update(artifact.build()); 344 update(artifact.build());
317 345
318 ASSERT_EQ(1u, rootLayer()->children().size()); 346 ASSERT_EQ(1u, rootLayer()->children().size());
319 EXPECT_EQ(layer, rootLayer()->child_at(0)); 347 EXPECT_EQ(layer, rootLayer()->child_at(0));
320 EXPECT_EQ(gfx::Size(400, 300), layer->bounds()); 348 EXPECT_EQ(gfx::Size(400, 300), layer->bounds());
321 EXPECT_EQ(translation(50, 100), layer->transform()); 349 EXPECT_EQ(translation(50, 100), layer->transform());
322 } 350 }
323 351
324 } // namespace 352 } // namespace
325 } // namespace blink 353 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698