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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/frame/PinchViewport.h » ('j') | Source/core/frame/PinchViewport.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 3012 matching lines...) Expand 10 before | Expand all | Expand 10 after
3023 } 3023 }
3024 } 3024 }
3025 3025
3026 void FrameView::setTopControlsViewportAdjustment(float adjustment) 3026 void FrameView::setTopControlsViewportAdjustment(float adjustment)
3027 { 3027 {
3028 m_topControlsViewportAdjustment = adjustment; 3028 m_topControlsViewportAdjustment = adjustment;
3029 } 3029 }
3030 3030
3031 IntPoint FrameView::maximumScrollPosition() const 3031 IntPoint FrameView::maximumScrollPosition() const
3032 { 3032 {
3033 FloatSize visibleContentSizeF = unscaledVisibleContentSize(ExcludeScrollbars ); 3033 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset()
3034 visibleContentSizeF.expand(0, -m_topControlsViewportAdjustment); 3034 FloatSize visibleSize = unscaledVisibleContentSize(ExcludeScrollbars);
3035 visibleContentSizeF.scale(1 / visibleContentScaleFactor()); 3035 visibleSize.expand(0, m_topControlsViewportAdjustment);
3036 IntSize visibleSize = expandedIntSize(visibleContentSizeF);
3037 3036
3038 IntPoint maximumOffset( 3037 FloatSize contentBounds = contentsSize();
3039 contentsWidth() - visibleSize.width() - scrollOrigin().x(), 3038 contentBounds.scale(visibleContentScaleFactor());
3040 contentsHeight() - visibleSize.height() - scrollOrigin().y()); 3039 contentBounds = flooredIntSize(contentBounds);
3041 maximumOffset.clampNegativeToZero(); 3040
3042 return maximumOffset; 3041 FloatSize maximumOffset = contentBounds - visibleSize - toIntSize(scrollOrig in());
3042
3043 // Convert back to CSS pixels.
3044 maximumOffset.scale(1 / visibleContentScaleFactor());
3045
3046 IntPoint snappedMaximumOffset = flooredIntPoint(maximumOffset);
3047 snappedMaximumOffset.clampNegativeToZero();
3048 return snappedMaximumOffset;
3043 } 3049 }
3044 3050
3045 } // namespace blink 3051 } // namespace blink
OLDNEW
« 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