| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 settings->setAcceleratedCompositingEnabled(false); | 46 settings->setAcceleratedCompositingEnabled(false); |
| 47 } | 47 } |
| 48 | 48 |
| 49 // PageOverlay that paints a solid color. | 49 // PageOverlay that paints a solid color. |
| 50 class SolidColorOverlay : public PageOverlay::Delegate { | 50 class SolidColorOverlay : public PageOverlay::Delegate { |
| 51 public: | 51 public: |
| 52 SolidColorOverlay(Color color) : m_color(color) { } | 52 SolidColorOverlay(Color color) : m_color(color) { } |
| 53 | 53 |
| 54 void paintPageOverlay(const PageOverlay& pageOverlay, GraphicsContext& graph
icsContext, const WebSize& size) const override | 54 void paintPageOverlay(const PageOverlay& pageOverlay, GraphicsContext& graph
icsContext, const WebSize& size) const override |
| 55 { | 55 { |
| 56 if (DrawingRecorder::useCachedDrawingIfPossible(graphicsContext, pageOve
rlay, DisplayItem::PageOverlay)) | 56 if (DrawingRecorder::useCachedDrawingIfPossible(graphicsContext, pageOve
rlay, DisplayItem::kPageOverlay)) |
| 57 return; | 57 return; |
| 58 FloatRect rect(0, 0, size.width, size.height); | 58 FloatRect rect(0, 0, size.width, size.height); |
| 59 DrawingRecorder drawingRecorder(graphicsContext, pageOverlay, DisplayIte
m::PageOverlay, rect); | 59 DrawingRecorder drawingRecorder(graphicsContext, pageOverlay, DisplayIte
m::kPageOverlay, rect); |
| 60 graphicsContext.fillRect(rect, m_color); | 60 graphicsContext.fillRect(rect, m_color); |
| 61 } | 61 } |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 Color m_color; | 64 Color m_color; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 class PageOverlayTest : public ::testing::Test { | 67 class PageOverlayTest : public ::testing::Test { |
| 68 protected: | 68 protected: |
| 69 enum CompositingMode { AcceleratedCompositing, UnacceleratedCompositing }; | 69 enum CompositingMode { AcceleratedCompositing, UnacceleratedCompositing }; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 { | 143 { |
| 144 initialize(AcceleratedCompositing); | 144 initialize(AcceleratedCompositing); |
| 145 std::unique_ptr<PageOverlay> pageOverlay = createSolidYellowOverlay(); | 145 std::unique_ptr<PageOverlay> pageOverlay = createSolidYellowOverlay(); |
| 146 pageOverlay->update(); | 146 pageOverlay->update(); |
| 147 webViewImpl()->updateAllLifecyclePhases(); | 147 webViewImpl()->updateAllLifecyclePhases(); |
| 148 EXPECT_EQ(LayoutRect(0, 0, viewportWidth, viewportHeight), pageOverlay->visu
alRect()); | 148 EXPECT_EQ(LayoutRect(0, 0, viewportWidth, viewportHeight), pageOverlay->visu
alRect()); |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace | 151 } // namespace |
| 152 } // namespace blink | 152 } // namespace blink |
| OLD | NEW |