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

Unified Diff: Source/core/frame/FrameView.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: 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 | « no previous file | Source/core/frame/PinchViewport.h » ('j') | Source/core/frame/PinchViewport.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/FrameView.cpp
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp
index d1ecd0e3d8646ec5e40a986d3267757a11098927..c624571071978f587f78ea06b492446697a45037 100644
--- a/Source/core/frame/FrameView.cpp
+++ b/Source/core/frame/FrameView.cpp
@@ -3030,16 +3030,22 @@ void FrameView::setTopControlsViewportAdjustment(float adjustment)
IntPoint FrameView::maximumScrollPosition() const
{
- FloatSize visibleContentSizeF = unscaledVisibleContentSize(ExcludeScrollbars);
- visibleContentSizeF.expand(0, -m_topControlsViewportAdjustment);
- visibleContentSizeF.scale(1 / visibleContentScaleFactor());
- IntSize visibleSize = expandedIntSize(visibleContentSizeF);
-
- IntPoint maximumOffset(
- contentsWidth() - visibleSize.width() - scrollOrigin().x(),
- contentsHeight() - visibleSize.height() - scrollOrigin().y());
- maximumOffset.clampNegativeToZero();
- return maximumOffset;
+ // Make the same calculation as in CC's LayerImpl::MaxScrollOffset()
+ FloatSize visibleSize = unscaledVisibleContentSize(ExcludeScrollbars);
+ visibleSize.expand(0, m_topControlsViewportAdjustment);
+
+ FloatSize contentBounds = contentsSize();
+ contentBounds.scale(visibleContentScaleFactor());
+ contentBounds = flooredIntSize(contentBounds);
+
+ FloatSize maximumOffset = contentBounds - visibleSize - toIntSize(scrollOrigin());
+
+ // Convert back to CSS pixels.
+ maximumOffset.scale(1 / visibleContentScaleFactor());
+
+ IntPoint snappedMaximumOffset = flooredIntPoint(maximumOffset);
+ snappedMaximumOffset.clampNegativeToZero();
+ return snappedMaximumOffset;
}
} // namespace blink
« no previous file with comments | « no previous file | Source/core/frame/PinchViewport.h » ('j') | Source/core/frame/PinchViewport.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698