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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/PaintArtifactToSkCanvasTest.cpp

Issue 1906843002: Remove use of SkCanvas::LayerIter in getCanvasClipAsRegion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | 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 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 "platform/graphics/paint/PaintArtifactToSkCanvas.h" 5 #include "platform/graphics/paint/PaintArtifactToSkCanvas.h"
6 6
7 #include "platform/RuntimeEnabledFeatures.h" 7 #include "platform/RuntimeEnabledFeatures.h"
8 #include "platform/graphics/paint/DisplayItem.h" 8 #include "platform/graphics/paint/DisplayItem.h"
9 #include "platform/graphics/paint/DrawingDisplayItem.h" 9 #include "platform/graphics/paint/DrawingDisplayItem.h"
10 #include "platform/graphics/paint/PaintArtifact.h" 10 #include "platform/graphics/paint/PaintArtifact.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 TestPaintArtifact artifact; 191 TestPaintArtifact artifact;
192 artifact.chunk(nullptr, nullptr, opacityEffectB.get()) 192 artifact.chunk(nullptr, nullptr, opacityEffectB.get())
193 .rectDrawing(FloatRect(0, 0, 300, 200), SK_ColorRED); 193 .rectDrawing(FloatRect(0, 0, 300, 200), SK_ColorRED);
194 artifact.chunk(nullptr, nullptr, opacityEffectD.get()) 194 artifact.chunk(nullptr, nullptr, opacityEffectD.get())
195 .rectDrawing(FloatRect(0, 0, 300, 200), SK_ColorBLUE); 195 .rectDrawing(FloatRect(0, 0, 300, 200), SK_ColorBLUE);
196 paintArtifactToSkCanvas(artifact.build(), &canvas); 196 paintArtifactToSkCanvas(artifact.build(), &canvas);
197 } 197 }
198 198
199 static SkRegion getCanvasClipAsRegion(SkCanvas* canvas) 199 static SkRegion getCanvasClipAsRegion(SkCanvas* canvas)
200 { 200 {
201 return SkCanvas::LayerIter(canvas, false).clip(); 201 SkIRect clipRect;
202 canvas->getClipDeviceBounds(&clipRect);
203
204 SkRegion clipRegion;
205 clipRegion.setRect(clipRect);
206 return clipRegion;
202 } 207 }
203 208
204 TEST_F(PaintArtifactToSkCanvasTest, ClipWithScrollEscaping) 209 TEST_F(PaintArtifactToSkCanvasTest, ClipWithScrollEscaping)
205 { 210 {
206 // The setup is to simulate scenario similar to this html: 211 // The setup is to simulate scenario similar to this html:
207 // <div style="position:absolute; left:0; top:0; clip:rect(200px,200px,300px ,100px);"> 212 // <div style="position:absolute; left:0; top:0; clip:rect(200px,200px,300px ,100px);">
208 // <div style="position:fixed; left:150px; top:150px; width:100px; heigh t:100px; overflow:hidden;"> 213 // <div style="position:fixed; left:150px; top:150px; width:100px; heigh t:100px; overflow:hidden;">
209 // client1 214 // client1
210 // </div> 215 // </div>
211 // </div> 216 // </div>
(...skipping 20 matching lines...) Expand all
232 ResultOf(&getCanvasClipAsRegion, Eq(totalClip)))); 237 ResultOf(&getCanvasClipAsRegion, Eq(totalClip))));
233 238
234 TestPaintArtifact artifact; 239 TestPaintArtifact artifact;
235 artifact.chunk(nullptr, clip2.get(), nullptr) 240 artifact.chunk(nullptr, clip2.get(), nullptr)
236 .rectDrawing(FloatRect(0, 0, 300, 200), SK_ColorRED); 241 .rectDrawing(FloatRect(0, 0, 300, 200), SK_ColorRED);
237 paintArtifactToSkCanvas(artifact.build(), &canvas); 242 paintArtifactToSkCanvas(artifact.build(), &canvas);
238 } 243 }
239 244
240 } // namespace 245 } // namespace
241 } // namespace blink 246 } // namespace blink
OLDNEW
« 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