Chromium Code Reviews| 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 "config.h" | 5 #include "config.h" |
| 6 #include "web/PageOverlay.h" | 6 #include "web/PageOverlay.h" |
| 7 | 7 |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/layout/LayoutView.h" | 9 #include "core/layout/LayoutView.h" |
| 10 #include "platform/graphics/Color.h" | 10 #include "platform/graphics/Color.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 MockCanvas canvas(viewportWidth, viewportHeight); | 192 MockCanvas canvas(viewportWidth, viewportHeight); |
| 193 EXPECT_CALL(canvas, onDrawRect(_, _)).Times(AtLeast(0)); | 193 EXPECT_CALL(canvas, onDrawRect(_, _)).Times(AtLeast(0)); |
| 194 EXPECT_CALL(canvas, onDrawRect(SkRect::MakeWH(viewportWidth, viewportHeight) , Property(&SkPaint::getColor, SK_ColorYELLOW))); | 194 EXPECT_CALL(canvas, onDrawRect(SkRect::MakeWH(viewportWidth, viewportHeight) , Property(&SkPaint::getColor, SK_ColorYELLOW))); |
| 195 | 195 |
| 196 GraphicsLayer* graphicsLayer = webViewImpl()->pageOverlays()->graphicsLayerF orTesting(); | 196 GraphicsLayer* graphicsLayer = webViewImpl()->pageOverlays()->graphicsLayerF orTesting(); |
| 197 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 197 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
| 198 // If slimming paint is on, we paint the layer with a null canvas to get | 198 // If slimming paint is on, we paint the layer with a null canvas to get |
| 199 // a display list, and then replay that onto the mock canvas for | 199 // a display list, and then replay that onto the mock canvas for |
| 200 // examination. This is about as close to the real path as we can easily | 200 // examination. This is about as close to the real path as we can easily |
| 201 // get. | 201 // get. |
| 202 WebRect rect(0, 0, viewportWidth, viewportHeight); | |
| 202 GraphicsContext graphicsContext(graphicsLayer->displayItemList()); | 203 GraphicsContext graphicsContext(graphicsLayer->displayItemList()); |
| 203 graphicsLayer->paint(graphicsContext, WebRect(0, 0, viewportWidth, viewp ortHeight)); | 204 graphicsLayer->paint(graphicsContext, WebRect(0, 0, viewportWidth, viewp ortHeight)); |
|
wkorman
2015/06/06 05:02:46
Looks like can use rect here.
| |
| 204 | 205 |
| 205 OwnPtr<GraphicsContext> replayContext = GraphicsContext::deprecatedCreat eWithCanvas(&canvas); | 206 graphicsContext.beginRecording(IntRect(rect)); |
|
chrishtr
2015/06/06 00:34:02
These lines of code are identical to what is in Sk
chrishtr
2015/06/06 05:13:04
Done.
| |
| 206 graphicsLayer->displayItemList()->commitNewDisplayItemsAndReplay(*replay Context); | 207 graphicsLayer->displayItemList()->commitNewDisplayItemsAndReplay(graphic sContext); |
| 208 graphicsContext.endRecording()->playback(&canvas); | |
| 207 } else { | 209 } else { |
| 208 OwnPtr<GraphicsContext> graphicsContext = GraphicsContext::deprecatedCre ateWithCanvas(&canvas); | 210 OwnPtr<GraphicsContext> graphicsContext = GraphicsContext::deprecatedCre ateWithCanvas(&canvas); |
| 209 graphicsLayer->paint(*graphicsContext, WebRect(0, 0, viewportWidth, view portHeight)); | 211 graphicsLayer->paint(*graphicsContext, WebRect(0, 0, viewportWidth, view portHeight)); |
| 210 } | 212 } |
| 211 } | 213 } |
| 212 | 214 |
| 213 TEST_F(PageOverlayTest, SimpleCanvasOverlay_AcceleratedCompositing_NoSlimmingPai nt) | 215 TEST_F(PageOverlayTest, SimpleCanvasOverlay_AcceleratedCompositing_NoSlimmingPai nt) |
| 214 { | 216 { |
| 215 SlimmingPaintScope slimmingPaintEnabled(false); | 217 SlimmingPaintScope slimmingPaintEnabled(false); |
| 216 runPageOverlayTestWithAcceleratedCompositing<SimpleCanvasOverlay>(); | 218 runPageOverlayTestWithAcceleratedCompositing<SimpleCanvasOverlay>(); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 229 } | 231 } |
| 230 | 232 |
| 231 TEST_F(PageOverlayTest, PrivateGraphicsContextOverlay_AcceleratedCompositing_Sli mmingPaint) | 233 TEST_F(PageOverlayTest, PrivateGraphicsContextOverlay_AcceleratedCompositing_Sli mmingPaint) |
| 232 { | 234 { |
| 233 SlimmingPaintScope slimmingPaintEnabled(true); | 235 SlimmingPaintScope slimmingPaintEnabled(true); |
| 234 runPageOverlayTestWithAcceleratedCompositing<PrivateGraphicsContextOverlay>( ); | 236 runPageOverlayTestWithAcceleratedCompositing<PrivateGraphicsContextOverlay>( ); |
| 235 } | 237 } |
| 236 | 238 |
| 237 } // namespace | 239 } // namespace |
| 238 } // namespace blink | 240 } // namespace blink |
| OLD | NEW |