| 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 3e92e32a2f867341300bb60c550f5729a13a1c55..d3d152d8ec1aed2898a6a1c08620aaa6b2a31824 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"
|
| @@ -3208,6 +3209,26 @@ WebFloatSize WebViewImpl::visualViewportSize() const
|
| return page()->frameHost().visualViewport().visibleRect().size();
|
| }
|
|
|
| +void WebViewImpl::setScrollAndScaleOverride(const WebDeviceEmulationParams& params)
|
| +{
|
| + if (!page())
|
| + return;
|
| +
|
| + page()->frameHost().setScrollAndScaleOverride(
|
| + static_cast<IntPoint>(params.scrollPosition),
|
| + static_cast<FloatPoint>(params.visualViewportPosition),
|
| + params.visualViewportScale);
|
| +}
|
| +
|
| +void WebViewImpl::clearScrollAndScaleOverride()
|
| +{
|
| + if (!page())
|
| + return;
|
| +
|
| + page()->frameHost().clearScrollAndScaleOverride();
|
| + resetScrollAndScaleState();
|
| +}
|
| +
|
| void WebViewImpl::scrollAndRescaleViewports(float scaleFactor,
|
| const IntPoint& mainFrameOrigin,
|
| const FloatPoint& visualViewportOrigin)
|
| @@ -3343,7 +3364,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);
|
| @@ -3834,10 +3861,12 @@ void WebViewImpl::setRootLayerTransform(const WebSize& rootLayerOffset, float ro
|
| void WebViewImpl::enableDeviceEmulation(const WebDeviceEmulationParams& params)
|
| {
|
| m_devToolsEmulator->enableDeviceEmulation(params);
|
| + setScrollAndScaleOverride(params);
|
| }
|
|
|
| void WebViewImpl::disableDeviceEmulation()
|
| {
|
| + clearScrollAndScaleOverride();
|
| m_devToolsEmulator->disableDeviceEmulation();
|
| }
|
|
|
|
|