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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 321 |
322 detachScrollbars(); | 322 detachScrollbars(); |
323 | 323 |
324 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) | 324 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) |
325 scrollingCoordinator->willDestroyScrollableArea(this); | 325 scrollingCoordinator->willDestroyScrollableArea(this); |
326 | 326 |
327 // We need to clear the RootFrameViewport's animator since it gets called | 327 // We need to clear the RootFrameViewport's animator since it gets called |
328 // from non-GC'd objects and RootFrameViewport will still have a pointer to | 328 // from non-GC'd objects and RootFrameViewport will still have a pointer to |
329 // this class. | 329 // this class. |
330 if (m_viewportScrollableArea) | 330 if (m_viewportScrollableArea) |
331 m_viewportScrollableArea->clearScrollAnimators(); | 331 m_viewportScrollableArea->clearScrollableArea(); |
332 | 332 |
333 clearScrollAnimators(); | 333 clearScrollableArea(); |
334 | 334 |
335 // Destroy |m_autoSizeInfo| as early as possible, to avoid dereferencing | 335 // Destroy |m_autoSizeInfo| as early as possible, to avoid dereferencing |
336 // partially destroyed |this| via |m_autoSizeInfo->m_frameView|. | 336 // partially destroyed |this| via |m_autoSizeInfo->m_frameView|. |
337 m_autoSizeInfo.clear(); | 337 m_autoSizeInfo.clear(); |
338 | 338 |
339 m_postLayoutTasksTimer.stop(); | 339 m_postLayoutTasksTimer.stop(); |
340 m_didScrollTimer.stop(); | 340 m_didScrollTimer.stop(); |
341 | 341 |
342 // FIXME: Do we need to do something here for OOPI? | 342 // FIXME: Do we need to do something here for OOPI? |
343 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); | 343 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); |
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 | 1504 |
1505 if (ScrollingCoordinator* scrollingCoordinator = | 1505 if (ScrollingCoordinator* scrollingCoordinator = |
1506 this->scrollingCoordinator()) | 1506 this->scrollingCoordinator()) |
1507 scrollingCoordinator->frameViewFixedObjectsDidChange(this); | 1507 scrollingCoordinator->frameViewFixedObjectsDidChange(this); |
1508 } | 1508 } |
1509 } | 1509 } |
1510 | 1510 |
1511 void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) { | 1511 void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) { |
1512 DCHECK(widthChanged || heightChanged); | 1512 DCHECK(widthChanged || heightChanged); |
1513 | 1513 |
| 1514 showOverlayScrollbars(); |
1514 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 1515 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
1515 // The background must be repainted when the FrameView is resized, even if | 1516 // The background must be repainted when the FrameView is resized, even if |
1516 // the initial containing block does not change (so we can't rely on layout | 1517 // the initial containing block does not change (so we can't rely on layout |
1517 // to issue the invalidation). This is because the background fills the | 1518 // to issue the invalidation). This is because the background fills the |
1518 // main GraphicsLayer, which takes the size of the layout viewport. | 1519 // main GraphicsLayer, which takes the size of the layout viewport. |
1519 // TODO(skobes): Paint non-fixed backgrounds into the scrolling contents | 1520 // TODO(skobes): Paint non-fixed backgrounds into the scrolling contents |
1520 // layer and avoid this invalidation (http://crbug.com/568847). | 1521 // layer and avoid this invalidation (http://crbug.com/568847). |
1521 LayoutViewItem lvi = layoutViewItem(); | 1522 LayoutViewItem lvi = layoutViewItem(); |
1522 if (!lvi.isNull()) | 1523 if (!lvi.isNull()) |
1523 lvi.setShouldDoFullPaintInvalidation(); | 1524 lvi.setShouldDoFullPaintInvalidation(); |
(...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3645 | 3646 |
3646 return scrollbar->totalSize() - scrollbar->visibleSize(); | 3647 return scrollbar->totalSize() - scrollbar->visibleSize(); |
3647 } | 3648 } |
3648 | 3649 |
3649 void FrameView::updateScrollOffset(const ScrollOffset& offset, | 3650 void FrameView::updateScrollOffset(const ScrollOffset& offset, |
3650 ScrollType scrollType) { | 3651 ScrollType scrollType) { |
3651 ScrollOffset scrollDelta = offset - m_scrollOffset; | 3652 ScrollOffset scrollDelta = offset - m_scrollOffset; |
3652 if (scrollDelta.isZero()) | 3653 if (scrollDelta.isZero()) |
3653 return; | 3654 return; |
3654 | 3655 |
| 3656 showOverlayScrollbars(); |
| 3657 |
3655 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 3658 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
3656 // Don't scroll the FrameView! | 3659 // Don't scroll the FrameView! |
3657 ASSERT_NOT_REACHED(); | 3660 ASSERT_NOT_REACHED(); |
3658 } | 3661 } |
3659 | 3662 |
3660 m_scrollOffset = offset; | 3663 m_scrollOffset = offset; |
3661 | 3664 |
3662 if (!scrollbarsSuppressed()) | 3665 if (!scrollbarsSuppressed()) |
3663 m_pendingScrollDelta += scrollDelta; | 3666 m_pendingScrollDelta += scrollDelta; |
3664 | 3667 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3779 (shouldPlaceVerticalScrollbarOnLeft() && verticalScrollbar()) | 3782 (shouldPlaceVerticalScrollbarOnLeft() && verticalScrollbar()) |
3780 ? verticalScrollbar()->width() | 3783 ? verticalScrollbar()->width() |
3781 : 0, | 3784 : 0, |
3782 height() - thickness, | 3785 height() - thickness, |
3783 width() - (verticalScrollbar() ? verticalScrollbar()->width() : 0), | 3786 width() - (verticalScrollbar() ? verticalScrollbar()->width() : 0), |
3784 thickness); | 3787 thickness); |
3785 horizontalScrollbar()->setFrameRect(hBarRect); | 3788 horizontalScrollbar()->setFrameRect(hBarRect); |
3786 if (oldRect != horizontalScrollbar()->frameRect()) | 3789 if (oldRect != horizontalScrollbar()->frameRect()) |
3787 setScrollbarNeedsPaintInvalidation(HorizontalScrollbar); | 3790 setScrollbarNeedsPaintInvalidation(HorizontalScrollbar); |
3788 | 3791 |
3789 horizontalScrollbar()->setEnabled(contentsWidth() > clientWidth && | 3792 horizontalScrollbar()->setEnabled(contentsWidth() > clientWidth); |
3790 !scrollbarsHidden()); | |
3791 horizontalScrollbar()->setProportion(clientWidth, contentsWidth()); | 3793 horizontalScrollbar()->setProportion(clientWidth, contentsWidth()); |
3792 horizontalScrollbar()->offsetDidChange(); | 3794 horizontalScrollbar()->offsetDidChange(); |
3793 } | 3795 } |
3794 | 3796 |
3795 if (verticalScrollbar()) { | 3797 if (verticalScrollbar()) { |
3796 int thickness = verticalScrollbar()->scrollbarThickness(); | 3798 int thickness = verticalScrollbar()->scrollbarThickness(); |
3797 int clientHeight = visibleHeight(); | 3799 int clientHeight = visibleHeight(); |
3798 IntRect oldRect(verticalScrollbar()->frameRect()); | 3800 IntRect oldRect(verticalScrollbar()->frameRect()); |
3799 IntRect vBarRect( | 3801 IntRect vBarRect( |
3800 shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width() - thickness), 0, | 3802 shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width() - thickness), 0, |
3801 thickness, | 3803 thickness, |
3802 height() - | 3804 height() - |
3803 (horizontalScrollbar() ? horizontalScrollbar()->height() : 0)); | 3805 (horizontalScrollbar() ? horizontalScrollbar()->height() : 0)); |
3804 verticalScrollbar()->setFrameRect(vBarRect); | 3806 verticalScrollbar()->setFrameRect(vBarRect); |
3805 if (oldRect != verticalScrollbar()->frameRect()) | 3807 if (oldRect != verticalScrollbar()->frameRect()) |
3806 setScrollbarNeedsPaintInvalidation(VerticalScrollbar); | 3808 setScrollbarNeedsPaintInvalidation(VerticalScrollbar); |
3807 | 3809 |
3808 verticalScrollbar()->setEnabled(contentsHeight() > clientHeight && | 3810 verticalScrollbar()->setEnabled(contentsHeight() > clientHeight); |
3809 !scrollbarsHidden()); | |
3810 verticalScrollbar()->setProportion(clientHeight, contentsHeight()); | 3811 verticalScrollbar()->setProportion(clientHeight, contentsHeight()); |
3811 verticalScrollbar()->offsetDidChange(); | 3812 verticalScrollbar()->offsetDidChange(); |
3812 } | 3813 } |
3813 } | 3814 } |
3814 | 3815 |
3815 bool FrameView::adjustScrollbarExistence( | 3816 bool FrameView::adjustScrollbarExistence( |
3816 ComputeScrollbarExistenceOption option) { | 3817 ComputeScrollbarExistenceOption option) { |
3817 ASSERT(m_inUpdateScrollbars); | 3818 ASSERT(m_inUpdateScrollbars); |
3818 | 3819 |
3819 // If we came in here with the view already needing a layout, then go ahead | 3820 // If we came in here with the view already needing a layout, then go ahead |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3867 return m_frame->settings()->ignoreMainFrameOverflowHiddenQuirk() && | 3868 return m_frame->settings()->ignoreMainFrameOverflowHiddenQuirk() && |
3868 m_frame->isMainFrame(); | 3869 m_frame->isMainFrame(); |
3869 } | 3870 } |
3870 | 3871 |
3871 void FrameView::updateScrollbarsIfNeeded() { | 3872 void FrameView::updateScrollbarsIfNeeded() { |
3872 if (m_needsScrollbarsUpdate || needsScrollbarReconstruction() || | 3873 if (m_needsScrollbarsUpdate || needsScrollbarReconstruction() || |
3873 scrollOriginChanged()) | 3874 scrollOriginChanged()) |
3874 updateScrollbars(); | 3875 updateScrollbars(); |
3875 } | 3876 } |
3876 | 3877 |
3877 void FrameView::didChangeScrollbarsHidden() { | |
3878 updateScrollbars(); | |
3879 } | |
3880 | |
3881 void FrameView::updateScrollbars() { | 3878 void FrameView::updateScrollbars() { |
3882 m_needsScrollbarsUpdate = false; | 3879 m_needsScrollbarsUpdate = false; |
3883 | 3880 |
3884 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 3881 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
3885 return; | 3882 return; |
3886 | 3883 |
3887 // Avoid drawing two sets of scrollbars when visual viewport is enabled. | 3884 // Avoid drawing two sets of scrollbars when visual viewport is enabled. |
3888 if (visualViewportSuppliesScrollbars()) { | 3885 if (visualViewportSuppliesScrollbars()) { |
3889 m_scrollbarManager.setHasHorizontalScrollbar(false); | 3886 m_scrollbarManager.setHasHorizontalScrollbar(false); |
3890 m_scrollbarManager.setHasVerticalScrollbar(false); | 3887 m_scrollbarManager.setHasVerticalScrollbar(false); |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4565 DCHECK(m_frame->isMainFrame()); | 4562 DCHECK(m_frame->isMainFrame()); |
4566 return m_initialViewportSize.width(); | 4563 return m_initialViewportSize.width(); |
4567 } | 4564 } |
4568 | 4565 |
4569 int FrameView::initialViewportHeight() const { | 4566 int FrameView::initialViewportHeight() const { |
4570 DCHECK(m_frame->isMainFrame()); | 4567 DCHECK(m_frame->isMainFrame()); |
4571 return m_initialViewportSize.height(); | 4568 return m_initialViewportSize.height(); |
4572 } | 4569 } |
4573 | 4570 |
4574 } // namespace blink | 4571 } // namespace blink |
OLD | NEW |