| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * | 10 * |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #ifndef PageOverlay_h | 29 #ifndef PageOverlay_h |
| 30 #define PageOverlay_h | 30 #define PageOverlay_h |
| 31 | 31 |
| 32 #include "platform/graphics/GraphicsLayer.h" |
| 32 #include "platform/graphics/GraphicsLayerClient.h" | 33 #include "platform/graphics/GraphicsLayerClient.h" |
| 33 #include "platform/graphics/paint/DisplayItemClient.h" | 34 #include "platform/graphics/paint/DisplayItemClient.h" |
| 34 #include "wtf/OwnPtr.h" | 35 #include "wtf/OwnPtr.h" |
| 35 #include "wtf/PassOwnPtr.h" | 36 #include "wtf/PassOwnPtr.h" |
| 36 #include "wtf/text/WTFString.h" | 37 #include "wtf/text/WTFString.h" |
| 37 | 38 |
| 38 namespace blink { | 39 namespace blink { |
| 39 | 40 |
| 40 class GraphicsContext; | 41 class GraphicsContext; |
| 41 class GraphicsLayer; | |
| 42 class WebPageOverlay; | 42 class WebPageOverlay; |
| 43 class WebViewImpl; | 43 class WebViewImpl; |
| 44 class WebGraphicsContext; |
| 44 | 45 |
| 45 // Manages a layer that is overlaid on a WebView's content. | 46 // Manages a layer that is overlaid on a WebView's content. |
| 46 // Clients can paint by implementing WebPageOverlay. | 47 // Clients can paint by implementing WebPageOverlay. |
| 47 // | 48 // |
| 48 // With Slimming Paint, internal clients can extract a GraphicsContext to add | 49 // With Slimming Paint, internal clients can extract a GraphicsContext to add |
| 49 // to the DisplayItemList owned by the GraphicsLayer. | 50 // to the DisplayItemList owned by the GraphicsLayer |
| 50 class PageOverlay : public GraphicsLayerClient { | 51 class PageOverlay : public GraphicsLayerClient { |
| 51 public: | 52 public: |
| 52 static PassOwnPtr<PageOverlay> create(WebViewImpl*, WebPageOverlay*); | |
| 53 | 53 |
| 54 ~PageOverlay() { } | 54 class Delegate { |
| 55 public: |
| 56 // Paints page overlay contents. |
| 57 virtual void paintPageOverlay(WebGraphicsContext*, const WebSize& webVie
wSize) = 0; |
| 58 virtual ~Delegate() { } |
| 59 }; |
| 55 | 60 |
| 56 WebPageOverlay* overlay() const { return m_overlay; } | 61 static PassOwnPtr<PageOverlay> create(WebViewImpl*, PassOwnPtr<PageOverlay::
Delegate>); |
| 57 void setOverlay(WebPageOverlay* overlay) { m_overlay = overlay; } | |
| 58 | 62 |
| 59 int zOrder() const { return m_zOrder; } | 63 ~PageOverlay(); |
| 60 void setZOrder(int zOrder) { m_zOrder = zOrder; } | |
| 61 | 64 |
| 62 void clear(); | |
| 63 void update(); | 65 void update(); |
| 64 void paintWebFrame(GraphicsContext&); | 66 void paintWebFrame(GraphicsContext&); |
| 65 | 67 |
| 66 GraphicsLayer* graphicsLayer() const { return m_layer.get(); } | 68 GraphicsLayer* graphicsLayer() const { return m_layer.get(); } |
| 67 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi
s); } | 69 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi
s); } |
| 68 String debugName() const { return "PageOverlay"; } | 70 String debugName() const { return "PageOverlay"; } |
| 69 | 71 |
| 70 // GraphicsLayerClient implementation | 72 // GraphicsLayerClient implementation |
| 71 void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPain
tingPhase, const IntRect& inClip) override; | 73 void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPain
tingPhase, const IntRect& inClip) override; |
| 72 String debugName(const GraphicsLayer*) override; | 74 String debugName(const GraphicsLayer*) override; |
| 73 | 75 |
| 74 private: | 76 private: |
| 75 PageOverlay(WebViewImpl*, WebPageOverlay*); | 77 PageOverlay(WebViewImpl*, PassOwnPtr<PageOverlay::Delegate>); |
| 76 void invalidateWebFrame(); | 78 void invalidateWebFrame(); |
| 77 | 79 |
| 78 WebViewImpl* m_viewImpl; | 80 WebViewImpl* m_viewImpl; |
| 79 WebPageOverlay* m_overlay; | 81 OwnPtr<PageOverlay::Delegate> m_overlay; |
| 80 OwnPtr<GraphicsLayer> m_layer; | 82 OwnPtr<GraphicsLayer> m_layer; |
| 81 int m_zOrder; | |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 } // namespace blink | 85 } // namespace blink |
| 85 | 86 |
| 86 #endif // PageOverlay_h | 87 #endif // PageOverlay_h |
| OLD | NEW |