| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * | 4 * |
| 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 6 * | 6 * |
| 7 * Other contributors: | 7 * Other contributors: |
| 8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
| 10 * Christian Biesinger <cbiesinger@gmail.com> | 10 * Christian Biesinger <cbiesinger@gmail.com> |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 } | 777 } |
| 778 } | 778 } |
| 779 | 779 |
| 780 if (!scrollbarsAreFrozen && hasOverlayScrollbars()) { | 780 if (!scrollbarsAreFrozen && hasOverlayScrollbars()) { |
| 781 if (!scrollSize(HorizontalScrollbar)) | 781 if (!scrollSize(HorizontalScrollbar)) |
| 782 setHasHorizontalScrollbar(false); | 782 setHasHorizontalScrollbar(false); |
| 783 if (!scrollSize(VerticalScrollbar)) | 783 if (!scrollSize(VerticalScrollbar)) |
| 784 setHasVerticalScrollbar(false); | 784 setHasVerticalScrollbar(false); |
| 785 } | 785 } |
| 786 | 786 |
| 787 clampScrollOffsetsAfterLayout(); | 787 clampScrollOffsetAfterOverflowChange(); |
| 788 | 788 |
| 789 if (!scrollbarsAreFrozen) { | 789 if (!scrollbarsAreFrozen) { |
| 790 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || | 790 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || |
| 791 hasScrollableVerticalOverflow()); | 791 hasScrollableVerticalOverflow()); |
| 792 } | 792 } |
| 793 | 793 |
| 794 DisableCompositingQueryAsserts disabler; | 794 DisableCompositingQueryAsserts disabler; |
| 795 positionOverflowControls(); | 795 positionOverflowControls(); |
| 796 } | 796 } |
| 797 | 797 |
| 798 void PaintLayerScrollableArea::clampScrollOffsetsAfterLayout() { | 798 void PaintLayerScrollableArea::clampScrollOffsetAfterOverflowChange() { |
| 799 // If a vertical scrollbar was removed, the min/max scroll offsets may have | 799 // If a vertical scrollbar was removed, the min/max scroll offsets may have |
| 800 // changed, so the scroll offsets needs to be clamped. If the scroll offset | 800 // changed, so the scroll offsets needs to be clamped. If the scroll offset |
| 801 // did not change, but the scroll origin *did* change, we still need to notify | 801 // did not change, but the scroll origin *did* change, we still need to notify |
| 802 // the scrollbars to update their dimensions. | 802 // the scrollbars to update their dimensions. |
| 803 | 803 |
| 804 if (DelayScrollOffsetClampScope::clampingIsDelayed()) { | 804 if (DelayScrollOffsetClampScope::clampingIsDelayed()) { |
| 805 DelayScrollOffsetClampScope::setNeedsClamp(this); | 805 DelayScrollOffsetClampScope::setNeedsClamp(this); |
| 806 return; | 806 return; |
| 807 } | 807 } |
| 808 | 808 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 bool horizontalScrollbarShouldChange = | 983 bool horizontalScrollbarShouldChange = |
| 984 needsHorizontalScrollbar != hasHorizontalScrollbar(); | 984 needsHorizontalScrollbar != hasHorizontalScrollbar(); |
| 985 bool verticalScrollbarShouldChange = | 985 bool verticalScrollbarShouldChange = |
| 986 needsVerticalScrollbar != hasVerticalScrollbar(); | 986 needsVerticalScrollbar != hasVerticalScrollbar(); |
| 987 | 987 |
| 988 if ((box().hasAutoHorizontalScrollbar() && horizontalScrollbarShouldChange) || | 988 if ((box().hasAutoHorizontalScrollbar() && horizontalScrollbarShouldChange) || |
| 989 (box().hasAutoVerticalScrollbar() && verticalScrollbarShouldChange)) { | 989 (box().hasAutoVerticalScrollbar() && verticalScrollbarShouldChange)) { |
| 990 box().setNeedsLayoutAndFullPaintInvalidation( | 990 box().setNeedsLayoutAndFullPaintInvalidation( |
| 991 LayoutInvalidationReason::Unknown); | 991 LayoutInvalidationReason::Unknown); |
| 992 } | 992 } |
| 993 |
| 994 clampScrollOffsetAfterOverflowChange(); |
| 993 } | 995 } |
| 994 | 996 |
| 995 IntRect PaintLayerScrollableArea::rectForHorizontalScrollbar( | 997 IntRect PaintLayerScrollableArea::rectForHorizontalScrollbar( |
| 996 const IntRect& borderBoxRect) const { | 998 const IntRect& borderBoxRect) const { |
| 997 if (!hasHorizontalScrollbar()) | 999 if (!hasHorizontalScrollbar()) |
| 998 return IntRect(); | 1000 return IntRect(); |
| 999 | 1001 |
| 1000 const IntRect& scrollCorner = scrollCornerRect(); | 1002 const IntRect& scrollCorner = scrollCornerRect(); |
| 1001 | 1003 |
| 1002 return IntRect(horizontalScrollbarStart(borderBoxRect.x()), | 1004 return IntRect(horizontalScrollbarStart(borderBoxRect.x()), |
| (...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1996 PaintLayerScrollableArea* scrollableArea) { | 1998 PaintLayerScrollableArea* scrollableArea) { |
| 1997 if (!scrollableArea->needsScrollOffsetClamp()) { | 1999 if (!scrollableArea->needsScrollOffsetClamp()) { |
| 1998 scrollableArea->setNeedsScrollOffsetClamp(true); | 2000 scrollableArea->setNeedsScrollOffsetClamp(true); |
| 1999 s_needsClamp->append(scrollableArea); | 2001 s_needsClamp->append(scrollableArea); |
| 2000 } | 2002 } |
| 2001 } | 2003 } |
| 2002 | 2004 |
| 2003 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 2005 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
| 2004 clampScrollableAreas() { | 2006 clampScrollableAreas() { |
| 2005 for (auto& scrollableArea : *s_needsClamp) | 2007 for (auto& scrollableArea : *s_needsClamp) |
| 2006 scrollableArea->clampScrollOffsetsAfterLayout(); | 2008 scrollableArea->clampScrollOffsetAfterOverflowChange(); |
| 2007 delete s_needsClamp; | 2009 delete s_needsClamp; |
| 2008 s_needsClamp = nullptr; | 2010 s_needsClamp = nullptr; |
| 2009 } | 2011 } |
| 2010 | 2012 |
| 2011 } // namespace blink | 2013 } // namespace blink |
| OLD | NEW |