| 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 2445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2456 } | 2456 } |
| 2457 | 2457 |
| 2458 bool FrameView::scrollbarsCanBeActive() const { | 2458 bool FrameView::scrollbarsCanBeActive() const { |
| 2459 if (m_frame->view() != this) | 2459 if (m_frame->view() != this) |
| 2460 return false; | 2460 return false; |
| 2461 | 2461 |
| 2462 return !!m_frame->document(); | 2462 return !!m_frame->document(); |
| 2463 } | 2463 } |
| 2464 | 2464 |
| 2465 void FrameView::scrollbarVisibilityChanged() { | 2465 void FrameView::scrollbarVisibilityChanged() { |
| 2466 updateScrollbarEnabledState(); |
| 2466 LayoutViewItem viewItem = layoutViewItem(); | 2467 LayoutViewItem viewItem = layoutViewItem(); |
| 2467 if (!viewItem.isNull()) | 2468 if (!viewItem.isNull()) |
| 2468 viewItem.clearHitTestCache(); | 2469 viewItem.clearHitTestCache(); |
| 2469 } | 2470 } |
| 2470 | 2471 |
| 2471 IntRect FrameView::scrollableAreaBoundingBox() const { | 2472 IntRect FrameView::scrollableAreaBoundingBox() const { |
| 2472 LayoutPartItem ownerLayoutItem = frame().ownerLayoutItem(); | 2473 LayoutPartItem ownerLayoutItem = frame().ownerLayoutItem(); |
| 2473 if (ownerLayoutItem.isNull()) | 2474 if (ownerLayoutItem.isNull()) |
| 2474 return frameRect(); | 2475 return frameRect(); |
| 2475 | 2476 |
| (...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3817 (option == FirstPass && docSize.width() <= fullVisibleSize.width() && | 3818 (option == FirstPass && docSize.width() <= fullVisibleSize.width() && |
| 3818 docSize.height() <= fullVisibleSize.height()); | 3819 docSize.height() <= fullVisibleSize.height()); |
| 3819 if (attemptToRemoveScrollbars) { | 3820 if (attemptToRemoveScrollbars) { |
| 3820 if (hScroll == ScrollbarAuto) | 3821 if (hScroll == ScrollbarAuto) |
| 3821 newHasHorizontalScrollbar = false; | 3822 newHasHorizontalScrollbar = false; |
| 3822 if (vScroll == ScrollbarAuto) | 3823 if (vScroll == ScrollbarAuto) |
| 3823 newHasVerticalScrollbar = false; | 3824 newHasVerticalScrollbar = false; |
| 3824 } | 3825 } |
| 3825 } | 3826 } |
| 3826 | 3827 |
| 3828 void FrameView::updateScrollbarEnabledState() { |
| 3829 bool forceDisabled = |
| 3830 ScrollbarTheme::theme().shouldDisableInvisibleScrollbars() && |
| 3831 scrollbarsHidden(); |
| 3832 |
| 3833 if (horizontalScrollbar()) { |
| 3834 horizontalScrollbar()->setEnabled(contentsWidth() > visibleWidth() && |
| 3835 !forceDisabled); |
| 3836 } |
| 3837 if (verticalScrollbar()) { |
| 3838 verticalScrollbar()->setEnabled(contentsHeight() > visibleHeight() && |
| 3839 !forceDisabled); |
| 3840 } |
| 3841 } |
| 3842 |
| 3827 void FrameView::updateScrollbarGeometry() { | 3843 void FrameView::updateScrollbarGeometry() { |
| 3844 updateScrollbarEnabledState(); |
| 3828 if (horizontalScrollbar()) { | 3845 if (horizontalScrollbar()) { |
| 3829 int thickness = horizontalScrollbar()->scrollbarThickness(); | 3846 int thickness = horizontalScrollbar()->scrollbarThickness(); |
| 3830 int clientWidth = visibleWidth(); | |
| 3831 IntRect oldRect(horizontalScrollbar()->frameRect()); | 3847 IntRect oldRect(horizontalScrollbar()->frameRect()); |
| 3832 IntRect hBarRect( | 3848 IntRect hBarRect( |
| 3833 (shouldPlaceVerticalScrollbarOnLeft() && verticalScrollbar()) | 3849 (shouldPlaceVerticalScrollbarOnLeft() && verticalScrollbar()) |
| 3834 ? verticalScrollbar()->width() | 3850 ? verticalScrollbar()->width() |
| 3835 : 0, | 3851 : 0, |
| 3836 height() - thickness, | 3852 height() - thickness, |
| 3837 width() - (verticalScrollbar() ? verticalScrollbar()->width() : 0), | 3853 width() - (verticalScrollbar() ? verticalScrollbar()->width() : 0), |
| 3838 thickness); | 3854 thickness); |
| 3839 horizontalScrollbar()->setFrameRect(hBarRect); | 3855 horizontalScrollbar()->setFrameRect(hBarRect); |
| 3840 if (oldRect != horizontalScrollbar()->frameRect()) | 3856 if (oldRect != horizontalScrollbar()->frameRect()) |
| 3841 setScrollbarNeedsPaintInvalidation(HorizontalScrollbar); | 3857 setScrollbarNeedsPaintInvalidation(HorizontalScrollbar); |
| 3842 | 3858 |
| 3843 horizontalScrollbar()->setEnabled(contentsWidth() > clientWidth); | 3859 horizontalScrollbar()->setProportion(visibleWidth(), contentsWidth()); |
| 3844 horizontalScrollbar()->setProportion(clientWidth, contentsWidth()); | |
| 3845 horizontalScrollbar()->offsetDidChange(); | 3860 horizontalScrollbar()->offsetDidChange(); |
| 3846 } | 3861 } |
| 3847 | 3862 |
| 3848 if (verticalScrollbar()) { | 3863 if (verticalScrollbar()) { |
| 3849 int thickness = verticalScrollbar()->scrollbarThickness(); | 3864 int thickness = verticalScrollbar()->scrollbarThickness(); |
| 3850 int clientHeight = visibleHeight(); | |
| 3851 IntRect oldRect(verticalScrollbar()->frameRect()); | 3865 IntRect oldRect(verticalScrollbar()->frameRect()); |
| 3852 IntRect vBarRect( | 3866 IntRect vBarRect( |
| 3853 shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width() - thickness), 0, | 3867 shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width() - thickness), 0, |
| 3854 thickness, | 3868 thickness, |
| 3855 height() - | 3869 height() - |
| 3856 (horizontalScrollbar() ? horizontalScrollbar()->height() : 0)); | 3870 (horizontalScrollbar() ? horizontalScrollbar()->height() : 0)); |
| 3857 verticalScrollbar()->setFrameRect(vBarRect); | 3871 verticalScrollbar()->setFrameRect(vBarRect); |
| 3858 if (oldRect != verticalScrollbar()->frameRect()) | 3872 if (oldRect != verticalScrollbar()->frameRect()) |
| 3859 setScrollbarNeedsPaintInvalidation(VerticalScrollbar); | 3873 setScrollbarNeedsPaintInvalidation(VerticalScrollbar); |
| 3860 | 3874 |
| 3861 verticalScrollbar()->setEnabled(contentsHeight() > clientHeight); | 3875 verticalScrollbar()->setProportion(visibleHeight(), contentsHeight()); |
| 3862 verticalScrollbar()->setProportion(clientHeight, contentsHeight()); | |
| 3863 verticalScrollbar()->offsetDidChange(); | 3876 verticalScrollbar()->offsetDidChange(); |
| 3864 } | 3877 } |
| 3865 } | 3878 } |
| 3866 | 3879 |
| 3867 bool FrameView::adjustScrollbarExistence( | 3880 bool FrameView::adjustScrollbarExistence( |
| 3868 ComputeScrollbarExistenceOption option) { | 3881 ComputeScrollbarExistenceOption option) { |
| 3869 ASSERT(m_inUpdateScrollbars); | 3882 ASSERT(m_inUpdateScrollbars); |
| 3870 | 3883 |
| 3871 // If we came in here with the view already needing a layout, then go ahead | 3884 // If we came in here with the view already needing a layout, then go ahead |
| 3872 // and do that first. (This will be the common case, e.g., when the page | 3885 // and do that first. (This will be the common case, e.g., when the page |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4613 DCHECK(m_frame->isMainFrame()); | 4626 DCHECK(m_frame->isMainFrame()); |
| 4614 return m_initialViewportSize.width(); | 4627 return m_initialViewportSize.width(); |
| 4615 } | 4628 } |
| 4616 | 4629 |
| 4617 int FrameView::initialViewportHeight() const { | 4630 int FrameView::initialViewportHeight() const { |
| 4618 DCHECK(m_frame->isMainFrame()); | 4631 DCHECK(m_frame->isMainFrame()); |
| 4619 return m_initialViewportSize.height(); | 4632 return m_initialViewportSize.height(); |
| 4620 } | 4633 } |
| 4621 | 4634 |
| 4622 } // namespace blink | 4635 } // namespace blink |
| OLD | NEW |