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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 } | 546 } |
547 | 547 |
548 bool PaintLayerScrollableArea::shouldSuspendScrollAnimations() const { | 548 bool PaintLayerScrollableArea::shouldSuspendScrollAnimations() const { |
549 LayoutView* view = box().view(); | 549 LayoutView* view = box().view(); |
550 if (!view) | 550 if (!view) |
551 return true; | 551 return true; |
552 return view->frameView()->shouldSuspendScrollAnimations(); | 552 return view->frameView()->shouldSuspendScrollAnimations(); |
553 } | 553 } |
554 | 554 |
555 void PaintLayerScrollableArea::scrollbarVisibilityChanged() { | 555 void PaintLayerScrollableArea::scrollbarVisibilityChanged() { |
| 556 updateScrollbarEnabledState(); |
| 557 |
556 if (LayoutView* view = box().view()) | 558 if (LayoutView* view = box().view()) |
557 return view->clearHitTestCache(); | 559 return view->clearHitTestCache(); |
558 } | 560 } |
559 | 561 |
560 bool PaintLayerScrollableArea::scrollbarsCanBeActive() const { | 562 bool PaintLayerScrollableArea::scrollbarsCanBeActive() const { |
561 LayoutView* view = box().view(); | 563 LayoutView* view = box().view(); |
562 if (!view) | 564 if (!view) |
563 return false; | 565 return false; |
564 return view->frameView()->scrollbarsCanBeActive(); | 566 return view->frameView()->scrollbarsCanBeActive(); |
565 } | 567 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 } | 651 } |
650 | 652 |
651 void PaintLayerScrollableArea::updateScrollDimensions() { | 653 void PaintLayerScrollableArea::updateScrollDimensions() { |
652 if (m_overflowRect.size() != box().layoutOverflowRect().size()) | 654 if (m_overflowRect.size() != box().layoutOverflowRect().size()) |
653 contentsResized(); | 655 contentsResized(); |
654 m_overflowRect = box().layoutOverflowRect(); | 656 m_overflowRect = box().layoutOverflowRect(); |
655 box().flipForWritingMode(m_overflowRect); | 657 box().flipForWritingMode(m_overflowRect); |
656 updateScrollOrigin(); | 658 updateScrollOrigin(); |
657 } | 659 } |
658 | 660 |
| 661 void PaintLayerScrollableArea::updateScrollbarEnabledState() { |
| 662 bool forceDisabled = |
| 663 ScrollbarTheme::theme().shouldDisableInvisibleScrollbars() && |
| 664 scrollbarsHidden(); |
| 665 // overflow:scroll should just enable/disable. |
| 666 if (box().style()->overflowX() == OverflowScroll && horizontalScrollbar()) { |
| 667 horizontalScrollbar()->setEnabled(hasHorizontalOverflow() && |
| 668 !forceDisabled); |
| 669 } |
| 670 if (box().style()->overflowY() == OverflowScroll && verticalScrollbar()) { |
| 671 verticalScrollbar()->setEnabled(hasVerticalOverflow() && !forceDisabled); |
| 672 } |
| 673 } |
| 674 |
659 void PaintLayerScrollableArea::setScrollOffsetUnconditionally( | 675 void PaintLayerScrollableArea::setScrollOffsetUnconditionally( |
660 const ScrollOffset& offset, | 676 const ScrollOffset& offset, |
661 ScrollType scrollType) { | 677 ScrollType scrollType) { |
662 cancelScrollAnimation(); | 678 cancelScrollAnimation(); |
663 scrollOffsetChanged(offset, scrollType); | 679 scrollOffsetChanged(offset, scrollType); |
664 } | 680 } |
665 | 681 |
666 void PaintLayerScrollableArea::updateAfterLayout() { | 682 void PaintLayerScrollableArea::updateAfterLayout() { |
667 DCHECK(box().hasOverflowClip()); | 683 DCHECK(box().hasOverflowClip()); |
668 | 684 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 if (parent && parent->isFlexibleBox()) | 758 if (parent && parent->isFlexibleBox()) |
743 toLayoutFlexibleBox(parent)->clearCachedMainSizeForChild(box()); | 759 toLayoutFlexibleBox(parent)->clearCachedMainSizeForChild(box()); |
744 } | 760 } |
745 } | 761 } |
746 | 762 |
747 { | 763 { |
748 // Hits in | 764 // Hits in |
749 // compositing/overflow/automatically-opt-into-composited-scrolling-after-st
yle-change.html. | 765 // compositing/overflow/automatically-opt-into-composited-scrolling-after-st
yle-change.html. |
750 DisableCompositingQueryAsserts disabler; | 766 DisableCompositingQueryAsserts disabler; |
751 | 767 |
752 // overflow:scroll should just enable/disable. | 768 updateScrollbarEnabledState(); |
753 if (box().style()->overflowX() == OverflowScroll && horizontalScrollbar()) | |
754 horizontalScrollbar()->setEnabled(hasHorizontalOverflow()); | |
755 if (box().style()->overflowY() == OverflowScroll && verticalScrollbar()) | |
756 verticalScrollbar()->setEnabled(hasVerticalOverflow()); | |
757 | 769 |
758 // Set up the range (and page step/line step). | 770 // Set up the range (and page step/line step). |
759 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) { | 771 if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) { |
760 int clientWidth = box().pixelSnappedClientWidth(); | 772 int clientWidth = box().pixelSnappedClientWidth(); |
761 horizontalScrollbar->setProportion(clientWidth, | 773 horizontalScrollbar->setProportion(clientWidth, |
762 overflowRect().width().toInt()); | 774 overflowRect().width().toInt()); |
763 } | 775 } |
764 if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) { | 776 if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) { |
765 int clientHeight = box().pixelSnappedClientHeight(); | 777 int clientHeight = box().pixelSnappedClientHeight(); |
766 verticalScrollbar->setProportion(clientHeight, | 778 verticalScrollbar->setProportion(clientHeight, |
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1993 | 2005 |
1994 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 2006 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
1995 clampScrollableAreas() { | 2007 clampScrollableAreas() { |
1996 for (auto& scrollableArea : *s_needsClamp) | 2008 for (auto& scrollableArea : *s_needsClamp) |
1997 scrollableArea->clampScrollOffsetsAfterLayout(); | 2009 scrollableArea->clampScrollOffsetsAfterLayout(); |
1998 delete s_needsClamp; | 2010 delete s_needsClamp; |
1999 s_needsClamp = nullptr; | 2011 s_needsClamp = nullptr; |
2000 } | 2012 } |
2001 | 2013 |
2002 } // namespace blink | 2014 } // namespace blink |
OLD | NEW |