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

Unified 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: Sync, patch in 2169483002 (+ regression test), add DevTools tests. 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/VisualViewport.h
diff --git a/third_party/WebKit/Source/core/frame/VisualViewport.h b/third_party/WebKit/Source/core/frame/VisualViewport.h
index 406c8637b200c0261f950ebfcc626b5878ec486e..a5bbaeccefaf781bf65d478ececd027bd3442bd2 100644
--- a/third_party/WebKit/Source/core/frame/VisualViewport.h
+++ b/third_party/WebKit/Source/core/frame/VisualViewport.h
@@ -55,6 +55,7 @@ class GraphicsLayer;
class IntRect;
class IntSize;
class LocalFrame;
+class ScrollAndScaleEmulator;
// Represents the visual viewport the user is currently seeing the page through. This
// class corresponds to the InnerViewport on the compositor. It is a ScrollableArea; it's
@@ -108,6 +109,9 @@ public:
void move(const FloatSize&);
FloatPoint location() const { return m_offset; }
+ // Override the scroll location and scale with values from the emulator. Passing |nullptr| clears override.
+ void setScrollAndScaleEmulator(ScrollAndScaleEmulator*);
+
// Sets the size of the inner viewport when unscaled in CSS pixels.
void setSize(const IntSize&);
IntSize size() const { return m_size; }
@@ -189,6 +193,7 @@ public:
IntPoint scrollPosition() const override { return flooredIntPoint(m_offset); }
DoublePoint scrollPositionDouble() const override { return m_offset; }
IntPoint minimumScrollPosition() const override;
+ DoublePoint minimumScrollPositionDouble() const override;
IntPoint maximumScrollPosition() const override;
DoublePoint maximumScrollPositionDouble() const override;
int visibleHeight() const override { return visibleRect().height(); }
@@ -247,6 +252,10 @@ private:
void setupScrollbar(WebScrollbar::Orientation);
FloatPoint clampOffsetToBoundaries(const FloatPoint&);
+ // Calculate the physical minimum/maximum scroll positions without any overrides applied.
+ DoublePoint calculateMinimumScrollPositionDouble() const;
+ DoublePoint calculateMaximumScrollPositionDouble() const;
+
LocalFrame* mainFrame() const;
FrameHost& frameHost() const
@@ -273,6 +282,8 @@ private:
float m_topControlsAdjustment;
float m_maxPageScale;
bool m_trackPinchZoomStatsForPage;
+
+ Member<ScrollAndScaleEmulator> m_scrollAndScaleEmulator;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698