| Index: Source/web/WebViewImpl.cpp
|
| diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
|
| index c3bb8bde0a36465d823cec376a721c2b76cbac74..ac7405e03e5dbee7541b793fa1fa1573b79d6091 100644
|
| --- a/Source/web/WebViewImpl.cpp
|
| +++ b/Source/web/WebViewImpl.cpp
|
| @@ -56,6 +56,7 @@
|
| #include "core/frame/RemoteFrame.h"
|
| #include "core/frame/Settings.h"
|
| #include "core/frame/SmartClip.h"
|
| +#include "core/frame/TopControls.h"
|
| #include "core/html/HTMLInputElement.h"
|
| #include "core/html/HTMLMediaElement.h"
|
| #include "core/html/HTMLPlugInElement.h"
|
| @@ -413,9 +414,6 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
|
| , m_backgroundColorOverride(Color::transparent)
|
| , m_zoomFactorOverride(0)
|
| , m_userGestureObserved(false)
|
| - , m_topControlsShownRatio(0)
|
| - , m_topControlsHeight(0)
|
| - , m_topControlsShrinkLayoutSize(true)
|
| {
|
| Page::PageClients pageClients;
|
| pageClients.chromeClient = &m_chromeClientImpl;
|
| @@ -708,9 +706,6 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event)
|
| case WebInputEvent::GesturePinchBegin:
|
| case WebInputEvent::GesturePinchEnd:
|
| case WebInputEvent::GesturePinchUpdate:
|
| - // Gesture pinch events are aborted in PageWidgetDelegate::handleInputEvent and should
|
| - // not reach here.
|
| - ASSERT_NOT_REACHED();
|
| return false;
|
| default:
|
| break;
|
| @@ -1706,25 +1701,24 @@ void WebViewImpl::performResize()
|
| }
|
| }
|
|
|
| -void WebViewImpl::setTopControlsShownRatio(float offset)
|
| +void WebViewImpl::setTopControlsHeight(float height, bool topControlsShrinkLayoutSize)
|
| {
|
| - m_topControlsShownRatio = offset;
|
| - m_layerTreeView->setTopControlsShownRatio(offset);
|
| - didUpdateTopControls();
|
| + topControls().setHeight(height, topControlsShrinkLayoutSize);
|
| }
|
|
|
| -void WebViewImpl::setTopControlsHeight(float height, bool topControlsShrinkLayoutSize)
|
| +void WebViewImpl::updateTopControlsState(WebTopControlsState constraint, WebTopControlsState current, bool animate)
|
| {
|
| - if (m_topControlsHeight == height && m_topControlsShrinkLayoutSize == topControlsShrinkLayoutSize)
|
| - return;
|
| -
|
| - m_topControlsHeight = height;
|
| - m_topControlsShrinkLayoutSize = topControlsShrinkLayoutSize;
|
| - didUpdateTopControls();
|
| + topControls().updateConstraints(constraint);
|
| + m_layerTreeView->updateTopControlsState(constraint, current, animate);
|
| }
|
|
|
| void WebViewImpl::didUpdateTopControls()
|
| {
|
| + if (m_layerTreeView) {
|
| + m_layerTreeView->setTopControlsShownRatio(topControls().shownRatio());
|
| + m_layerTreeView->setTopControlsHeight(topControls().height(), topControls().shrinkViewport());
|
| + }
|
| +
|
| WebLocalFrameImpl* mainFrame = mainFrameImpl();
|
| if (!mainFrame)
|
| return;
|
| @@ -1733,10 +1727,7 @@ void WebViewImpl::didUpdateTopControls()
|
| if (!view)
|
| return;
|
|
|
| - float topControlsViewportAdjustment = 0;
|
| - if (m_topControlsShrinkLayoutSize)
|
| - topControlsViewportAdjustment += m_topControlsHeight;
|
| - topControlsViewportAdjustment -= m_topControlsShownRatio * m_topControlsHeight;
|
| + float topControlsViewportAdjustment = topControls().layoutHeight() - topControls().contentOffset();
|
|
|
| if (!pinchVirtualViewportEnabled()) {
|
| // The viewport bounds were adjusted on the compositor by this much due to top controls. Tell
|
| @@ -1763,6 +1754,11 @@ void WebViewImpl::didUpdateTopControls()
|
| }
|
| }
|
|
|
| +TopControls& WebViewImpl::topControls()
|
| +{
|
| + return page()->frameHost().topControls();
|
| +}
|
| +
|
| void WebViewImpl::resize(const WebSize& newSize)
|
| {
|
| if (m_shouldAutoResize || m_size == newSize)
|
| @@ -4416,7 +4412,7 @@ void WebViewImpl::applyViewportDeltas(
|
| if (!frameView)
|
| return;
|
|
|
| - setTopControlsShownRatio(m_topControlsShownRatio + topControlsShownRatioDelta);
|
| + topControls().setShownRatio(topControls().shownRatio() + topControlsShownRatioDelta);
|
|
|
| FloatPoint pinchViewportOffset = page()->frameHost().pinchViewport().visibleRect().location();
|
| pinchViewportOffset.move(pinchViewportDelta.width, pinchViewportDelta.height);
|
| @@ -4436,7 +4432,7 @@ void WebViewImpl::applyViewportDeltas(const WebSize& scrollDelta, float pageScal
|
| if (!mainFrameImpl() || !mainFrameImpl()->frameView())
|
| return;
|
|
|
| - setTopControlsShownRatio(m_topControlsShownRatio + topControlsShownRatioDelta);
|
| + topControls().setShownRatio(topControls().shownRatio() + topControlsShownRatioDelta);
|
|
|
| if (pageScaleDelta == 1) {
|
| TRACE_EVENT_INSTANT2("blink", "WebViewImpl::applyScrollAndScale::scrollBy", "x", scrollDelta.width, "y", scrollDelta.height);
|
|
|