| Index: third_party/WebKit/Source/web/PageOverlayTest.cpp
|
| diff --git a/third_party/WebKit/Source/web/PageOverlayTest.cpp b/third_party/WebKit/Source/web/PageOverlayTest.cpp
|
| index 0a19a8d07846e374af4ab1d853277cb179b878e6..09f442c49058cacea9f6242fffedb1e920989fd8 100644
|
| --- a/third_party/WebKit/Source/web/PageOverlayTest.cpp
|
| +++ b/third_party/WebKit/Source/web/PageOverlayTest.cpp
|
| @@ -19,7 +19,6 @@
|
| #include "third_party/skia/include/core/SkCanvas.h"
|
| #include "third_party/skia/include/core/SkColor.h"
|
| #include "third_party/skia/include/core/SkPaint.h"
|
| -#include "web/WebGraphicsContextImpl.h"
|
| #include "web/WebLocalFrameImpl.h"
|
| #include "web/WebViewImpl.h"
|
| #include "web/tests/FrameTestHelpers.h"
|
| @@ -71,45 +70,20 @@ private:
|
| FrameTestHelpers::WebViewHelper m_helper;
|
| };
|
|
|
| -// PageOverlay that uses a WebCanvas to draw a solid color.
|
| -class SimpleCanvasOverlay : public PageOverlay::Delegate {
|
| +// PageOverlay that paints a solid color.
|
| +class SolidColorOverlay : public PageOverlay::Delegate {
|
| public:
|
| - SimpleCanvasOverlay(SkColor color) : m_color(color) { }
|
| + SolidColorOverlay(Color color) : m_color(color) { }
|
|
|
| - void paintPageOverlay(WebGraphicsContext* context, const WebSize& size) const override
|
| + void paintPageOverlay(const PageOverlay& pageOverlay, GraphicsContext& graphicsContext, const WebSize& size) const override
|
| {
|
| - WebFloatRect rect(0, 0, size.width, size.height);
|
| - WebCanvas* canvas = context->beginDrawing(rect);
|
| - SkPaint paint;
|
| - paint.setColor(m_color);
|
| - paint.setStyle(SkPaint::kFill_Style);
|
| - canvas->drawRectCoords(0, 0, size.width, size.height, paint);
|
| - context->endDrawing();
|
| - }
|
| -
|
| -private:
|
| - SkColor m_color;
|
| -};
|
| -
|
| -// PageOverlay that uses the underlying blink::GraphicsContext to paint a
|
| -// solid color.
|
| -class PrivateGraphicsContextOverlay : public PageOverlay::Delegate {
|
| -public:
|
| - PrivateGraphicsContextOverlay(Color color) : m_color(color) { }
|
| -
|
| - void paintPageOverlay(WebGraphicsContext* context, const WebSize& size) const override
|
| - {
|
| - GraphicsContext& graphicsContext = toWebGraphicsContextImpl(context)->graphicsContext();
|
| - if (DrawingRecorder::useCachedDrawingIfPossible(graphicsContext, *this, DisplayItem::PageOverlay))
|
| + if (DrawingRecorder::useCachedDrawingIfPossible(graphicsContext, pageOverlay, DisplayItem::PageOverlay))
|
| return;
|
| FloatRect rect(0, 0, size.width, size.height);
|
| - DrawingRecorder drawingRecorder(graphicsContext, *this, DisplayItem::PageOverlay, rect);
|
| + DrawingRecorder drawingRecorder(graphicsContext, pageOverlay, DisplayItem::PageOverlay, rect);
|
| graphicsContext.fillRect(rect, m_color);
|
| }
|
|
|
| - DisplayItemClient displayItemClient() const { return toDisplayItemClient(this); }
|
| - String debugName() const { return "PrivateGraphicsContextOverlay"; }
|
| -
|
| private:
|
| Color m_color;
|
| };
|
| @@ -129,13 +103,12 @@ public:
|
| MOCK_METHOD2(onDrawRect, void(const SkRect&, const SkPaint&));
|
| };
|
|
|
| -template <typename OverlayType>
|
| -void PageOverlayTest::runPageOverlayTestWithAcceleratedCompositing()
|
| +TEST_F(PageOverlayTest, PageOverlay_AcceleratedCompositing)
|
| {
|
| initialize(AcceleratedCompositing);
|
| webViewImpl()->layerTreeView()->setViewportSize(WebSize(viewportWidth, viewportHeight));
|
|
|
| - OwnPtr<PageOverlay> pageOverlay = PageOverlay::create(webViewImpl(), new OverlayType(SK_ColorYELLOW));
|
| + OwnPtr<PageOverlay> pageOverlay = PageOverlay::create(webViewImpl(), new SolidColorOverlay(SK_ColorYELLOW));
|
| pageOverlay->update();
|
| webViewImpl()->layout();
|
|
|
| @@ -163,15 +136,5 @@ void PageOverlayTest::runPageOverlayTestWithAcceleratedCompositing()
|
| graphicsContext.endRecording()->playback(&canvas);
|
| }
|
|
|
| -TEST_F(PageOverlayTest, SimpleCanvasOverlay_AcceleratedCompositing)
|
| -{
|
| - runPageOverlayTestWithAcceleratedCompositing<SimpleCanvasOverlay>();
|
| -}
|
| -
|
| -TEST_F(PageOverlayTest, PrivateGraphicsContextOverlay_AcceleratedCompositing)
|
| -{
|
| - runPageOverlayTestWithAcceleratedCompositing<PrivateGraphicsContextOverlay>();
|
| -}
|
| -
|
| } // namespace
|
| } // namespace blink
|
|
|