| 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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 clamped = clampScrollPosition(scrollPositionDouble()); | 755 DoublePoint clamped = clampScrollPosition(scrollPositionDouble()); |
| 756 // Restore before clamping because clamping clears the scroll anchor. | 756 // Restore before clamping because clamping clears the scroll anchor. |
| 757 if (clamped != scrollPositionDouble() && shouldPerformScrollAnchoring() && m
_scrollAnchor.hasScroller()) { | 757 if (clamped != scrollPositionDouble() && shouldPerformScrollAnchoring()) { |
| 758 m_scrollAnchor.restore(); | 758 m_scrollAnchor.restore(); |
| 759 clamped = clampScrollPosition(scrollPositionDouble()); | 759 clamped = clampScrollPosition(scrollPositionDouble()); |
| 760 } | 760 } |
| 761 if (clamped != scrollPositionDouble() || scrollOriginChanged()) | 761 if (clamped != scrollPositionDouble() || scrollOriginChanged()) |
| 762 ScrollableArea::setScrollPosition(clamped, ProgrammaticScroll); | 762 ScrollableArea::setScrollPosition(clamped, ProgrammaticScroll); |
| 763 | 763 |
| 764 setNeedsScrollPositionClamp(false); | 764 setNeedsScrollPositionClamp(false); |
| 765 resetScrollOriginChanged(); | 765 resetScrollOriginChanged(); |
| 766 m_scrollbarManager.destroyDetachedScrollbars(); | 766 m_scrollbarManager.destroyDetachedScrollbars(); |
| 767 } | 767 } |
| 768 | 768 |
| 769 bool PaintLayerScrollableArea::shouldPerformScrollAnchoring() const |
| 770 { |
| 771 return RuntimeEnabledFeatures::scrollAnchoringEnabled() |
| 772 && m_scrollAnchor.hasScroller() |
| 773 && layoutBox()->style()->overflowAnchor() != AnchorNone; |
| 774 } |
| 775 |
| 769 ScrollBehavior PaintLayerScrollableArea::scrollBehaviorStyle() const | 776 ScrollBehavior PaintLayerScrollableArea::scrollBehaviorStyle() const |
| 770 { | 777 { |
| 771 return box().style()->getScrollBehavior(); | 778 return box().style()->getScrollBehavior(); |
| 772 } | 779 } |
| 773 | 780 |
| 774 bool PaintLayerScrollableArea::hasHorizontalOverflow() const | 781 bool PaintLayerScrollableArea::hasHorizontalOverflow() const |
| 775 { | 782 { |
| 776 // TODO(szager): Make the algorithm for adding/subtracting overflow:auto | 783 // TODO(szager): Make the algorithm for adding/subtracting overflow:auto |
| 777 // scrollbars memoryless (crbug.com/625300). This clientWidth hack will | 784 // scrollbars memoryless (crbug.com/625300). This clientWidth hack will |
| 778 // prevent the spurious horizontal scrollbar, but it can cause a converse | 785 // prevent the spurious horizontal scrollbar, but it can cause a converse |
| (...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1751 | 1758 |
| 1752 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre
as() | 1759 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre
as() |
| 1753 { | 1760 { |
| 1754 for (auto& scrollableArea : *s_needsClamp) | 1761 for (auto& scrollableArea : *s_needsClamp) |
| 1755 scrollableArea->clampScrollPositionsAfterLayout(); | 1762 scrollableArea->clampScrollPositionsAfterLayout(); |
| 1756 delete s_needsClamp; | 1763 delete s_needsClamp; |
| 1757 s_needsClamp = nullptr; | 1764 s_needsClamp = nullptr; |
| 1758 } | 1765 } |
| 1759 | 1766 |
| 1760 } // namespace blink | 1767 } // namespace blink |
| OLD | NEW |