| Index: third_party/WebKit/Source/core/frame/FrameView.cpp
|
| diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
|
| index 92177225f6e30dbaa865f5197f386664f36000e4..102d04c4af64cc09cf9deaaf9be5b5132ff9347d 100644
|
| --- a/third_party/WebKit/Source/core/frame/FrameView.cpp
|
| +++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
|
| @@ -43,6 +43,7 @@
|
| #include "core/frame/LocalFrame.h"
|
| #include "core/frame/Location.h"
|
| #include "core/frame/PageScaleConstraintsSet.h"
|
| +#include "core/frame/ScrollAndScaleEmulator.h"
|
| #include "core/frame/Settings.h"
|
| #include "core/frame/TopControls.h"
|
| #include "core/frame/VisualViewport.h"
|
| @@ -1586,6 +1587,12 @@ void FrameView::setScrollPosition(const DoublePoint& scrollPoint, ScrollType scr
|
| ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollBehavior);
|
| }
|
|
|
| +void FrameView::setScrollAndScaleEmulator(const RefPtr<ScrollAndScaleEmulator>& emulator)
|
| +{
|
| + m_scrollAndScaleEmulator = emulator;
|
| + setScrollPosition(scrollPosition(), ProgrammaticScroll, ScrollBehaviorInstant);
|
| +}
|
| +
|
| void FrameView::didUpdateElasticOverscroll()
|
| {
|
| Page* page = frame().page();
|
| @@ -3163,12 +3170,24 @@ void FrameView::setTopControlsViewportAdjustment(float adjustment)
|
|
|
| IntPoint FrameView::maximumScrollPosition() const
|
| {
|
| + IntPoint minimum = calculateMinimumScrollPosition();
|
| + IntPoint maximum = calculateMaximumScrollPosition().expandedTo(minimum);
|
| +
|
| + if (m_scrollAndScaleEmulator) {
|
| + return m_scrollAndScaleEmulator->applyFramePositionOverride(maximum, minimum, maximum);
|
| + }
|
| +
|
| + return maximum;
|
| +}
|
| +
|
| +IntPoint FrameView::calculateMaximumScrollPosition() const
|
| +{
|
| // Make the same calculation as in CC's LayerImpl::MaxScrollOffset()
|
| // FIXME: We probably shouldn't be storing the bounds in a float. crbug.com/422331.
|
| IntSize visibleSize = visibleContentSize(ExcludeScrollbars) + topControlsSize();
|
| IntSize contentBounds = contentsSize();
|
| IntPoint maximumPosition = -scrollOrigin() + (contentBounds - visibleSize);
|
| - return maximumPosition.expandedTo(minimumScrollPosition());
|
| + return maximumPosition;
|
| }
|
|
|
| void FrameView::addChild(Widget* child)
|
| @@ -3287,6 +3306,17 @@ IntSize FrameView::contentsSize() const
|
|
|
| IntPoint FrameView::minimumScrollPosition() const
|
| {
|
| + if (m_scrollAndScaleEmulator) {
|
| + IntPoint minimum = calculateMinimumScrollPosition();
|
| + IntPoint maximum = calculateMaximumScrollPosition().expandedTo(minimum);
|
| + return m_scrollAndScaleEmulator->applyFramePositionOverride(minimum, minimum, maximum);
|
| + }
|
| +
|
| + return calculateMinimumScrollPosition();
|
| +}
|
| +
|
| +IntPoint FrameView::calculateMinimumScrollPosition() const
|
| +{
|
| return IntPoint(-scrollOrigin().x(), -scrollOrigin().y());
|
| }
|
|
|
|
|