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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp

Issue 2152773002: Make scroll anchoring adjustment when the bounds of a scroller is changed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Call restore from PLSA/FV Created 4 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@gmail.com> 9 * Christian Biesinger <cbiesinger@gmail.com>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 // If a vertical scrollbar was removed, the min/max scroll positions may hav e changed, 745 // If a vertical scrollbar was removed, the min/max scroll positions may hav e changed,
746 // so the scroll positions needs to be clamped. If the scroll position did not change, 746 // so the scroll positions needs to be clamped. If the scroll position did not change,
747 // but the scroll origin *did* change, we still need to notify the scrollbar s to 747 // but the scroll origin *did* change, we still need to notify the scrollbar s to
748 // update their dimensions. 748 // update their dimensions.
749 749
750 if (DelayScrollPositionClampScope::clampingIsDelayed()) { 750 if (DelayScrollPositionClampScope::clampingIsDelayed()) {
751 DelayScrollPositionClampScope::setNeedsClamp(this); 751 DelayScrollPositionClampScope::setNeedsClamp(this);
752 return; 752 return;
753 } 753 }
754 754
755 DoublePoint clampedScrollPosition = clampScrollPosition(scrollPositionDouble ()); 755 DoublePoint clamped = clampScrollPosition(scrollPositionDouble());
756 if (clampedScrollPosition != scrollPositionDouble()) 756 if (clamped != scrollPositionDouble() || scrollOriginChanged()) {
757 ScrollableArea::setScrollPosition(clampedScrollPosition, ProgrammaticScr oll); 757 // Since the scroll bounds have changed and the scroller is at a positio n
758 else if (scrollOriginChanged()) 758 // that is outside its new bounds. Calling ScrollAnchor::restore
759 scrollPositionChanged(clampedScrollPosition, ProgrammaticScroll); 759 // ensures that no visible jump is seen when clamping.
760 if (shouldPerformScrollAnchoring() && m_scrollAnchor.hasScroller()) {
761 m_scrollAnchor.restore();
762 clamped = clampScrollPosition(scrollPositionDouble());
763 }
764 if (clamped != scrollPositionDouble())
765 ScrollableArea::setScrollPosition(clamped, ProgrammaticScroll);
766 resetScrollOriginChanged();
767 }
760 768
761 setNeedsScrollPositionClamp(false); 769 setNeedsScrollPositionClamp(false);
762 resetScrollOriginChanged();
763 m_scrollbarManager.destroyDetachedScrollbars(); 770 m_scrollbarManager.destroyDetachedScrollbars();
764 } 771 }
765 772
766 ScrollBehavior PaintLayerScrollableArea::scrollBehaviorStyle() const 773 ScrollBehavior PaintLayerScrollableArea::scrollBehaviorStyle() const
767 { 774 {
768 return box().style()->getScrollBehavior(); 775 return box().style()->getScrollBehavior();
769 } 776 }
770 777
771 bool PaintLayerScrollableArea::hasHorizontalOverflow() const 778 bool PaintLayerScrollableArea::hasHorizontalOverflow() const
772 { 779 {
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
1748 1755
1749 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre as() 1756 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre as()
1750 { 1757 {
1751 for (auto& scrollableArea : *s_needsClamp) 1758 for (auto& scrollableArea : *s_needsClamp)
1752 scrollableArea->clampScrollPositionsAfterLayout(); 1759 scrollableArea->clampScrollPositionsAfterLayout();
1753 delete s_needsClamp; 1760 delete s_needsClamp;
1754 s_needsClamp = nullptr; 1761 s_needsClamp = nullptr;
1755 } 1762 }
1756 1763
1757 } // namespace blink 1764 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698