| OLD | NEW |
| 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 Loading... |
| 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 // Restore before clamping because clamping clears the scroll anchor. |
| 757 ScrollableArea::setScrollPosition(clampedScrollPosition, ProgrammaticScr
oll); | 757 if (clamped != scrollPositionDouble() && shouldPerformScrollAnchoring() && m
_scrollAnchor.hasScroller()) { |
| 758 else if (scrollOriginChanged()) | 758 m_scrollAnchor.restore(); |
| 759 scrollPositionChanged(clampedScrollPosition, ProgrammaticScroll); | 759 clamped = clampScrollPosition(scrollPositionDouble()); |
| 760 } |
| 761 if (clamped != scrollPositionDouble() || scrollOriginChanged()) |
| 762 ScrollableArea::setScrollPosition(clamped, ProgrammaticScroll); |
| 760 | 763 |
| 761 setNeedsScrollPositionClamp(false); | 764 setNeedsScrollPositionClamp(false); |
| 762 resetScrollOriginChanged(); | 765 resetScrollOriginChanged(); |
| 763 m_scrollbarManager.destroyDetachedScrollbars(); | 766 m_scrollbarManager.destroyDetachedScrollbars(); |
| 764 } | 767 } |
| 765 | 768 |
| 766 ScrollBehavior PaintLayerScrollableArea::scrollBehaviorStyle() const | 769 ScrollBehavior PaintLayerScrollableArea::scrollBehaviorStyle() const |
| 767 { | 770 { |
| 768 return box().style()->getScrollBehavior(); | 771 return box().style()->getScrollBehavior(); |
| 769 } | 772 } |
| (...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1748 | 1751 |
| 1749 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre
as() | 1752 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre
as() |
| 1750 { | 1753 { |
| 1751 for (auto& scrollableArea : *s_needsClamp) | 1754 for (auto& scrollableArea : *s_needsClamp) |
| 1752 scrollableArea->clampScrollPositionsAfterLayout(); | 1755 scrollableArea->clampScrollPositionsAfterLayout(); |
| 1753 delete s_needsClamp; | 1756 delete s_needsClamp; |
| 1754 s_needsClamp = nullptr; | 1757 s_needsClamp = nullptr; |
| 1755 } | 1758 } |
| 1756 | 1759 |
| 1757 } // namespace blink | 1760 } // namespace blink |
| OLD | NEW |