| Index: third_party/WebKit/Source/core/frame/VisualViewport.cpp
|
| diff --git a/third_party/WebKit/Source/core/frame/VisualViewport.cpp b/third_party/WebKit/Source/core/frame/VisualViewport.cpp
|
| index fe5ac4494ee2ecb6dc58e36d675b0f7f4d2dad20..da1e5a8e5a4ca0824f43d43df1ca8a8ab127f02f 100644
|
| --- a/third_party/WebKit/Source/core/frame/VisualViewport.cpp
|
| +++ b/third_party/WebKit/Source/core/frame/VisualViewport.cpp
|
| @@ -273,8 +273,14 @@ double VisualViewport::pageScale()
|
|
|
| void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location)
|
| {
|
| + if (didSetScaleOrLocation(scale, location))
|
| + clearScrollAnchor();
|
| +}
|
| +
|
| +bool VisualViewport::didSetScaleOrLocation(float scale, const FloatPoint& location)
|
| +{
|
| if (!mainFrame())
|
| - return;
|
| + return false;
|
|
|
| bool valuesChanged = false;
|
|
|
| @@ -307,12 +313,23 @@ void VisualViewport::setScaleAndLocation(float scale, const FloatPoint& location
|
| }
|
|
|
| if (!valuesChanged)
|
| - return;
|
| + return false;
|
|
|
| InspectorInstrumentation::didUpdateLayout(mainFrame());
|
| mainFrame()->loader().saveScrollState();
|
|
|
| clampToBoundaries();
|
| +
|
| + return true;
|
| +}
|
| +
|
| +void VisualViewport::clearScrollAnchor()
|
| +{
|
| + if (RuntimeEnabledFeatures::scrollAnchoringEnabled()) {
|
| + LocalFrame* frame = mainFrame();
|
| + if (frame && frame->view())
|
| + frame->view()->clearScrollAnchor();
|
| + }
|
| }
|
|
|
| bool VisualViewport::magnifyScaleAroundAnchor(float magnifyDelta, const FloatPoint& anchor)
|
| @@ -631,9 +648,10 @@ IntSize VisualViewport::contentsSize() const
|
| return frame->view()->visibleContentRect(IncludeScrollbars).size();
|
| }
|
|
|
| -void VisualViewport::setScrollOffset(const DoublePoint& offset, ScrollType)
|
| +void VisualViewport::setScrollOffset(const DoublePoint& offset, ScrollType scrollType)
|
| {
|
| - setLocation(toFloatPoint(offset));
|
| + if (didSetScaleOrLocation(m_scale, toFloatPoint(offset)) && scrollType != AnchoringScroll)
|
| + clearScrollAnchor();
|
| }
|
|
|
| GraphicsLayer* VisualViewport::layerForContainer() const
|
|
|