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

Unified Diff: Source/web/WebViewImpl.cpp

Issue 643473002: Made top controls work with virtual viewport pinch-to-zoom. (Blink) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed mac breakage (UseMockScrollbars) Created 6 years, 2 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/web/PageScaleConstraintsSet.cpp ('k') | Source/web/tests/FrameTestHelpers.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebViewImpl.cpp
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
index 86c2479776e064a3dae50b827773ccfb6bb68ff0..8b5e1b11dcb9f966d15836eeb3bc8bad0f6809dc 100644
--- a/Source/web/WebViewImpl.cpp
+++ b/Source/web/WebViewImpl.cpp
@@ -1716,11 +1716,22 @@ void WebViewImpl::didUpdateTopControls()
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);
+ float topControlsViewportAdjustment = m_topControlsLayoutHeight - m_topControlsContentOffset;
+ 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
+ // commits.
+ view->setTopControlsViewportAdjustment(topControlsViewportAdjustment);
+ } else {
+ PinchViewport& pinchViewport = page()->frameHost().pinchViewport();
+ pinchViewport.setTopControlsAdjustment(topControlsViewportAdjustment);
+
+ // Shrink the FrameView by the amount that will maintain the aspect-ratio with the PinchViewport.
+ float aspectRatio = pinchViewport.visibleRect().width() / pinchViewport.visibleRect().height();
+ float newHeight = view->unscaledVisibleContentSize(ExcludeScrollbars).width() / aspectRatio;
+ float adjustment = newHeight - view->unscaledVisibleContentSize(ExcludeScrollbars).height();
+ view->setTopControlsViewportAdjustment(adjustment);
+ }
}
void WebViewImpl::resize(const WebSize& newSize)
« no previous file with comments | « Source/web/PageScaleConstraintsSet.cpp ('k') | Source/web/tests/FrameTestHelpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698