| Index: Source/web/PageOverlay.h
|
| diff --git a/Source/web/PageOverlay.h b/Source/web/PageOverlay.h
|
| index f55fbc1dde1a1ade0bf301cc1dd678bb90efb426..52bd4d65151c422ff0f5647a86479ac09cd24348 100644
|
| --- a/Source/web/PageOverlay.h
|
| +++ b/Source/web/PageOverlay.h
|
| @@ -29,8 +29,11 @@
|
| #ifndef PageOverlay_h
|
| #define PageOverlay_h
|
|
|
| +#include "platform/graphics/GraphicsLayer.h"
|
| +#include "platform/graphics/GraphicsLayerClient.h"
|
| #include "wtf/OwnPtr.h"
|
| #include "wtf/PassOwnPtr.h"
|
| +#include "wtf/text/WTFString.h"
|
|
|
| namespace blink {
|
|
|
| @@ -40,14 +43,32 @@ class GraphicsLayerClient;
|
| class WebPageOverlay;
|
| class WebViewImpl;
|
|
|
| -class PageOverlay {
|
| +// Manages a layer than is overlaid on a WebView's content.
|
| +//
|
| +// Clients can paint by providing either exactly one of the following:
|
| +// - WebPageOverlay (which paints using a WebCanvas)
|
| +// - PageOverlay::Painter (which paints using a GraphicsContext)
|
| +//
|
| +// In particular, if a client expects to paint web content (which, when
|
| +// Slimming Paint is enabled, uses a DisplayItemList attached to
|
| +// GraphicsContext), it should provide the latter.
|
| +class PageOverlay : public GraphicsLayerClient {
|
| public:
|
| + class Painter {
|
| + public:
|
| + // The callee is responsible for saving the GraphicsContext,
|
| + // if it is required.
|
| + virtual void paintPageOverlay(GraphicsContext&) = 0;
|
| + };
|
| +
|
| static PassOwnPtr<PageOverlay> create(WebViewImpl*, WebPageOverlay*);
|
| + static PassOwnPtr<PageOverlay> create(WebViewImpl*, Painter*);
|
|
|
| ~PageOverlay() { }
|
|
|
| + // Exactly one of these should be non-null.
|
| WebPageOverlay* overlay() const { return m_overlay; }
|
| - void setOverlay(WebPageOverlay* overlay) { m_overlay = overlay; }
|
| + Painter* overlayPainter() const { return m_overlayPainter; }
|
|
|
| int zOrder() const { return m_zOrder; }
|
| void setZOrder(int zOrder) { m_zOrder = zOrder; }
|
| @@ -58,13 +79,19 @@ public:
|
|
|
| GraphicsLayer* graphicsLayer() const { return m_layer.get(); }
|
|
|
| + // GraphicsLayerClient implementation
|
| + void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip) override;
|
| + String debugName(const GraphicsLayer*) override;
|
| +
|
| private:
|
| PageOverlay(WebViewImpl*, WebPageOverlay*);
|
| + PageOverlay(WebViewImpl*, Painter*);
|
| +
|
| void invalidateWebFrame();
|
|
|
| WebViewImpl* m_viewImpl;
|
| WebPageOverlay* m_overlay;
|
| - OwnPtr<GraphicsLayerClient> m_layerClient;
|
| + Painter* m_overlayPainter;
|
| OwnPtr<GraphicsLayer> m_layer;
|
| int m_zOrder;
|
| };
|
|
|