| 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 "web/PageOverlay.h" | 5 #include "web/PageOverlay.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "platform/graphics/Color.h" | 8 #include "platform/graphics/Color.h" |
| 9 #include "platform/graphics/GraphicsContext.h" | 9 #include "platform/graphics/GraphicsContext.h" |
| 10 #include "platform/graphics/paint/DrawingRecorder.h" | 10 #include "platform/graphics/paint/DrawingRecorder.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 WebRect rect(0, 0, viewportWidth, viewportHeight); | 138 WebRect rect(0, 0, viewportWidth, viewportHeight); |
| 139 | 139 |
| 140 // Paint the layer with a null canvas to get a display list, and then | 140 // Paint the layer with a null canvas to get a display list, and then |
| 141 // replay that onto the mock canvas for examination. | 141 // replay that onto the mock canvas for examination. |
| 142 IntRect intRect = rect; | 142 IntRect intRect = rect; |
| 143 graphicsLayer->paint(&intRect); | 143 graphicsLayer->paint(&intRect); |
| 144 | 144 |
| 145 PaintController& paintController = graphicsLayer->getPaintController(); | 145 PaintController& paintController = graphicsLayer->getPaintController(); |
| 146 GraphicsContext graphicsContext(paintController); | 146 GraphicsContext graphicsContext(paintController); |
| 147 graphicsContext.beginRecording(intRect); | 147 graphicsContext.beginRecording(intRect); |
| 148 paintController.paintArtifact().replay(graphicsContext); | 148 paintController.paintArtifact().replay(intRect, graphicsContext); |
| 149 graphicsContext.endRecording()->playback(&canvas); | 149 graphicsContext.endRecording()->playback(&canvas); |
| 150 } | 150 } |
| 151 | 151 |
| 152 TEST_F(PageOverlayTest, PageOverlay_VisualRect) { | 152 TEST_F(PageOverlayTest, PageOverlay_VisualRect) { |
| 153 initialize(AcceleratedCompositing); | 153 initialize(AcceleratedCompositing); |
| 154 std::unique_ptr<PageOverlay> pageOverlay = createSolidYellowOverlay(); | 154 std::unique_ptr<PageOverlay> pageOverlay = createSolidYellowOverlay(); |
| 155 pageOverlay->update(); | 155 pageOverlay->update(); |
| 156 webViewImpl()->updateAllLifecyclePhases(); | 156 webViewImpl()->updateAllLifecyclePhases(); |
| 157 EXPECT_EQ(LayoutRect(0, 0, viewportWidth, viewportHeight), | 157 EXPECT_EQ(LayoutRect(0, 0, viewportWidth, viewportHeight), |
| 158 pageOverlay->visualRect()); | 158 pageOverlay->visualRect()); |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace | 161 } // namespace |
| 162 } // namespace blink | 162 } // namespace blink |
| OLD | NEW |