| Index: Source/web/WebViewImpl.cpp
|
| diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
|
| index 06e1c3efd3a9d6a137123b869811287b1502407b..5112ad5cacdb515248cd5ebbc9375bcb4c802816 100644
|
| --- a/Source/web/WebViewImpl.cpp
|
| +++ b/Source/web/WebViewImpl.cpp
|
| @@ -413,7 +413,9 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
|
| , m_zoomFactorOverride(0)
|
| , m_userGestureObserved(false)
|
| , m_topControlsContentOffset(0)
|
| - , m_topControlsLayoutHeight(0)
|
| + , m_topControlsHeight(0)
|
| + , m_topControlsShrinkLayoutSize(true)
|
| + , m_topControlsOffsetIsNormalized(true)
|
| {
|
| Page::PageClients pageClients;
|
| pageClients.chromeClient = &m_chromeClientImpl;
|
| @@ -1726,7 +1728,17 @@ void WebViewImpl::setTopControlsContentOffset(float offset)
|
|
|
| void WebViewImpl::setTopControlsLayoutHeight(float height)
|
| {
|
| - m_topControlsLayoutHeight = height;
|
| + m_topControlsOffsetIsNormalized = false;
|
| + setTopControlsHeight(height, true);
|
| +}
|
| +
|
| +void WebViewImpl::setTopControlsHeight(float height, bool topControlsShrinkLayoutSize)
|
| +{
|
| + if (m_topControlsHeight == height && m_topControlsShrinkLayoutSize == topControlsShrinkLayoutSize)
|
| + return;
|
| +
|
| + m_topControlsHeight = height;
|
| + m_topControlsShrinkLayoutSize = topControlsShrinkLayoutSize;
|
| didUpdateTopControls();
|
| }
|
|
|
| @@ -1740,7 +1752,11 @@ void WebViewImpl::didUpdateTopControls()
|
| if (!view)
|
| return;
|
|
|
| - float topControlsViewportAdjustment = m_topControlsLayoutHeight - m_topControlsContentOffset;
|
| + float topControlsViewportAdjustment = 0;
|
| + if (m_topControlsShrinkLayoutSize)
|
| + topControlsViewportAdjustment += m_topControlsHeight;
|
| + topControlsViewportAdjustment -= m_topControlsContentOffset * (m_topControlsOffsetIsNormalized ? m_topControlsHeight : 1);
|
| +
|
| if (!pinchVirtualViewportEnabled()) {
|
| // 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
|
|
|