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/GraphicsLayerClient.h" |
| 33 #include "platform/graphics/paint/DisplayItemClient.h" |
32 #include "wtf/OwnPtr.h" | 34 #include "wtf/OwnPtr.h" |
33 #include "wtf/PassOwnPtr.h" | 35 #include "wtf/PassOwnPtr.h" |
| 36 #include "wtf/text/WTFString.h" |
34 | 37 |
35 namespace blink { | 38 namespace blink { |
36 | 39 |
37 class GraphicsContext; | 40 class GraphicsContext; |
38 class GraphicsLayer; | 41 class GraphicsLayer; |
39 class GraphicsLayerClient; | |
40 class WebPageOverlay; | 42 class WebPageOverlay; |
41 class WebViewImpl; | 43 class WebViewImpl; |
42 | 44 |
43 class PageOverlay { | 45 // Manages a layer that is overlaid on a WebView's content. |
| 46 // Clients can paint by implementing WebPageOverlay. |
| 47 // |
| 48 // With Slimming Paint, internal clients can extract a GraphicsContext to add |
| 49 // to the DisplayItemList owned by the GraphicsLayer. |
| 50 class PageOverlay : public GraphicsLayerClient { |
44 public: | 51 public: |
45 static PassOwnPtr<PageOverlay> create(WebViewImpl*, WebPageOverlay*); | 52 static PassOwnPtr<PageOverlay> create(WebViewImpl*, WebPageOverlay*); |
46 | 53 |
47 ~PageOverlay() { } | 54 ~PageOverlay() { } |
48 | 55 |
49 WebPageOverlay* overlay() const { return m_overlay; } | 56 WebPageOverlay* overlay() const { return m_overlay; } |
50 void setOverlay(WebPageOverlay* overlay) { m_overlay = overlay; } | 57 void setOverlay(WebPageOverlay* overlay) { m_overlay = overlay; } |
51 | 58 |
52 int zOrder() const { return m_zOrder; } | 59 int zOrder() const { return m_zOrder; } |
53 void setZOrder(int zOrder) { m_zOrder = zOrder; } | 60 void setZOrder(int zOrder) { m_zOrder = zOrder; } |
54 | 61 |
55 void clear(); | 62 void clear(); |
56 void update(); | 63 void update(); |
57 void paintWebFrame(GraphicsContext&); | 64 void paintWebFrame(GraphicsContext&); |
58 | 65 |
59 GraphicsLayer* graphicsLayer() const { return m_layer.get(); } | 66 GraphicsLayer* graphicsLayer() const { return m_layer.get(); } |
| 67 DisplayItemClient displayItemClient() { return toDisplayItemClient(this); } |
| 68 |
| 69 // GraphicsLayerClient implementation |
| 70 void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPain
tingPhase, const IntRect& inClip) override; |
| 71 String debugName(const GraphicsLayer*) override; |
60 | 72 |
61 private: | 73 private: |
62 PageOverlay(WebViewImpl*, WebPageOverlay*); | 74 PageOverlay(WebViewImpl*, WebPageOverlay*); |
63 void invalidateWebFrame(); | 75 void invalidateWebFrame(); |
64 | 76 |
65 WebViewImpl* m_viewImpl; | 77 WebViewImpl* m_viewImpl; |
66 WebPageOverlay* m_overlay; | 78 WebPageOverlay* m_overlay; |
67 OwnPtr<GraphicsLayerClient> m_layerClient; | |
68 OwnPtr<GraphicsLayer> m_layer; | 79 OwnPtr<GraphicsLayer> m_layer; |
69 int m_zOrder; | 80 int m_zOrder; |
70 }; | 81 }; |
71 | 82 |
72 } // namespace blink | 83 } // namespace blink |
73 | 84 |
74 #endif // PageOverlay_h | 85 #endif // PageOverlay_h |
OLD | NEW |