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

Side by Side Diff: Source/core/frame/FrameView.cpp

Issue 1208433002: Replaced adjustScrollPositionWithinRange with clampScrollPosition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Unremoved DoublePoint version of FrameView::setScrollOffset Created 5 years, 6 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/RootFrameViewport.cpp » ('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 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 if (layoutView && layoutView->needsLayout()) 1484 if (layoutView && layoutView->needsLayout())
1485 layout(); 1485 layout();
1486 else 1486 else
1487 scrollToAnchor(); 1487 scrollToAnchor();
1488 } 1488 }
1489 1489
1490 void FrameView::setScrollPosition(const DoublePoint& scrollPoint, ScrollType scr ollType, ScrollBehavior scrollBehavior) 1490 void FrameView::setScrollPosition(const DoublePoint& scrollPoint, ScrollType scr ollType, ScrollBehavior scrollBehavior)
1491 { 1491 {
1492 m_maintainScrollPositionAnchor = nullptr; 1492 m_maintainScrollPositionAnchor = nullptr;
1493 1493
1494 DoublePoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint) ; 1494 DoublePoint newScrollPosition = clampScrollPosition(scrollPoint);
1495 if (newScrollPosition == scrollPositionDouble()) 1495 if (newScrollPosition == scrollPositionDouble())
1496 return; 1496 return;
1497 1497
1498 if (scrollBehavior == ScrollBehaviorAuto) 1498 if (scrollBehavior == ScrollBehaviorAuto)
1499 scrollBehavior = scrollBehaviorStyle(); 1499 scrollBehavior = scrollBehaviorStyle();
1500 1500
1501 ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollBehav ior); 1501 ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollBehav ior);
1502 } 1502 }
1503 1503
1504 void FrameView::setElasticOverscroll(const FloatSize& elasticOverscroll) 1504 void FrameView::setElasticOverscroll(const FloatSize& elasticOverscroll)
(...skipping 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after
3191 IntSize scrollSize = m_contentsSize - visibleContentRect().size(); 3191 IntSize scrollSize = m_contentsSize - visibleContentRect().size();
3192 scrollSize.clampNegativeToZero(); 3192 scrollSize.clampNegativeToZero();
3193 return orientation == HorizontalScrollbar ? scrollSize.width() : scrollS ize.height(); 3193 return orientation == HorizontalScrollbar ? scrollSize.width() : scrollS ize.height();
3194 } 3194 }
3195 3195
3196 return scrollbar->totalSize() - scrollbar->visibleSize(); 3196 return scrollbar->totalSize() - scrollbar->visibleSize();
3197 } 3197 }
3198 3198
3199 void FrameView::setScrollOffset(const IntPoint& offset, ScrollType) 3199 void FrameView::setScrollOffset(const IntPoint& offset, ScrollType)
3200 { 3200 {
3201 scrollTo(DoublePoint(adjustScrollPositionWithinRange(offset))); 3201 scrollTo(clampScrollPosition(offset));
3202 } 3202 }
3203 3203
3204 void FrameView::setScrollOffset(const DoublePoint& offset, ScrollType) 3204 void FrameView::setScrollOffset(const DoublePoint& offset, ScrollType)
3205 { 3205 {
3206 scrollTo(adjustScrollPositionWithinRange(offset)); 3206 scrollTo(clampScrollPosition(offset));
3207 } 3207 }
3208 3208
3209 void FrameView::windowResizerRectChanged() 3209 void FrameView::windowResizerRectChanged()
3210 { 3210 {
3211 updateScrollbars(scrollOffsetDouble()); 3211 updateScrollbars(scrollOffsetDouble());
3212 } 3212 }
3213 3213
3214 bool FrameView::hasOverlayScrollbars() const 3214 bool FrameView::hasOverlayScrollbars() const
3215 { 3215 {
3216 3216
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
3431 invalidateRect(IntRect(oldVisibleSize.width(), 0, newVisibleSize.wid th() - oldVisibleSize.width(), newVisibleSize.height())); 3431 invalidateRect(IntRect(oldVisibleSize.width(), 0, newVisibleSize.wid th() - oldVisibleSize.width(), newVisibleSize.height()));
3432 } 3432 }
3433 if (newVisibleSize.height() > oldVisibleSize.height()) 3433 if (newVisibleSize.height() > oldVisibleSize.height())
3434 invalidateRect(IntRect(0, oldVisibleSize.height(), newVisibleSize.width( ), newVisibleSize.height() - oldVisibleSize.height())); 3434 invalidateRect(IntRect(0, oldVisibleSize.height(), newVisibleSize.width( ), newVisibleSize.height() - oldVisibleSize.height()));
3435 3435
3436 setScrollOffsetFromUpdateScrollbars(desiredOffset); 3436 setScrollOffsetFromUpdateScrollbars(desiredOffset);
3437 } 3437 }
3438 3438
3439 void FrameView::setScrollOffsetFromUpdateScrollbars(const DoubleSize& offset) 3439 void FrameView::setScrollOffsetFromUpdateScrollbars(const DoubleSize& offset)
3440 { 3440 {
3441 DoublePoint adjustedScrollPosition = DoublePoint(offset); 3441 DoublePoint adjustedScrollPosition = clampScrollPosition(DoublePoint(offset) );
3442
3443 adjustedScrollPosition = adjustScrollPositionWithinRange(adjustedScrollPosit ion);
3444 3442
3445 if (adjustedScrollPosition != scrollPositionDouble() || scrollOriginChanged( )) { 3443 if (adjustedScrollPosition != scrollPositionDouble() || scrollOriginChanged( )) {
3446 ScrollableArea::setScrollPosition(adjustedScrollPosition, ProgrammaticSc roll); 3444 ScrollableArea::setScrollPosition(adjustedScrollPosition, ProgrammaticSc roll);
3447 resetScrollOriginChanged(); 3445 resetScrollOriginChanged();
3448 } 3446 }
3449 } 3447 }
3450 3448
3451 const int panIconSizeLength = 16; 3449 const int panIconSizeLength = 16;
3452 3450
3453 IntRect FrameView::rectToCopyOnScroll() const 3451 IntRect FrameView::rectToCopyOnScroll() const
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
3975 3973
3976 if (!graphicsLayer) 3974 if (!graphicsLayer)
3977 return; 3975 return;
3978 3976
3979 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect); 3977 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect);
3980 3978
3981 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect))); 3979 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect)));
3982 } 3980 }
3983 3981
3984 } // namespace blink 3982 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/frame/RootFrameViewport.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698