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

Unified Diff: Source/web/WebViewImpl.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: 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
Index: Source/web/WebViewImpl.cpp
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
index ed67d3c13a51a80ff78c4f222a4cc9401e4a4ea7..95d534df922d3afb4f64f6f8e8bd8c835b4762fd 100644
--- a/Source/web/WebViewImpl.cpp
+++ b/Source/web/WebViewImpl.cpp
@@ -414,6 +414,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
, m_zoomFactorOverride(0)
, m_userGestureObserved(false)
, m_topControlsContentOffset(0)
+ , m_topControlsLayoutHeight(0)
{
Page::PageClients pageClients;
pageClients.chromeClient = &m_chromeClientImpl;
@@ -1666,6 +1667,26 @@ void WebViewImpl::setTopControlsContentOffset(float offset)
{
m_topControlsContentOffset = offset;
m_layerTreeView->setTopControlsContentOffset(offset);
+ didUpdateTopControls();
+}
+
+void WebViewImpl::setTopControlsLayoutHeight(float height)
+{
+ m_topControlsLayoutHeight = height;
+ didUpdateTopControls();
+}
+
+void WebViewImpl::didUpdateTopControls()
+{
+ FrameView* view = localFrameRootTemporary()->frameView();
+ if (!view)
+ return;
+
+ // The viewport bounds were adjusted on the compositor by this much due to top controls. Tell
+ // the FrameView about it so it can make correct scroll offset clamping decisions during compositor
+ // commits.
+ float topControlsViewportAdjustment = m_topControlsContentOffset - m_topControlsLayoutHeight;
+ view->setTopControlsViewportAdjustment(topControlsViewportAdjustment);
bokan 2014/09/09 23:14:19 There's also a Chromium-side patch that just calls
aelias_OOO_until_Jul13 2014/09/10 01:57:29 If you prefer, you could also avoid the third patc
bokan 2014/09/10 13:51:52 One liners like that are easy enough to land + I'd
aelias_OOO_until_Jul13 2014/09/10 15:51:45 Yes, feel free to TBR that and mention I preapprov
}
void WebViewImpl::resize(const WebSize& newSize)

Powered by Google App Engine
This is Rietveld 408576698