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

Unified Diff: Source/core/frame/FrameView.cpp

Issue 560623002: Adjust maximum scroll bounds on FrameView to account for top controls. (Blink-side) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 3 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
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/web/WebViewImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/FrameView.cpp
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp
index db086a297a05c4ca4766b3881c9a735b77a24190..9cf738f77cc63f9af8259aa55e4da0ad0c04b484 100644
--- a/Source/core/frame/FrameView.cpp
+++ b/Source/core/frame/FrameView.cpp
@@ -121,6 +121,7 @@ FrameView::FrameView(LocalFrame* frame)
, m_layoutSizeFixedToFrameSize(true)
, m_didScrollTimer(this, &FrameView::didScrollTimerFired)
, m_needsUpdateWidgetPositions(false)
+ , m_topControlsViewportAdjustment(0)
{
ASSERT(m_frame);
init();
@@ -3008,4 +3009,23 @@ void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
}
}
+void FrameView::setTopControlsViewportAdjustment(float adjustment)
+{
+ m_topControlsViewportAdjustment = adjustment;
+}
+
+IntPoint FrameView::maximumScrollPosition() const
+{
+ FloatSize visibleContentSizeF = unscaledVisibleContentSize(ExcludeScrollbars);
+ visibleContentSizeF.expand(0, -m_topControlsViewportAdjustment);
+ visibleContentSizeF.scale(1 / visibleContentScaleFactor());
+ IntSize visibleSize = expandedIntSize(visibleContentSizeF);
+
+ IntPoint maximumOffset(
+ contentsWidth() - visibleSize.width() - scrollOrigin().x(),
+ contentsHeight() - visibleSize.height() - scrollOrigin().y());
+ maximumOffset.clampNegativeToZero();
+ return maximumOffset;
+}
+
} // namespace blink
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/web/WebViewImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698