| 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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 updateScrollOrigin(); | 645 updateScrollOrigin(); |
| 646 } | 646 } |
| 647 | 647 |
| 648 void PaintLayerScrollableArea::setScrollOffsetUnconditionally( | 648 void PaintLayerScrollableArea::setScrollOffsetUnconditionally( |
| 649 const ScrollOffset& offset, | 649 const ScrollOffset& offset, |
| 650 ScrollType scrollType) { | 650 ScrollType scrollType) { |
| 651 cancelScrollAnimation(); | 651 cancelScrollAnimation(); |
| 652 scrollOffsetChanged(offset, scrollType); | 652 scrollOffsetChanged(offset, scrollType); |
| 653 } | 653 } |
| 654 | 654 |
| 655 void PaintLayerScrollableArea::didChangeScrollbarsHidden() { |
| 656 updateScrollbarsEnabledState(); |
| 657 } |
| 658 |
| 659 void PaintLayerScrollableArea::updateScrollbarsEnabledState() { |
| 660 // overflow:scroll should just enable/disable. |
| 661 if (box().style()->overflowX() == OverflowScroll && horizontalScrollbar()) { |
| 662 horizontalScrollbar()->setEnabled(hasHorizontalOverflow() && |
| 663 !scrollbarsHidden()); |
| 664 } |
| 665 if (box().style()->overflowY() == OverflowScroll && verticalScrollbar()) { |
| 666 verticalScrollbar()->setEnabled(hasVerticalOverflow() && |
| 667 !scrollbarsHidden()); |
| 668 } |
| 669 } |
| 670 |
| 655 void PaintLayerScrollableArea::updateAfterLayout() { | 671 void PaintLayerScrollableArea::updateAfterLayout() { |
| 656 ASSERT(box().hasOverflowClip()); | 672 ASSERT(box().hasOverflowClip()); |
| 657 | 673 |
| 658 bool relayoutIsPrevented = PreventRelayoutScope::relayoutIsPrevented(); | 674 bool relayoutIsPrevented = PreventRelayoutScope::relayoutIsPrevented(); |
| 659 bool scrollbarsAreFrozen = | 675 bool scrollbarsAreFrozen = |
| 660 m_inOverflowRelayout || FreezeScrollbarsScope::scrollbarsAreFrozen(); | 676 m_inOverflowRelayout || FreezeScrollbarsScope::scrollbarsAreFrozen(); |
| 661 | 677 |
| 662 if (needsScrollbarReconstruction()) { | 678 if (needsScrollbarReconstruction()) { |
| 663 setHasHorizontalScrollbar(false); | 679 setHasHorizontalScrollbar(false); |
| 664 setHasVerticalScrollbar(false); | 680 setHasVerticalScrollbar(false); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 if (parent && parent->isFlexibleBox()) | 747 if (parent && parent->isFlexibleBox()) |
| 732 toLayoutFlexibleBox(parent)->clearCachedMainSizeForChild(box()); | 748 toLayoutFlexibleBox(parent)->clearCachedMainSizeForChild(box()); |
| 733 } | 749 } |
| 734 } | 750 } |
| 735 | 751 |
| 736 { | 752 { |
| 737 // Hits in | 753 // Hits in |
| 738 // compositing/overflow/automatically-opt-into-composited-scrolling-after-st
yle-change.html. | 754 // compositing/overflow/automatically-opt-into-composited-scrolling-after-st
yle-change.html. |
| 739 DisableCompositingQueryAsserts disabler; | 755 DisableCompositingQueryAsserts disabler; |
| 740 | 756 |
| 741 // overflow:scroll should just enable/disable. | 757 updateScrollbarsEnabledState(); |
| 742 if (box().style()->overflowX() == OverflowScroll && horizontalScrollbar()) | |
| 743 horizontalScrollbar()->setEnabled(hasHorizontalOverflow()); | |
| 744 if (box().style()->overflowY() == OverflowScroll && verticalScrollbar()) | |
| 745 verticalScrollbar()->setEnabled(hasVerticalOverflow()); | |
| 746 | 758 |
| 747 // Set up the range (and page step/line step). | 759 // Set up the range (and page step/line step). |
| 748 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) { | 760 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) { |
| 749 int clientWidth = box().pixelSnappedClientWidth(); | 761 int clientWidth = box().pixelSnappedClientWidth(); |
| 750 horizontalScrollbar->setProportion(clientWidth, | 762 horizontalScrollbar->setProportion(clientWidth, |
| 751 overflowRect().width().toInt()); | 763 overflowRect().width().toInt()); |
| 752 } | 764 } |
| 753 if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) { | 765 if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) { |
| 754 int clientHeight = box().pixelSnappedClientHeight(); | 766 int clientHeight = box().pixelSnappedClientHeight(); |
| 755 verticalScrollbar->setProportion(clientHeight, | 767 verticalScrollbar->setProportion(clientHeight, |
| (...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1949 | 1961 |
| 1950 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 1962 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
| 1951 clampScrollableAreas() { | 1963 clampScrollableAreas() { |
| 1952 for (auto& scrollableArea : *s_needsClamp) | 1964 for (auto& scrollableArea : *s_needsClamp) |
| 1953 scrollableArea->clampScrollOffsetsAfterLayout(); | 1965 scrollableArea->clampScrollOffsetsAfterLayout(); |
| 1954 delete s_needsClamp; | 1966 delete s_needsClamp; |
| 1955 s_needsClamp = nullptr; | 1967 s_needsClamp = nullptr; |
| 1956 } | 1968 } |
| 1957 | 1969 |
| 1958 } // namespace blink | 1970 } // namespace blink |
| OLD | NEW |