OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 2444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2455 } | 2455 } |
2456 | 2456 |
2457 bool FrameView::scrollbarsCanBeActive() const { | 2457 bool FrameView::scrollbarsCanBeActive() const { |
2458 if (m_frame->view() != this) | 2458 if (m_frame->view() != this) |
2459 return false; | 2459 return false; |
2460 | 2460 |
2461 return !!m_frame->document(); | 2461 return !!m_frame->document(); |
2462 } | 2462 } |
2463 | 2463 |
2464 void FrameView::scrollbarVisibilityChanged() { | 2464 void FrameView::scrollbarVisibilityChanged() { |
| 2465 updateScrollbarEnabledState(); |
2465 LayoutViewItem viewItem = layoutViewItem(); | 2466 LayoutViewItem viewItem = layoutViewItem(); |
2466 if (!viewItem.isNull()) | 2467 if (!viewItem.isNull()) |
2467 viewItem.clearHitTestCache(); | 2468 viewItem.clearHitTestCache(); |
2468 } | 2469 } |
2469 | 2470 |
2470 IntRect FrameView::scrollableAreaBoundingBox() const { | 2471 IntRect FrameView::scrollableAreaBoundingBox() const { |
2471 LayoutPartItem ownerLayoutItem = frame().ownerLayoutItem(); | 2472 LayoutPartItem ownerLayoutItem = frame().ownerLayoutItem(); |
2472 if (ownerLayoutItem.isNull()) | 2473 if (ownerLayoutItem.isNull()) |
2473 return frameRect(); | 2474 return frameRect(); |
2474 | 2475 |
(...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3784 (option == FirstPass && docSize.width() <= fullVisibleSize.width() && | 3785 (option == FirstPass && docSize.width() <= fullVisibleSize.width() && |
3785 docSize.height() <= fullVisibleSize.height()); | 3786 docSize.height() <= fullVisibleSize.height()); |
3786 if (attemptToRemoveScrollbars) { | 3787 if (attemptToRemoveScrollbars) { |
3787 if (hScroll == ScrollbarAuto) | 3788 if (hScroll == ScrollbarAuto) |
3788 newHasHorizontalScrollbar = false; | 3789 newHasHorizontalScrollbar = false; |
3789 if (vScroll == ScrollbarAuto) | 3790 if (vScroll == ScrollbarAuto) |
3790 newHasVerticalScrollbar = false; | 3791 newHasVerticalScrollbar = false; |
3791 } | 3792 } |
3792 } | 3793 } |
3793 | 3794 |
| 3795 void FrameView::updateScrollbarEnabledState() { |
| 3796 bool forceDisabled = ScrollbarTheme::theme().disableInvisibleScrollbars() && |
| 3797 scrollbarsHidden(); |
| 3798 |
| 3799 if (horizontalScrollbar()) { |
| 3800 horizontalScrollbar()->setEnabled(contentsWidth() > visibleWidth() && |
| 3801 !forceDisabled); |
| 3802 } |
| 3803 if (verticalScrollbar()) { |
| 3804 verticalScrollbar()->setEnabled(contentsHeight() > visibleHeight() && |
| 3805 !forceDisabled); |
| 3806 } |
| 3807 } |
| 3808 |
3794 void FrameView::updateScrollbarGeometry() { | 3809 void FrameView::updateScrollbarGeometry() { |
| 3810 updateScrollbarEnabledState(); |
3795 if (horizontalScrollbar()) { | 3811 if (horizontalScrollbar()) { |
3796 int thickness = horizontalScrollbar()->scrollbarThickness(); | 3812 int thickness = horizontalScrollbar()->scrollbarThickness(); |
3797 int clientWidth = visibleWidth(); | |
3798 IntRect oldRect(horizontalScrollbar()->frameRect()); | 3813 IntRect oldRect(horizontalScrollbar()->frameRect()); |
3799 IntRect hBarRect( | 3814 IntRect hBarRect( |
3800 (shouldPlaceVerticalScrollbarOnLeft() && verticalScrollbar()) | 3815 (shouldPlaceVerticalScrollbarOnLeft() && verticalScrollbar()) |
3801 ? verticalScrollbar()->width() | 3816 ? verticalScrollbar()->width() |
3802 : 0, | 3817 : 0, |
3803 height() - thickness, | 3818 height() - thickness, |
3804 width() - (verticalScrollbar() ? verticalScrollbar()->width() : 0), | 3819 width() - (verticalScrollbar() ? verticalScrollbar()->width() : 0), |
3805 thickness); | 3820 thickness); |
3806 horizontalScrollbar()->setFrameRect(hBarRect); | 3821 horizontalScrollbar()->setFrameRect(hBarRect); |
3807 if (oldRect != horizontalScrollbar()->frameRect()) | 3822 if (oldRect != horizontalScrollbar()->frameRect()) |
3808 setScrollbarNeedsPaintInvalidation(HorizontalScrollbar); | 3823 setScrollbarNeedsPaintInvalidation(HorizontalScrollbar); |
3809 | 3824 |
3810 horizontalScrollbar()->setEnabled(contentsWidth() > clientWidth); | 3825 horizontalScrollbar()->setProportion(visibleWidth(), contentsWidth()); |
3811 horizontalScrollbar()->setProportion(clientWidth, contentsWidth()); | |
3812 horizontalScrollbar()->offsetDidChange(); | 3826 horizontalScrollbar()->offsetDidChange(); |
3813 } | 3827 } |
3814 | 3828 |
3815 if (verticalScrollbar()) { | 3829 if (verticalScrollbar()) { |
3816 int thickness = verticalScrollbar()->scrollbarThickness(); | 3830 int thickness = verticalScrollbar()->scrollbarThickness(); |
3817 int clientHeight = visibleHeight(); | |
3818 IntRect oldRect(verticalScrollbar()->frameRect()); | 3831 IntRect oldRect(verticalScrollbar()->frameRect()); |
3819 IntRect vBarRect( | 3832 IntRect vBarRect( |
3820 shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width() - thickness), 0, | 3833 shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width() - thickness), 0, |
3821 thickness, | 3834 thickness, |
3822 height() - | 3835 height() - |
3823 (horizontalScrollbar() ? horizontalScrollbar()->height() : 0)); | 3836 (horizontalScrollbar() ? horizontalScrollbar()->height() : 0)); |
3824 verticalScrollbar()->setFrameRect(vBarRect); | 3837 verticalScrollbar()->setFrameRect(vBarRect); |
3825 if (oldRect != verticalScrollbar()->frameRect()) | 3838 if (oldRect != verticalScrollbar()->frameRect()) |
3826 setScrollbarNeedsPaintInvalidation(VerticalScrollbar); | 3839 setScrollbarNeedsPaintInvalidation(VerticalScrollbar); |
3827 | 3840 |
3828 verticalScrollbar()->setEnabled(contentsHeight() > clientHeight); | 3841 verticalScrollbar()->setProportion(visibleHeight(), contentsHeight()); |
3829 verticalScrollbar()->setProportion(clientHeight, contentsHeight()); | |
3830 verticalScrollbar()->offsetDidChange(); | 3842 verticalScrollbar()->offsetDidChange(); |
3831 } | 3843 } |
3832 } | 3844 } |
3833 | 3845 |
3834 bool FrameView::adjustScrollbarExistence( | 3846 bool FrameView::adjustScrollbarExistence( |
3835 ComputeScrollbarExistenceOption option) { | 3847 ComputeScrollbarExistenceOption option) { |
3836 ASSERT(m_inUpdateScrollbars); | 3848 ASSERT(m_inUpdateScrollbars); |
3837 | 3849 |
3838 // If we came in here with the view already needing a layout, then go ahead | 3850 // If we came in here with the view already needing a layout, then go ahead |
3839 // and do that first. (This will be the common case, e.g., when the page | 3851 // and do that first. (This will be the common case, e.g., when the page |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4585 DCHECK(m_frame->isMainFrame()); | 4597 DCHECK(m_frame->isMainFrame()); |
4586 return m_initialViewportSize.width(); | 4598 return m_initialViewportSize.width(); |
4587 } | 4599 } |
4588 | 4600 |
4589 int FrameView::initialViewportHeight() const { | 4601 int FrameView::initialViewportHeight() const { |
4590 DCHECK(m_frame->isMainFrame()); | 4602 DCHECK(m_frame->isMainFrame()); |
4591 return m_initialViewportSize.height(); | 4603 return m_initialViewportSize.height(); |
4592 } | 4604 } |
4593 | 4605 |
4594 } // namespace blink | 4606 } // namespace blink |
OLD | NEW |