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 23 matching lines...) Expand all Loading... |
34 #include "platform/graphics/paint/DisplayItemClient.h" | 34 #include "platform/graphics/paint/DisplayItemClient.h" |
35 #include "wtf/OwnPtr.h" | 35 #include "wtf/OwnPtr.h" |
36 #include "wtf/PassOwnPtr.h" | 36 #include "wtf/PassOwnPtr.h" |
37 #include "wtf/text/WTFString.h" | 37 #include "wtf/text/WTFString.h" |
38 | 38 |
39 namespace blink { | 39 namespace blink { |
40 | 40 |
41 class GraphicsContext; | 41 class GraphicsContext; |
42 class WebPageOverlay; | 42 class WebPageOverlay; |
43 class WebViewImpl; | 43 class WebViewImpl; |
44 class WebGraphicsContext; | |
45 | 44 |
46 // Manages a layer that is overlaid on a WebView's content. | 45 // Manages a layer that is overlaid on a WebView's content. |
47 // Clients can paint by implementing WebPageOverlay. | 46 // Clients can paint by implementing WebPageOverlay. |
48 // | 47 // |
49 // With Slimming Paint, internal clients can extract a GraphicsContext to add | 48 // With Slimming Paint, internal clients can extract a GraphicsContext to add |
50 // to the PaintController owned by the GraphicsLayer | 49 // to the PaintController owned by the GraphicsLayer |
51 class PageOverlay : public GraphicsLayerClient { | 50 class PageOverlay : public GraphicsLayerClient { |
52 public: | 51 public: |
53 class Delegate : public GarbageCollectedFinalized<Delegate> { | 52 class Delegate : public GarbageCollectedFinalized<Delegate> { |
54 public: | 53 public: |
55 DEFINE_INLINE_VIRTUAL_TRACE() { } | 54 DEFINE_INLINE_VIRTUAL_TRACE() { } |
56 | 55 |
57 // Paints page overlay contents. | 56 // Paints page overlay contents. |
58 virtual void paintPageOverlay(WebGraphicsContext*, const WebSize& webVie
wSize) const = 0; | 57 virtual void paintPageOverlay(const PageOverlay&, GraphicsContext&, cons
t WebSize& webViewSize) const = 0; |
59 virtual ~Delegate() { } | 58 virtual ~Delegate() { } |
60 }; | 59 }; |
61 | 60 |
62 static PassOwnPtr<PageOverlay> create(WebViewImpl*, PageOverlay::Delegate*); | 61 static PassOwnPtr<PageOverlay> create(WebViewImpl*, PageOverlay::Delegate*); |
63 | 62 |
64 ~PageOverlay(); | 63 ~PageOverlay(); |
65 | 64 |
66 void update(); | 65 void update(); |
67 | 66 |
68 GraphicsLayer* graphicsLayer() const { return m_layer.get(); } | 67 GraphicsLayer* graphicsLayer() const { return m_layer.get(); } |
69 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi
s); } | 68 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi
s); } |
70 String debugName() const { return "PageOverlay"; } | 69 String debugName() const { return "PageOverlay"; } |
71 | 70 |
72 // GraphicsLayerClient implementation | 71 // GraphicsLayerClient implementation |
73 void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPain
tingPhase, const IntRect& inClip) const override; | 72 void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPain
tingPhase, const IntRect& inClip) const override; |
74 void paintContentsIfNeeded(const GraphicsLayer*, GraphicsContext&, GraphicsL
ayerPaintingPhase) const override; | 73 void paintContentsIfNeeded(const GraphicsLayer*, GraphicsContext&, GraphicsL
ayerPaintingPhase) const override; |
75 String debugName(const GraphicsLayer*) override; | 74 String debugName(const GraphicsLayer*) override; |
76 | 75 |
77 private: | 76 private: |
78 PageOverlay(WebViewImpl*, PageOverlay::Delegate*); | 77 PageOverlay(WebViewImpl*, PageOverlay::Delegate*); |
79 | 78 |
80 WebViewImpl* m_viewImpl; | 79 WebViewImpl* m_viewImpl; |
81 Persistent<PageOverlay::Delegate> m_delegate; | 80 Persistent<PageOverlay::Delegate> m_delegate; |
82 OwnPtr<GraphicsLayer> m_layer; | 81 OwnPtr<GraphicsLayer> m_layer; |
83 }; | 82 }; |
84 | 83 |
85 } // namespace blink | 84 } // namespace blink |
86 | 85 |
87 #endif // PageOverlay_h | 86 #endif // PageOverlay_h |
OLD | NEW |