Chromium Code Reviews| Index: Source/web/WebViewImpl.cpp |
| diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp |
| index c3bb8bde0a36465d823cec376a721c2b76cbac74..ed1dc3a65642e695c6c3f04c318a1c3961f417f1 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; |
| @@ -1708,23 +1703,27 @@ void WebViewImpl::performResize() |
| void WebViewImpl::setTopControlsShownRatio(float offset) |
|
Rick Byers
2015/02/19 16:38:38
looks like this no longer has any callers, remove
majidvp
2015/02/19 19:18:01
Done.
|
| { |
| - m_topControlsShownRatio = offset; |
| - m_layerTreeView->setTopControlsShownRatio(offset); |
| - didUpdateTopControls(); |
| + topControls().setShownRatio(offset); |
| } |
| void WebViewImpl::setTopControlsHeight(float height, bool topControlsShrinkLayoutSize) |
| { |
| - if (m_topControlsHeight == height && m_topControlsShrinkLayoutSize == topControlsShrinkLayoutSize) |
| - return; |
| + topControls().setHeight(height, topControlsShrinkLayoutSize); |
| +} |
| - m_topControlsHeight = height; |
| - m_topControlsShrinkLayoutSize = topControlsShrinkLayoutSize; |
| - didUpdateTopControls(); |
| +void WebViewImpl::updateTopControlsState(WebTopControlsState constraint, WebTopControlsState current, bool animate) |
| +{ |
| + 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 +1732,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 +1759,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 +4417,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 +4437,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); |