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" |
11 #include "platform/graphics/GraphicsContext.h" | 11 #include "platform/graphics/GraphicsContext.h" |
12 #include "platform/graphics/paint/DisplayItemList.h" | |
13 #include "platform/graphics/paint/DrawingRecorder.h" | 12 #include "platform/graphics/paint/DrawingRecorder.h" |
| 13 #include "platform/graphics/paint/PaintController.h" |
14 #include "public/platform/Platform.h" | 14 #include "public/platform/Platform.h" |
15 #include "public/platform/WebCanvas.h" | 15 #include "public/platform/WebCanvas.h" |
16 #include "public/platform/WebThread.h" | 16 #include "public/platform/WebThread.h" |
17 #include "public/web/WebSettings.h" | 17 #include "public/web/WebSettings.h" |
18 #include "third_party/skia/include/core/SkBitmap.h" | 18 #include "third_party/skia/include/core/SkBitmap.h" |
19 #include "third_party/skia/include/core/SkCanvas.h" | 19 #include "third_party/skia/include/core/SkCanvas.h" |
20 #include "third_party/skia/include/core/SkColor.h" | 20 #include "third_party/skia/include/core/SkColor.h" |
21 #include "third_party/skia/include/core/SkPaint.h" | 21 #include "third_party/skia/include/core/SkPaint.h" |
22 #include "web/WebGraphicsContextImpl.h" | 22 #include "web/WebGraphicsContextImpl.h" |
23 #include "web/WebLocalFrameImpl.h" | 23 #include "web/WebLocalFrameImpl.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 MockCanvas canvas(viewportWidth, viewportHeight); | 146 MockCanvas canvas(viewportWidth, viewportHeight); |
147 EXPECT_CALL(canvas, onDrawRect(_, _)).Times(AtLeast(0)); | 147 EXPECT_CALL(canvas, onDrawRect(_, _)).Times(AtLeast(0)); |
148 EXPECT_CALL(canvas, onDrawRect(SkRect::MakeWH(viewportWidth, viewportHeight)
, Property(&SkPaint::getColor, SK_ColorYELLOW))); | 148 EXPECT_CALL(canvas, onDrawRect(SkRect::MakeWH(viewportWidth, viewportHeight)
, Property(&SkPaint::getColor, SK_ColorYELLOW))); |
149 | 149 |
150 GraphicsLayer* graphicsLayer = pageOverlay->graphicsLayer(); | 150 GraphicsLayer* graphicsLayer = pageOverlay->graphicsLayer(); |
151 WebRect rect(0, 0, viewportWidth, viewportHeight); | 151 WebRect rect(0, 0, viewportWidth, viewportHeight); |
152 | 152 |
153 // Paint the layer with a null canvas to get a display list, and then | 153 // Paint the layer with a null canvas to get a display list, and then |
154 // replay that onto the mock canvas for examination. | 154 // replay that onto the mock canvas for examination. |
155 GraphicsContext graphicsContext(graphicsLayer->displayItemList()); | 155 GraphicsContext graphicsContext(graphicsLayer->paintController()); |
156 graphicsLayer->paint(graphicsContext, rect); | 156 graphicsLayer->paint(graphicsContext, rect); |
157 | 157 |
158 graphicsContext.beginRecording(IntRect(rect)); | 158 graphicsContext.beginRecording(IntRect(rect)); |
159 graphicsLayer->displayItemList()->commitNewDisplayItems(); | 159 graphicsLayer->paintController()->commitNewDisplayItems(); |
160 graphicsLayer->displayItemList()->paintArtifact().replay(graphicsContext); | 160 graphicsLayer->paintController()->paintArtifact().replay(graphicsContext); |
161 graphicsContext.endRecording()->playback(&canvas); | 161 graphicsContext.endRecording()->playback(&canvas); |
162 } | 162 } |
163 | 163 |
164 TEST_F(PageOverlayTest, SimpleCanvasOverlay_AcceleratedCompositing) | 164 TEST_F(PageOverlayTest, SimpleCanvasOverlay_AcceleratedCompositing) |
165 { | 165 { |
166 runPageOverlayTestWithAcceleratedCompositing<SimpleCanvasOverlay>(); | 166 runPageOverlayTestWithAcceleratedCompositing<SimpleCanvasOverlay>(); |
167 } | 167 } |
168 | 168 |
169 TEST_F(PageOverlayTest, PrivateGraphicsContextOverlay_AcceleratedCompositing) | 169 TEST_F(PageOverlayTest, PrivateGraphicsContextOverlay_AcceleratedCompositing) |
170 { | 170 { |
171 runPageOverlayTestWithAcceleratedCompositing<PrivateGraphicsContextOverlay>(
); | 171 runPageOverlayTestWithAcceleratedCompositing<PrivateGraphicsContextOverlay>(
); |
172 } | 172 } |
173 | 173 |
174 } // namespace | 174 } // namespace |
175 } // namespace blink | 175 } // namespace blink |
OLD | NEW |