Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: Source/web/PageOverlayList.h

Issue 867063004: [Slimming Paint] Paint the inspector overlay with GraphicsLayer DisplayList. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 PageOverlayList_h 29 #ifndef PageOverlayList_h
30 #define PageOverlayList_h 30 #define PageOverlayList_h
31 31
32 #include "web/PageOverlay.h"
32 #include "wtf/OwnPtr.h" 33 #include "wtf/OwnPtr.h"
33 #include "wtf/PassOwnPtr.h" 34 #include "wtf/PassOwnPtr.h"
34 #include "wtf/Vector.h" 35 #include "wtf/Vector.h"
35 36
36 namespace blink { 37 namespace blink {
37 38
38 class GraphicsContext; 39 class GraphicsContext;
39 class GraphicsLayer; 40 class GraphicsLayer;
40 class PageOverlay; 41 class PageOverlay;
41 class WebPageOverlay; 42 class WebPageOverlay;
42 class WebViewImpl; 43 class WebViewImpl;
43 44
44 class PageOverlayList { 45 class PageOverlayList {
45 public: 46 public:
46 static PassOwnPtr<PageOverlayList> create(WebViewImpl*); 47 static PassOwnPtr<PageOverlayList> create(WebViewImpl*);
47 48
48 ~PageOverlayList(); 49 ~PageOverlayList();
49 50
50 bool empty() const { return !m_pageOverlays.size(); } 51 bool empty() const { return !m_pageOverlays.size(); }
51 52
52 // Adds/removes a PageOverlay for given client. 53 // Adds/removes a PageOverlay for given client.
53 // Returns true if a PageOverlay is added/removed. 54 // Returns true if a PageOverlay is added/removed.
54 bool add(WebPageOverlay*, int /* zOrder */); 55 bool add(WebPageOverlay*, int zOrder);
56 bool add(PageOverlay::Painter*, int zOrder);
55 bool remove(WebPageOverlay*); 57 bool remove(WebPageOverlay*);
58 bool remove(PageOverlay::Painter*);
56 59
57 void update(); 60 void update();
58 void paintWebFrame(GraphicsContext&); 61 void paintWebFrame(GraphicsContext&);
59 62
60 size_t findGraphicsLayer(GraphicsLayer*); 63 size_t findGraphicsLayer(GraphicsLayer*);
61 64
65 // FIXME: Really, it should be possible for there to be multiple.
66 // But the signature of WebViewImpl::setOverlayLayer already seems to
67 // preclude that.
68 GraphicsLayer* graphicsLayerForTesting() const;
69
62 private: 70 private:
63 typedef Vector<OwnPtr<PageOverlay>, 2> PageOverlays; 71 typedef Vector<OwnPtr<PageOverlay>, 2> PageOverlays;
64 72
65 explicit PageOverlayList(WebViewImpl*); 73 explicit PageOverlayList(WebViewImpl*);
66 74
67 // Returns the index of the client found. Otherwise, returns WTF::kNotFound. 75 // Returns the index of the client found. Otherwise, returns WTF::kNotFound.
68 size_t find(WebPageOverlay*); 76 size_t find(WebPageOverlay*);
77 size_t find(PageOverlay::Painter*);
78
79 // Finds the overlay with the given client, adding it if it does not exist.
80 template <typename T>
81 size_t findOrAdd(T* client, bool& added);
82
83 // Adjusts overlay order to match z-order and issue any necessary updates.
84 void updateForZOrder(size_t indexOfChangedOverlay);
69 85
70 WebViewImpl* m_viewImpl; 86 WebViewImpl* m_viewImpl;
71 PageOverlays m_pageOverlays; 87 PageOverlays m_pageOverlays;
72 }; 88 };
73 89
74 } // namespace blink 90 } // namespace blink
75 91
76 #endif // PageOverlayList_h 92 #endif // PageOverlayList_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698