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

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 comments. 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 FloatSize;
42 class IntSize; 43 class GraphicsContext;
43 class Node; 44 class GraphicsLayer;
45 class IntRect;
44 } 46 }
45 47
46 namespace WebKit { 48 namespace WebKit {
47 49
48 // ViewportAnchor provides a way to anchor a viewport origin to a DOM node. 50 class WebLayerTreeView;
49 // In particular, the user supplies the current viewport (in CSS coordinates) 51 class WebScrollbarLayer;
50 // and an anchor point (in view coordinates, e.g., (0, 0) == viewport origin, 52 class WebViewImpl;
51 // (0.5, 0) == viewport top center). The anchor point tracks the underlying DOM 53
52 // node; as the node moves or the view is resized, the viewport anchor maintains 54 class PinchViewports : WebCore::GraphicsLayerClient {
53 // its orientation relative to the node, and the viewport origin maintains its
54 // orientation relative to the anchor.
55 class ViewportAnchor {
56 WTF_MAKE_NONCOPYABLE(ViewportAnchor);
57 public: 55 public:
58 explicit ViewportAnchor(WebCore::EventHandler* eventHandler); 56 static PassOwnPtr<PinchViewports> create(WebViewImpl* owner);
57 ~PinchViewports();
59 58
60 void setAnchor(const WebCore::IntRect& viewRect, const WebCore::FloatSize& a nchorInViewCoords); 59 void setOverflowControlsHostLayer(WebCore::GraphicsLayer*);
60 WebCore::GraphicsLayer* rootGraphicsLayer()
61 {
62 return m_innerViewportClipLayer.get();
63 }
64 void setViewportSize(const WebSize&);
aelias_OOO_until_Jul13 2013/06/18 19:52:28 nit: use WebCore::IntSize since this isn't a Chrom
wjmaclean 2013/06/18 20:11:40 Done.
61 65
62 WebCore::IntPoint computeOrigin(const WebCore::IntSize& currentViewSize) con st; 66 void registerViewportLayersWithTreeView(WebLayerTreeView*) const;
67 void clearViewportLayersForTreeView(WebLayerTreeView*) const;
68
69 // GraphicsLayerClient implementation.
70 virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double ti me) OVERRIDE;
71 virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsC ontext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& inClip) OV ERRIDE;
63 72
64 private: 73 private:
65 WebCore::EventHandler* m_eventHandler; 74 explicit PinchViewports(WebViewImpl* owner);
66 75
67 WebCore::IntRect m_viewRect; 76 void setupScrollbar(WebKit::WebScrollbar::Orientation);
68 77
69 RefPtr<WebCore::Node> m_anchorNode; 78 WebViewImpl* m_owner;
70 WebCore::LayoutRect m_anchorNodeBounds; 79 OwnPtr<WebCore::GraphicsLayer> m_innerViewportClipLayer;
71 80 OwnPtr<WebCore::GraphicsLayer> m_pageScaleLayer;
72 WebCore::FloatSize m_anchorInViewCoords; 81 OwnPtr<WebCore::GraphicsLayer> m_innerViewportScrollLayer;
73 WebCore::FloatSize m_anchorInNodeCoords; 82 OwnPtr<WebCore::GraphicsLayer> m_overlayScrollbarHorizontal;
83 OwnPtr<WebCore::GraphicsLayer> m_overlayScrollbarVertical;
74 }; 84 };
75 85
76 } // namespace WebKit 86 } // namespace WebKit
77 87
78 #endif 88 #endif // PinchViewports_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698