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

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

Issue 2096633002: Adds scroll position/scale emulation to DevTools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Emulator using GC, moved to FrameHost, addressed other comments. Created 4 years, 5 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 49
50 namespace blink { 50 namespace blink {
51 51
52 class FrameHost; 52 class FrameHost;
53 class GraphicsContext; 53 class GraphicsContext;
54 class GraphicsLayer; 54 class GraphicsLayer;
55 class IntRect; 55 class IntRect;
56 class IntSize; 56 class IntSize;
57 class LocalFrame; 57 class LocalFrame;
58 class ScrollAndScaleEmulator;
58 59
59 // Represents the visual viewport the user is currently seeing the page through. This 60 // Represents the visual viewport the user is currently seeing the page through. This
60 // 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
61 // 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
62 // 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
63 // in the outer viewport and can pan within it. 64 // in the outer viewport and can pan within it.
64 class CORE_EXPORT VisualViewport final 65 class CORE_EXPORT VisualViewport final
65 : public GarbageCollectedFinalized<VisualViewport> 66 : public GarbageCollectedFinalized<VisualViewport>
66 , public GraphicsLayerClient 67 , public GraphicsLayerClient
67 , public ScrollableArea { 68 , public ScrollableArea {
(...skipping 25 matching lines...) Expand all
93 void initializeScrollbars(); 94 void initializeScrollbars();
94 95
95 // Sets the location of the visual viewport relative to the outer viewport. The 96 // Sets the location of the visual viewport relative to the outer viewport. The
96 // coordinates are in partial CSS pixels. 97 // coordinates are in partial CSS pixels.
97 void setLocation(const FloatPoint&); 98 void setLocation(const FloatPoint&);
98 // FIXME: This should be called moveBy 99 // FIXME: This should be called moveBy
99 void move(const FloatPoint&); 100 void move(const FloatPoint&);
100 void move(const FloatSize&); 101 void move(const FloatSize&);
101 FloatPoint location() const { return m_offset; } 102 FloatPoint location() const { return m_offset; }
102 103
104 // Override the scroll location and scale with values from the emulator. Pas sing |nullptr| clears override.
105 void setScrollAndScaleEmulator(ScrollAndScaleEmulator*);
106
103 // Sets the size of the inner viewport when unscaled in CSS pixels. 107 // Sets the size of the inner viewport when unscaled in CSS pixels.
104 void setSize(const IntSize&); 108 void setSize(const IntSize&);
105 IntSize size() const { return m_size; } 109 IntSize size() const { return m_size; }
106 110
107 // Gets the scaled size, i.e. the viewport in root view space. 111 // Gets the scaled size, i.e. the viewport in root view space.
108 FloatSize visibleSize() const; 112 FloatSize visibleSize() const;
109 113
110 // Resets the viewport to initial state. 114 // Resets the viewport to initial state.
111 void reset(); 115 void reset();
112 116
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 IntRect visibleContentRect(IncludeScrollbarsInRect = ExcludeScrollbars) cons t override; 178 IntRect visibleContentRect(IncludeScrollbarsInRect = ExcludeScrollbars) cons t override;
175 bool shouldUseIntegerScrollOffset() const override; 179 bool shouldUseIntegerScrollOffset() const override;
176 LayoutRect visualRectForScrollbarParts() const override { ASSERT_NOT_REACHED (); return LayoutRect(); } 180 LayoutRect visualRectForScrollbarParts() const override { ASSERT_NOT_REACHED (); return LayoutRect(); }
177 bool isActive() const override { return false; } 181 bool isActive() const override { return false; }
178 int scrollSize(ScrollbarOrientation) const override; 182 int scrollSize(ScrollbarOrientation) const override;
179 bool isScrollCornerVisible() const override { return false; } 183 bool isScrollCornerVisible() const override { return false; }
180 IntRect scrollCornerRect() const override { return IntRect(); } 184 IntRect scrollCornerRect() const override { return IntRect(); }
181 IntPoint scrollPosition() const override { return flooredIntPoint(m_offset); } 185 IntPoint scrollPosition() const override { return flooredIntPoint(m_offset); }
182 DoublePoint scrollPositionDouble() const override { return m_offset; } 186 DoublePoint scrollPositionDouble() const override { return m_offset; }
183 IntPoint minimumScrollPosition() const override; 187 IntPoint minimumScrollPosition() const override;
188 DoublePoint minimumScrollPositionDouble() const override;
184 IntPoint maximumScrollPosition() const override; 189 IntPoint maximumScrollPosition() const override;
185 DoublePoint maximumScrollPositionDouble() const override; 190 DoublePoint maximumScrollPositionDouble() const override;
186 int visibleHeight() const override { return visibleRect().height(); } 191 int visibleHeight() const override { return visibleRect().height(); }
187 int visibleWidth() const override { return visibleRect().width(); } 192 int visibleWidth() const override { return visibleRect().width(); }
188 IntSize contentsSize() const override; 193 IntSize contentsSize() const override;
189 bool scrollbarsCanBeActive() const override { return false; } 194 bool scrollbarsCanBeActive() const override { return false; }
190 IntRect scrollableAreaBoundingBox() const override; 195 IntRect scrollableAreaBoundingBox() const override;
191 bool userInputScrollable(ScrollbarOrientation) const override { return true; } 196 bool userInputScrollable(ScrollbarOrientation) const override { return true; }
192 bool shouldPlaceVerticalScrollbarOnLeft() const override { return false; } 197 bool shouldPlaceVerticalScrollbarOnLeft() const override { return false; }
193 bool scrollAnimatorEnabled() const override; 198 bool scrollAnimatorEnabled() const override;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 233
229 // GraphicsLayerClient implementation. 234 // GraphicsLayerClient implementation.
230 bool needsRepaint(const GraphicsLayer&) const { ASSERT_NOT_REACHED(); return true; } 235 bool needsRepaint(const GraphicsLayer&) const { ASSERT_NOT_REACHED(); return true; }
231 IntRect computeInterestRect(const GraphicsLayer*, const IntRect&) const; 236 IntRect computeInterestRect(const GraphicsLayer*, const IntRect&) const;
232 void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPain tingPhase, const IntRect&) const override; 237 void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPain tingPhase, const IntRect&) const override;
233 String debugName(const GraphicsLayer*) const override; 238 String debugName(const GraphicsLayer*) const override;
234 239
235 void setupScrollbar(WebScrollbar::Orientation); 240 void setupScrollbar(WebScrollbar::Orientation);
236 FloatPoint clampOffsetToBoundaries(const FloatPoint&); 241 FloatPoint clampOffsetToBoundaries(const FloatPoint&);
237 242
243 // Calculate the physical minimum/maximum scroll positions without any overr ides applied.
244 DoublePoint calculateMinimumScrollPositionDouble() const;
245 DoublePoint calculateMaximumScrollPositionDouble() const;
246
238 LocalFrame* mainFrame() const; 247 LocalFrame* mainFrame() const;
239 248
240 FrameHost& frameHost() const 249 FrameHost& frameHost() const
241 { 250 {
242 ASSERT(m_frameHost); 251 ASSERT(m_frameHost);
243 return *m_frameHost; 252 return *m_frameHost;
244 } 253 }
245 254
246 Member<FrameHost> m_frameHost; 255 Member<FrameHost> m_frameHost;
247 std::unique_ptr<GraphicsLayer> m_rootTransformLayer; 256 std::unique_ptr<GraphicsLayer> m_rootTransformLayer;
248 std::unique_ptr<GraphicsLayer> m_innerViewportContainerLayer; 257 std::unique_ptr<GraphicsLayer> m_innerViewportContainerLayer;
249 std::unique_ptr<GraphicsLayer> m_overscrollElasticityLayer; 258 std::unique_ptr<GraphicsLayer> m_overscrollElasticityLayer;
250 std::unique_ptr<GraphicsLayer> m_pageScaleLayer; 259 std::unique_ptr<GraphicsLayer> m_pageScaleLayer;
251 std::unique_ptr<GraphicsLayer> m_innerViewportScrollLayer; 260 std::unique_ptr<GraphicsLayer> m_innerViewportScrollLayer;
252 std::unique_ptr<GraphicsLayer> m_overlayScrollbarHorizontal; 261 std::unique_ptr<GraphicsLayer> m_overlayScrollbarHorizontal;
253 std::unique_ptr<GraphicsLayer> m_overlayScrollbarVertical; 262 std::unique_ptr<GraphicsLayer> m_overlayScrollbarVertical;
254 std::unique_ptr<WebScrollbarLayer> m_webOverlayScrollbarHorizontal; 263 std::unique_ptr<WebScrollbarLayer> m_webOverlayScrollbarHorizontal;
255 std::unique_ptr<WebScrollbarLayer> m_webOverlayScrollbarVertical; 264 std::unique_ptr<WebScrollbarLayer> m_webOverlayScrollbarVertical;
256 265
257 // Offset of the visual viewport from the main frame's origin, in CSS pixels . 266 // Offset of the visual viewport from the main frame's origin, in CSS pixels .
258 FloatPoint m_offset; 267 FloatPoint m_offset;
259 float m_scale; 268 float m_scale;
260 IntSize m_size; 269 IntSize m_size;
261 float m_topControlsAdjustment; 270 float m_topControlsAdjustment;
262 float m_maxPageScale; 271 float m_maxPageScale;
263 bool m_trackPinchZoomStatsForPage; 272 bool m_trackPinchZoomStatsForPage;
273
274 Member<ScrollAndScaleEmulator> m_scrollAndScaleEmulator;
264 }; 275 };
265 276
266 } // namespace blink 277 } // namespace blink
267 278
268 #endif // VisualViewport_h 279 #endif // VisualViewport_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698