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

Unified Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

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/web/WebViewImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp
index 683101cec9c7be27f3dfb42418bf43128124e880..ff4094662b9126ceadc9492d83e44fd9c6b2948b 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -56,6 +56,7 @@
#include "core/frame/LocalFrame.h"
#include "core/frame/PageScaleConstraintsSet.h"
#include "core/frame/RemoteFrame.h"
+#include "core/frame/ScrollAndScaleEmulator.h"
#include "core/frame/Settings.h"
#include "core/frame/SmartClip.h"
#include "core/frame/TopControls.h"
@@ -3249,6 +3250,23 @@ WebFloatSize WebViewImpl::visualViewportSize() const
return page()->frameHost().visualViewport().visibleRect().size();
}
+void WebViewImpl::setScrollAndScaleOverride(const IntPoint& framePosition, const DoublePoint& visualViewportPosition, float pageScale)
+{
+ if (!page())
+ return;
+
+ page()->frameHost().setScrollAndScaleOverride(framePosition, visualViewportPosition, pageScale);
+}
+
+void WebViewImpl::clearScrollAndScaleOverride()
+{
+ if (!page())
+ return;
+
+ page()->frameHost().clearScrollAndScaleOverride();
+ resetScrollAndScaleState();
+}
+
void WebViewImpl::scrollAndRescaleViewports(float scaleFactor,
const IntPoint& mainFrameOrigin,
const FloatPoint& visualViewportOrigin)
@@ -3384,7 +3402,13 @@ void WebViewImpl::setIgnoreViewportTagScaleLimits(bool ignore)
IntSize WebViewImpl::mainFrameSize()
{
// The frame size should match the viewport size at minimum scale, since the
- // viewport must always be contained by the frame.
+ // viewport must always be contained by the frame. As ScrollAndScaleEmulator
+ // may override the minimum scale, it is responsible for this calculation if
+ // it is active.
+ if (page() && page()->frameHost().scrollAndScaleEmulator()) {
+ return page()->frameHost().scrollAndScaleEmulator()->mainFrameSize(m_size);
+ }
+
FloatSize frameSize(m_size);
frameSize.scale(1 / minimumPageScaleFactor());
return expandedIntSize(frameSize);

Powered by Google App Engine
This is Rietveld 408576698