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