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

Side by Side Diff: third_party/WebKit/Source/core/frame/VisualViewport.h

Issue 1814013002: Visual viewport API initial implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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 14 matching lines...) Expand all
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 VisualViewport_h 31 #ifndef VisualViewport_h
32 #define VisualViewport_h 32 #define VisualViewport_h
33 33
34 #include "core/CoreExport.h" 34 #include "core/CoreExport.h"
35 #include "core/events/Event.h"
35 #include "platform/geometry/FloatPoint.h" 36 #include "platform/geometry/FloatPoint.h"
36 #include "platform/geometry/FloatRect.h" 37 #include "platform/geometry/FloatRect.h"
37 #include "platform/geometry/IntSize.h" 38 #include "platform/geometry/IntSize.h"
38 #include "platform/graphics/GraphicsLayerClient.h" 39 #include "platform/graphics/GraphicsLayerClient.h"
39 #include "platform/scroll/ScrollableArea.h" 40 #include "platform/scroll/ScrollableArea.h"
40 #include "public/platform/WebScrollbar.h" 41 #include "public/platform/WebScrollbar.h"
41 #include "public/platform/WebSize.h" 42 #include "public/platform/WebSize.h"
42 #include "wtf/OwnPtr.h" 43 #include "wtf/OwnPtr.h"
43 #include "wtf/PassOwnPtr.h" 44 #include "wtf/PassOwnPtr.h"
44 45
(...skipping 10 matching lines...) Expand all
55 class GraphicsLayerFactory; 56 class GraphicsLayerFactory;
56 class IntRect; 57 class IntRect;
57 class IntSize; 58 class IntSize;
58 class LocalFrame; 59 class LocalFrame;
59 60
60 // Represents the visual viewport the user is currently seeing the page through. This 61 // Represents the visual viewport the user is currently seeing the page through. This
61 // class corresponds to the InnerViewport on the compositor. It is a ScrollableA rea; it's 62 // 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 63 // 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 64 // 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. 65 // in the outer viewport and can pan within it.
65 class CORE_EXPORT VisualViewport final : public NoBaseWillBeGarbageCollectedFina lized<VisualViewport>, public GraphicsLayerClient, public ScrollableArea { 66 class CORE_EXPORT VisualViewport final
67 : public NoBaseWillBeGarbageCollectedFinalized<VisualViewport>
68 , public GraphicsLayerClient
69 , public ScriptWrappable
70 , public ScrollableArea {
66 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(VisualViewport); 71 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(VisualViewport);
72 DEFINE_WRAPPERTYPEINFO();
67 public: 73 public:
68 static PassOwnPtrWillBeRawPtr<VisualViewport> create(FrameHost& host) 74 static PassOwnPtrWillBeRawPtr<VisualViewport> create(FrameHost& host)
69 { 75 {
70 return adoptPtrWillBeNoop(new VisualViewport(host)); 76 return adoptPtrWillBeNoop(new VisualViewport(host));
71 } 77 }
72 ~VisualViewport() override; 78 ~VisualViewport() override;
73 79
74 DECLARE_VIRTUAL_TRACE(); 80 DECLARE_VIRTUAL_TRACE();
75 81
76 void attachToLayerTree(GraphicsLayer*, GraphicsLayerFactory*); 82 void attachToLayerTree(GraphicsLayer*, GraphicsLayerFactory*);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 bool shouldPlaceVerticalScrollbarOnLeft() const override { return false; } 194 bool shouldPlaceVerticalScrollbarOnLeft() const override { return false; }
189 bool scrollAnimatorEnabled() const override; 195 bool scrollAnimatorEnabled() const override;
190 void scrollControlWasSetNeedsPaintInvalidation() override { } 196 void scrollControlWasSetNeedsPaintInvalidation() override { }
191 void setScrollOffset(const DoublePoint&, ScrollType) override; 197 void setScrollOffset(const DoublePoint&, ScrollType) override;
192 GraphicsLayer* layerForContainer() const override; 198 GraphicsLayer* layerForContainer() const override;
193 GraphicsLayer* layerForScrolling() const override; 199 GraphicsLayer* layerForScrolling() const override;
194 GraphicsLayer* layerForHorizontalScrollbar() const override; 200 GraphicsLayer* layerForHorizontalScrollbar() const override;
195 GraphicsLayer* layerForVerticalScrollbar() const override; 201 GraphicsLayer* layerForVerticalScrollbar() const override;
196 Widget* getWidget() override; 202 Widget* getWidget() override;
197 203
204 void updateLayoutIgnorePendingStylesheets();
205
206 // Visual Viewport API implementation.
207 double scrollLeft();
208 double scrollTop();
209 void setScrollLeft(double x);
210 void setScrollTop(double y);
211 double clientWidth();
212 double clientHeight();
213 double pageScale();
214
198 // Used for gathering data on user pinch-zoom statistics. 215 // Used for gathering data on user pinch-zoom statistics.
199 void userDidChangeScale(); 216 void userDidChangeScale();
200 void sendUMAMetrics(); 217 void sendUMAMetrics();
201 void startTrackingPinchStats(); 218 void startTrackingPinchStats();
202 219
203 // Heuristic-based function for determining if we should disable workarounds 220 // Heuristic-based function for determining if we should disable workarounds
204 // for viewing websites that are not optimized for mobile devices. 221 // for viewing websites that are not optimized for mobile devices.
205 bool shouldDisableDesktopWorkarounds() const; 222 bool shouldDisableDesktopWorkarounds() const;
206 223
207 private: 224 private:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 float m_scale; 258 float m_scale;
242 IntSize m_size; 259 IntSize m_size;
243 float m_topControlsAdjustment; 260 float m_topControlsAdjustment;
244 float m_maxPageScale; 261 float m_maxPageScale;
245 bool m_trackPinchZoomStatsForPage; 262 bool m_trackPinchZoomStatsForPage;
246 }; 263 };
247 264
248 } // namespace blink 265 } // namespace blink
249 266
250 #endif // VisualViewport_h 267 #endif // VisualViewport_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698