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

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: 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/frame/PinchViewport.h » ('j') | no next file with comments »
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 3064 matching lines...) Expand 10 before | Expand all | Expand 10 after
3075 } 3075 }
3076 } 3076 }
3077 3077
3078 void FrameView::setTopControlsViewportAdjustment(float adjustment) 3078 void FrameView::setTopControlsViewportAdjustment(float adjustment)
3079 { 3079 {
3080 m_topControlsViewportAdjustment = adjustment; 3080 m_topControlsViewportAdjustment = adjustment;
3081 } 3081 }
3082 3082
3083 IntPoint FrameView::maximumScrollPosition() const 3083 IntPoint FrameView::maximumScrollPosition() const
3084 { 3084 {
3085 FloatSize visibleContentSizeF = unscaledVisibleContentSize(ExcludeScrollbars ); 3085 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset()
3086 visibleContentSizeF.expand(0, -m_topControlsViewportAdjustment); 3086 // FIXME: We probably shouldn't be storing the bounds in a float. crbug.com/ 422331.
3087 visibleContentSizeF.scale(1 / visibleContentScaleFactor()); 3087 FloatSize visibleSize = unscaledVisibleContentSize(ExcludeScrollbars);
3088 IntSize visibleSize = expandedIntSize(visibleContentSizeF); 3088 visibleSize.expand(0, m_topControlsViewportAdjustment);
3089 3089
3090 IntPoint maximumOffset( 3090 FloatSize contentBounds = contentsSize();
3091 contentsWidth() - visibleSize.width() - scrollOrigin().x(), 3091 contentBounds.scale(visibleContentScaleFactor());
3092 contentsHeight() - visibleSize.height() - scrollOrigin().y()); 3092 contentBounds = flooredIntSize(contentBounds);
3093 maximumOffset.clampNegativeToZero(); 3093
3094 return maximumOffset; 3094 FloatSize maximumOffset = contentBounds - visibleSize - toIntSize(scrollOrig in());
3095
3096 // Convert back to CSS pixels.
3097 maximumOffset.scale(1 / visibleContentScaleFactor());
3098
3099 IntPoint snappedMaximumOffset = flooredIntPoint(maximumOffset);
3100 snappedMaximumOffset.clampNegativeToZero();
3101 return snappedMaximumOffset;
3095 } 3102 }
3096 3103
3097 void FrameView::addChild(PassRefPtrWillBeRawPtr<Widget> prpChild) 3104 void FrameView::addChild(PassRefPtrWillBeRawPtr<Widget> prpChild)
3098 { 3105 {
3099 Widget* child = prpChild.get(); 3106 Widget* child = prpChild.get();
3100 ASSERT(child != this && !child->parent()); 3107 ASSERT(child != this && !child->parent());
3101 child->setParent(this); 3108 child->setParent(this);
3102 m_children.add(prpChild); 3109 m_children.add(prpChild);
3103 } 3110 }
3104 3111
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
4210 return; 4217 return;
4211 4218
4212 ScrollableArea::setScrollOrigin(origin); 4219 ScrollableArea::setScrollOrigin(origin);
4213 4220
4214 // Update if the scroll origin changes, since our position will be different if the content size did not change. 4221 // Update if the scroll origin changes, since our position will be different if the content size did not change.
4215 if (updatePositionAtAll && updatePositionSynchronously) 4222 if (updatePositionAtAll && updatePositionSynchronously)
4216 updateScrollbars(scrollOffsetDouble()); 4223 updateScrollbars(scrollOffsetDouble());
4217 } 4224 }
4218 4225
4219 } // namespace blink 4226 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/frame/PinchViewport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698