| 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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 } | 544 } |
| 545 | 545 |
| 546 bool PaintLayerScrollableArea::shouldSuspendScrollAnimations() const { | 546 bool PaintLayerScrollableArea::shouldSuspendScrollAnimations() const { |
| 547 LayoutView* view = box().view(); | 547 LayoutView* view = box().view(); |
| 548 if (!view) | 548 if (!view) |
| 549 return true; | 549 return true; |
| 550 return view->frameView()->shouldSuspendScrollAnimations(); | 550 return view->frameView()->shouldSuspendScrollAnimations(); |
| 551 } | 551 } |
| 552 | 552 |
| 553 void PaintLayerScrollableArea::scrollbarVisibilityChanged() { | 553 void PaintLayerScrollableArea::scrollbarVisibilityChanged() { |
| 554 updateScrollbarEnabledState(); |
| 555 |
| 554 if (LayoutView* view = box().view()) | 556 if (LayoutView* view = box().view()) |
| 555 return view->clearHitTestCache(); | 557 return view->clearHitTestCache(); |
| 556 } | 558 } |
| 557 | 559 |
| 558 bool PaintLayerScrollableArea::scrollbarsCanBeActive() const { | 560 bool PaintLayerScrollableArea::scrollbarsCanBeActive() const { |
| 559 LayoutView* view = box().view(); | 561 LayoutView* view = box().view(); |
| 560 if (!view) | 562 if (!view) |
| 561 return false; | 563 return false; |
| 562 return view->frameView()->scrollbarsCanBeActive(); | 564 return view->frameView()->scrollbarsCanBeActive(); |
| 563 } | 565 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 } | 649 } |
| 648 | 650 |
| 649 void PaintLayerScrollableArea::updateScrollDimensions() { | 651 void PaintLayerScrollableArea::updateScrollDimensions() { |
| 650 if (m_overflowRect.size() != box().layoutOverflowRect().size()) | 652 if (m_overflowRect.size() != box().layoutOverflowRect().size()) |
| 651 contentsResized(); | 653 contentsResized(); |
| 652 m_overflowRect = box().layoutOverflowRect(); | 654 m_overflowRect = box().layoutOverflowRect(); |
| 653 box().flipForWritingMode(m_overflowRect); | 655 box().flipForWritingMode(m_overflowRect); |
| 654 updateScrollOrigin(); | 656 updateScrollOrigin(); |
| 655 } | 657 } |
| 656 | 658 |
| 659 void PaintLayerScrollableArea::updateScrollbarEnabledState() { |
| 660 bool forceDisabled = ScrollbarTheme::theme().disableInvisibleScrollbars() && |
| 661 scrollbarsHidden(); |
| 662 // overflow:scroll should just enable/disable. |
| 663 if (box().style()->overflowX() == OverflowScroll && horizontalScrollbar()) { |
| 664 horizontalScrollbar()->setEnabled(hasHorizontalOverflow() && |
| 665 !forceDisabled); |
| 666 } |
| 667 if (box().style()->overflowY() == OverflowScroll && verticalScrollbar()) { |
| 668 verticalScrollbar()->setEnabled(hasVerticalOverflow() && !forceDisabled); |
| 669 } |
| 670 } |
| 671 |
| 657 void PaintLayerScrollableArea::setScrollOffsetUnconditionally( | 672 void PaintLayerScrollableArea::setScrollOffsetUnconditionally( |
| 658 const ScrollOffset& offset, | 673 const ScrollOffset& offset, |
| 659 ScrollType scrollType) { | 674 ScrollType scrollType) { |
| 660 cancelScrollAnimation(); | 675 cancelScrollAnimation(); |
| 661 scrollOffsetChanged(offset, scrollType); | 676 scrollOffsetChanged(offset, scrollType); |
| 662 } | 677 } |
| 663 | 678 |
| 664 void PaintLayerScrollableArea::updateAfterLayout() { | 679 void PaintLayerScrollableArea::updateAfterLayout() { |
| 665 DCHECK(box().hasOverflowClip()); | 680 DCHECK(box().hasOverflowClip()); |
| 666 | 681 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 if (parent && parent->isFlexibleBox()) | 755 if (parent && parent->isFlexibleBox()) |
| 741 toLayoutFlexibleBox(parent)->clearCachedMainSizeForChild(box()); | 756 toLayoutFlexibleBox(parent)->clearCachedMainSizeForChild(box()); |
| 742 } | 757 } |
| 743 } | 758 } |
| 744 | 759 |
| 745 { | 760 { |
| 746 // Hits in | 761 // Hits in |
| 747 // compositing/overflow/automatically-opt-into-composited-scrolling-after-st
yle-change.html. | 762 // compositing/overflow/automatically-opt-into-composited-scrolling-after-st
yle-change.html. |
| 748 DisableCompositingQueryAsserts disabler; | 763 DisableCompositingQueryAsserts disabler; |
| 749 | 764 |
| 750 // overflow:scroll should just enable/disable. | 765 updateScrollbarEnabledState(); |
| 751 if (box().style()->overflowX() == OverflowScroll && horizontalScrollbar()) | |
| 752 horizontalScrollbar()->setEnabled(hasHorizontalOverflow()); | |
| 753 if (box().style()->overflowY() == OverflowScroll && verticalScrollbar()) | |
| 754 verticalScrollbar()->setEnabled(hasVerticalOverflow()); | |
| 755 | 766 |
| 756 // Set up the range (and page step/line step). | 767 // Set up the range (and page step/line step). |
| 757 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) { | 768 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) { |
| 758 int clientWidth = box().pixelSnappedClientWidth(); | 769 int clientWidth = box().pixelSnappedClientWidth(); |
| 759 horizontalScrollbar->setProportion(clientWidth, | 770 horizontalScrollbar->setProportion(clientWidth, |
| 760 overflowRect().width().toInt()); | 771 overflowRect().width().toInt()); |
| 761 } | 772 } |
| 762 if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) { | 773 if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) { |
| 763 int clientHeight = box().pixelSnappedClientHeight(); | 774 int clientHeight = box().pixelSnappedClientHeight(); |
| 764 verticalScrollbar->setProportion(clientHeight, | 775 verticalScrollbar->setProportion(clientHeight, |
| (...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1967 | 1978 |
| 1968 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 1979 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
| 1969 clampScrollableAreas() { | 1980 clampScrollableAreas() { |
| 1970 for (auto& scrollableArea : *s_needsClamp) | 1981 for (auto& scrollableArea : *s_needsClamp) |
| 1971 scrollableArea->clampScrollOffsetsAfterLayout(); | 1982 scrollableArea->clampScrollOffsetsAfterLayout(); |
| 1972 delete s_needsClamp; | 1983 delete s_needsClamp; |
| 1973 s_needsClamp = nullptr; | 1984 s_needsClamp = nullptr; |
| 1974 } | 1985 } |
| 1975 | 1986 |
| 1976 } // namespace blink | 1987 } // namespace blink |
| OLD | NEW |