OLD | NEW |
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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 SkIRect clipRect; | 209 SkIRect clipRect; |
210 canvas->getClipDeviceBounds(&clipRect); | 210 canvas->getClipDeviceBounds(&clipRect); |
211 | 211 |
212 SkRegion clipRegion; | 212 SkRegion clipRegion; |
213 clipRegion.setRect(clipRect); | 213 clipRegion.setRect(clipRect); |
214 return clipRegion; | 214 return clipRegion; |
215 } | 215 } |
216 | 216 |
217 TEST_F(PaintArtifactToSkCanvasTest, ClipWithScrollEscaping) { | 217 TEST_F(PaintArtifactToSkCanvasTest, ClipWithScrollEscaping) { |
218 // The setup is to simulate scenario similar to this html: | 218 // The setup is to simulate scenario similar to this html: |
219 // <div style="position:absolute; left:0; top:0; clip:rect(200px,200px,300px,1
00px);"> | 219 // <div style="position:absolute; left:0; top:0; |
220 // <div style="position:fixed; left:150px; top:150px; width:100px; height:
100px; overflow:hidden;"> | 220 // clip:rect(200px,200px,300px,100px);"> |
| 221 // <div style="position:fixed; left:150px; top:150px; width:100px; |
| 222 // height:100px; overflow:hidden;"> |
221 // client1 | 223 // client1 |
222 // </div> | 224 // </div> |
223 // </div> | 225 // </div> |
224 // <script>scrollTo(0, 100)</script> | 226 // <script>scrollTo(0, 100)</script> |
225 // The content itself will not be scrolled due to fixed positioning, | 227 // The content itself will not be scrolled due to fixed positioning, |
226 // but will be affected by some scrolled clip. | 228 // but will be affected by some scrolled clip. |
227 | 229 |
228 // Setup transform tree. | 230 // Setup transform tree. |
229 RefPtr<TransformPaintPropertyNode> transform1 = | 231 RefPtr<TransformPaintPropertyNode> transform1 = |
230 TransformPaintPropertyNode::create( | 232 TransformPaintPropertyNode::create( |
(...skipping 16 matching lines...) Expand all Loading... |
247 ResultOf(&getCanvasClipAsRegion, Eq(totalClip)))); | 249 ResultOf(&getCanvasClipAsRegion, Eq(totalClip)))); |
248 | 250 |
249 TestPaintArtifact artifact; | 251 TestPaintArtifact artifact; |
250 artifact.chunk(nullptr, clip2.get(), nullptr) | 252 artifact.chunk(nullptr, clip2.get(), nullptr) |
251 .rectDrawing(FloatRect(0, 0, 300, 200), SK_ColorRED); | 253 .rectDrawing(FloatRect(0, 0, 300, 200), SK_ColorRED); |
252 paintArtifactToSkCanvas(artifact.build(), &canvas); | 254 paintArtifactToSkCanvas(artifact.build(), &canvas); |
253 } | 255 } |
254 | 256 |
255 } // namespace | 257 } // namespace |
256 } // namespace blink | 258 } // namespace blink |
OLD | NEW |