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 10897245dab43bf655cf30e9ef7aeae6ede030ae..4796d60d8ac57431ad44e78dcf2f4ee3bd72f6fb 100644 |
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp |
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp |
@@ -44,6 +44,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" |
@@ -1603,6 +1604,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(); |
@@ -3172,12 +3179,23 @@ 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).shrunkTo(maximum).expandedTo(minimum); |
+ |
+ 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) |
@@ -3296,6 +3314,18 @@ IntSize FrameView::contentsSize() const |
IntPoint FrameView::minimumScrollPosition() const |
{ |
+ IntPoint minimum = calculateMinimumScrollPosition(); |
+ |
+ if (m_scrollAndScaleEmulator) { |
+ IntPoint maximum = calculateMaximumScrollPosition().expandedTo(minimum); |
bokan
2016/07/04 22:44:09
Move this outside this if and remove braces (make
Eric Seckler
2016/07/05 16:46:51
Done.
|
+ return m_scrollAndScaleEmulator->applyFramePositionOverride(minimum).shrunkTo(maximum).expandedTo(minimum); |
+ } |
+ |
+ return minimum; |
+} |
+ |
+IntPoint FrameView::calculateMinimumScrollPosition() const |
+{ |
return IntPoint(-scrollOrigin().x(), -scrollOrigin().y()); |
} |