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

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

Issue 2220133002: Don't restore in LayoutBlock::layout if clamping is delayed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment Created 4 years, 4 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 | « third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp ('k') | no next file » | 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) 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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 // If a vertical scrollbar was removed, the min/max scroll positions may hav e changed, 749 // If a vertical scrollbar was removed, the min/max scroll positions may hav e changed,
750 // so the scroll positions needs to be clamped. If the scroll position did not change, 750 // so the scroll positions needs to be clamped. If the scroll position did not change,
751 // but the scroll origin *did* change, we still need to notify the scrollbar s to 751 // but the scroll origin *did* change, we still need to notify the scrollbar s to
752 // update their dimensions. 752 // update their dimensions.
753 753
754 if (DelayScrollPositionClampScope::clampingIsDelayed()) { 754 if (DelayScrollPositionClampScope::clampingIsDelayed()) {
755 DelayScrollPositionClampScope::setNeedsClamp(this); 755 DelayScrollPositionClampScope::setNeedsClamp(this);
756 return; 756 return;
757 } 757 }
758 758
759 // Restore before clamping because clamping clears the scroll anchor.
760 if (shouldPerformScrollAnchoring())
761 m_scrollAnchor.restore();
762
759 DoublePoint clamped = clampScrollPosition(scrollPositionDouble()); 763 DoublePoint clamped = clampScrollPosition(scrollPositionDouble());
760 // Restore before clamping because clamping clears the scroll anchor.
761 if (clamped != scrollPositionDouble() && shouldPerformScrollAnchoring()) {
762 m_scrollAnchor.restore();
763 clamped = clampScrollPosition(scrollPositionDouble());
764 }
765 if (clamped != scrollPositionDouble() || scrollOriginChanged()) 764 if (clamped != scrollPositionDouble() || scrollOriginChanged())
766 ScrollableArea::setScrollPosition(clamped, ProgrammaticScroll); 765 ScrollableArea::setScrollPosition(clamped, ProgrammaticScroll);
767 766
768 setNeedsScrollPositionClamp(false); 767 setNeedsScrollPositionClamp(false);
769 resetScrollOriginChanged(); 768 resetScrollOriginChanged();
770 m_scrollbarManager.destroyDetachedScrollbars(); 769 m_scrollbarManager.destroyDetachedScrollbars();
771 } 770 }
772 771
773 bool PaintLayerScrollableArea::shouldPerformScrollAnchoring() const 772 bool PaintLayerScrollableArea::shouldPerformScrollAnchoring() const
774 { 773 {
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 1771
1773 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre as() 1772 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre as()
1774 { 1773 {
1775 for (auto& scrollableArea : *s_needsClamp) 1774 for (auto& scrollableArea : *s_needsClamp)
1776 scrollableArea->clampScrollPositionsAfterLayout(); 1775 scrollableArea->clampScrollPositionsAfterLayout();
1777 delete s_needsClamp; 1776 delete s_needsClamp;
1778 s_needsClamp = nullptr; 1777 s_needsClamp = nullptr;
1779 } 1778 }
1780 1779
1781 } // namespace blink 1780 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698