OLD | NEW |
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 class GraphicsLayerFactory; | 55 class GraphicsLayerFactory; |
56 class IntRect; | 56 class IntRect; |
57 class IntSize; | 57 class IntSize; |
58 class LocalFrame; | 58 class LocalFrame; |
59 | 59 |
60 // Represents the pinch-to-zoom viewport the user is currently seeing the page t
hrough. This | 60 // Represents the pinch-to-zoom viewport the user is currently seeing the page t
hrough. This |
61 // class corresponds to the InnerViewport on the compositor. It is a ScrollableA
rea; it's | 61 // class corresponds to the InnerViewport on the compositor. It is a ScrollableA
rea; it's |
62 // offset is set through the GraphicsLayer <-> CC sync mechanisms. Its contents
is the page's | 62 // offset is set through the GraphicsLayer <-> CC sync mechanisms. Its contents
is the page's |
63 // main FrameView, which corresponds to the outer viewport. The inner viewport i
s always contained | 63 // main FrameView, which corresponds to the outer viewport. The inner viewport i
s always contained |
64 // in the outer viewport and can pan within it. | 64 // in the outer viewport and can pan within it. |
65 class CORE_EXPORT PinchViewport final : public NoBaseWillBeGarbageCollectedFinal
ized<PinchViewport>, public GraphicsLayerClient, public ScrollableArea { | 65 class CORE_EXPORT PinchViewport final : public GraphicsLayerClient, public Scrol
lableArea { |
66 public: | 66 public: |
67 static PassOwnPtrWillBeRawPtr<PinchViewport> create(FrameHost& host) | 67 static PassOwnPtr<PinchViewport> create(FrameHost& host) |
68 { | 68 { |
69 return adoptPtrWillBeNoop(new PinchViewport(host)); | 69 return adoptPtr(new PinchViewport(host)); |
70 } | 70 } |
71 virtual ~PinchViewport(); | 71 virtual ~PinchViewport(); |
72 DECLARE_VIRTUAL_TRACE(); | |
73 | 72 |
74 void attachToLayerTree(GraphicsLayer*, GraphicsLayerFactory*); | 73 void attachToLayerTree(GraphicsLayer*, GraphicsLayerFactory*); |
75 GraphicsLayer* rootGraphicsLayer() | 74 GraphicsLayer* rootGraphicsLayer() |
76 { | 75 { |
77 return m_rootTransformLayer.get(); | 76 return m_rootTransformLayer.get(); |
78 } | 77 } |
79 GraphicsLayer* containerLayer() | 78 GraphicsLayer* containerLayer() |
80 { | 79 { |
81 return m_innerViewportContainerLayer.get(); | 80 return m_innerViewportContainerLayer.get(); |
82 } | 81 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsL
ayerPaintingPhase, const IntRect& inClip) override; | 196 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsL
ayerPaintingPhase, const IntRect& inClip) override; |
198 virtual String debugName(const GraphicsLayer*) override; | 197 virtual String debugName(const GraphicsLayer*) override; |
199 | 198 |
200 void setupScrollbar(WebScrollbar::Orientation); | 199 void setupScrollbar(WebScrollbar::Orientation); |
201 FloatPoint clampOffsetToBoundaries(const FloatPoint&); | 200 FloatPoint clampOffsetToBoundaries(const FloatPoint&); |
202 | 201 |
203 LocalFrame* mainFrame() const; | 202 LocalFrame* mainFrame() const; |
204 | 203 |
205 FrameHost& frameHost() const | 204 FrameHost& frameHost() const |
206 { | 205 { |
207 ASSERT(m_frameHost); | 206 return m_frameHost; |
208 return *m_frameHost; | |
209 } | 207 } |
210 | 208 |
211 RawPtrWillBeMember<FrameHost> m_frameHost; | 209 // TODO(Oilpan): this back reference is safe, but not ideal. |
| 210 // Turning it into a traced Member<> would require moving |
| 211 // ScrollableArea to the heap. |
| 212 FrameHost& m_frameHost; |
212 OwnPtr<GraphicsLayer> m_rootTransformLayer; | 213 OwnPtr<GraphicsLayer> m_rootTransformLayer; |
213 OwnPtr<GraphicsLayer> m_innerViewportContainerLayer; | 214 OwnPtr<GraphicsLayer> m_innerViewportContainerLayer; |
214 OwnPtr<GraphicsLayer> m_overscrollElasticityLayer; | 215 OwnPtr<GraphicsLayer> m_overscrollElasticityLayer; |
215 OwnPtr<GraphicsLayer> m_pageScaleLayer; | 216 OwnPtr<GraphicsLayer> m_pageScaleLayer; |
216 OwnPtr<GraphicsLayer> m_innerViewportScrollLayer; | 217 OwnPtr<GraphicsLayer> m_innerViewportScrollLayer; |
217 OwnPtr<GraphicsLayer> m_overlayScrollbarHorizontal; | 218 OwnPtr<GraphicsLayer> m_overlayScrollbarHorizontal; |
218 OwnPtr<GraphicsLayer> m_overlayScrollbarVertical; | 219 OwnPtr<GraphicsLayer> m_overlayScrollbarVertical; |
219 OwnPtr<WebScrollbarLayer> m_webOverlayScrollbarHorizontal; | 220 OwnPtr<WebScrollbarLayer> m_webOverlayScrollbarHorizontal; |
220 OwnPtr<WebScrollbarLayer> m_webOverlayScrollbarVertical; | 221 OwnPtr<WebScrollbarLayer> m_webOverlayScrollbarVertical; |
221 | 222 |
222 // Offset of the pinch viewport from the main frame's origin, in CSS pixels. | 223 // Offset of the pinch viewport from the main frame's origin, in CSS pixels. |
223 FloatPoint m_offset; | 224 FloatPoint m_offset; |
224 float m_scale; | 225 float m_scale; |
225 IntSize m_size; | 226 IntSize m_size; |
226 float m_topControlsAdjustment; | 227 float m_topControlsAdjustment; |
227 }; | 228 }; |
228 | 229 |
229 } // namespace blink | 230 } // namespace blink |
230 | 231 |
231 #endif // PinchViewport_h | 232 #endif // PinchViewport_h |
OLD | NEW |