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

Side by Side Diff: Source/WebKit/chromium/src/PinchViewports.h

Issue 16799005: Insert pinch zoom virtual viewport layers to graphics layer tree. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address James' comments, add WebLayerTreeView function interface. Created 7 years, 6 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 10 matching lines...) Expand all
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef ViewportAnchor_h 31 #ifndef PinchViewports_h
32 #define ViewportAnchor_h 32 #define PinchViewports_h
33 33
34 #include "core/platform/graphics/FloatSize.h" 34 #include "core/platform/graphics/FloatSize.h"
35 #include "core/platform/graphics/IntPoint.h" 35 #include "core/platform/graphics/GraphicsLayerClient.h"
36 #include "core/platform/graphics/IntRect.h" 36 #include "public/platform/WebScrollbar.h"
37 #include "core/platform/graphics/LayoutRect.h" 37 #include "public/platform/WebSize.h"
38 #include <wtf/RefCounted.h> 38 #include "wtf/OwnPtr.h"
39 #include "wtf/PassOwnPtr.h"
39 40
40 namespace WebCore { 41 namespace WebCore {
41 class EventHandler; 42 class GraphicsLayer;
42 class IntSize;
43 class Node;
44 } 43 }
45 44
46 namespace WebKit { 45 namespace WebKit {
47 46
48 // ViewportAnchor provides a way to anchor a viewport origin to a DOM node. 47 using WebCore::GraphicsContext;
jamesr 2013/06/17 20:42:10 since you're in a header and there's only one use
wjmaclean 2013/06/17 22:09:04 Done.
49 // In particular, the user supplies the current viewport (in CSS coordinates) 48 using WebCore::GraphicsLayer;
50 // and an anchor point (in view coordinates, e.g., (0, 0) == viewport origin, 49 using WebCore::GraphicsLayerPaintingPhase;
51 // (0.5, 0) == viewport top center). The anchor point tracks the underlying DOM 50 using WebCore::IntRect;
52 // node; as the node moves or the view is resized, the viewport anchor maintains 51
53 // its orientation relative to the node, and the viewport origin maintains its 52 class WebLayerTreeView;
54 // orientation relative to the anchor. 53 class WebScrollbarLayer;
55 class ViewportAnchor { 54 class WebViewImpl;
56 WTF_MAKE_NONCOPYABLE(ViewportAnchor); 55
56 class PinchViewports : WebCore::GraphicsLayerClient {
57 public: 57 public:
58 explicit ViewportAnchor(WebCore::EventHandler* eventHandler); 58 static PassOwnPtr<PinchViewports> create(WebViewImpl* owner);
59 ~PinchViewports();
59 60
60 void setAnchor(const WebCore::IntRect& viewRect, const WebCore::FloatSize& a nchorInViewCoords); 61 void setOverflowControlsHostLayer(GraphicsLayer*);
62 GraphicsLayer* rootGraphicsLayer()
63 {
64 return m_innerViewportClipLayer.get();
65 }
66 void setViewportSize(const WebCore::FloatSize&);
67 void showGraphicsLayers();
61 68
62 WebCore::IntPoint computeOrigin(const WebCore::IntSize& currentViewSize) con st; 69 void registerViewportLayersWithTreeView(WebLayerTreeView*) const;
70 void clearViewportLayersForTreeView(WebLayerTreeView*) const;
71
72 // GraphicsLayerClient implementation.
73 virtual void notifyAnimationStarted(const GraphicsLayer*, double time) OVERR IDE;
74 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsL ayerPaintingPhase, const IntRect& inClip) OVERRIDE;
63 75
64 private: 76 private:
65 WebCore::EventHandler* m_eventHandler; 77 explicit PinchViewports(WebViewImpl* owner);
66 78
67 WebCore::IntRect m_viewRect; 79 void setupScrollbar(WebKit::WebScrollbar::Orientation);
68 80
69 RefPtr<WebCore::Node> m_anchorNode; 81 WebViewImpl* m_owner;
70 WebCore::LayoutRect m_anchorNodeBounds; 82 OwnPtr<GraphicsLayer> m_innerViewportClipLayer;
71 83 OwnPtr<GraphicsLayer> m_pageScaleLayer;
72 WebCore::FloatSize m_anchorInViewCoords; 84 OwnPtr<GraphicsLayer> m_innerViewportScrollLayer;
73 WebCore::FloatSize m_anchorInNodeCoords; 85 OwnPtr<GraphicsLayer> m_overlayScrollbarHorizontal;
86 OwnPtr<GraphicsLayer> m_overlayScrollbarVertical;
74 }; 87 };
75 88
76 } // namespace WebKit 89 } // namespace WebKit
77 90
78 #endif 91 #endif // PinchViewports_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698