Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2467693002: Implement overlay scrollbar fade out for non-composited scrollers. (Closed)
Patch Set: overlay-scrollbar-mouse-capture now works on Mac Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 293
294 detachScrollbars(); 294 detachScrollbars();
295 295
296 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) 296 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
297 scrollingCoordinator->willDestroyScrollableArea(this); 297 scrollingCoordinator->willDestroyScrollableArea(this);
298 298
299 // We need to clear the RootFrameViewport's animator since it gets called 299 // We need to clear the RootFrameViewport's animator since it gets called
300 // from non-GC'd objects and RootFrameViewport will still have a pointer to 300 // from non-GC'd objects and RootFrameViewport will still have a pointer to
301 // this class. 301 // this class.
302 if (m_viewportScrollableArea) 302 if (m_viewportScrollableArea)
303 m_viewportScrollableArea->clearScrollAnimators(); 303 m_viewportScrollableArea->clearScrollableArea();
304 304
305 clearScrollAnimators(); 305 clearScrollableArea();
306 306
307 // Destroy |m_autoSizeInfo| as early as possible, to avoid dereferencing 307 // Destroy |m_autoSizeInfo| as early as possible, to avoid dereferencing
308 // partially destroyed |this| via |m_autoSizeInfo->m_frameView|. 308 // partially destroyed |this| via |m_autoSizeInfo->m_frameView|.
309 m_autoSizeInfo.clear(); 309 m_autoSizeInfo.clear();
310 310
311 m_postLayoutTasksTimer.stop(); 311 m_postLayoutTasksTimer.stop();
312 m_didScrollTimer.stop(); 312 m_didScrollTimer.stop();
313 313
314 m_renderThrottlingObserverNotificationFactory->cancel(); 314 m_renderThrottlingObserverNotificationFactory->cancel();
315 315
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 1464
1465 if (ScrollingCoordinator* scrollingCoordinator = 1465 if (ScrollingCoordinator* scrollingCoordinator =
1466 this->scrollingCoordinator()) 1466 this->scrollingCoordinator())
1467 scrollingCoordinator->frameViewFixedObjectsDidChange(this); 1467 scrollingCoordinator->frameViewFixedObjectsDidChange(this);
1468 } 1468 }
1469 } 1469 }
1470 1470
1471 void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) { 1471 void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) {
1472 DCHECK(widthChanged || heightChanged); 1472 DCHECK(widthChanged || heightChanged);
1473 1473
1474 showOverlayScrollbars();
1474 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 1475 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
1475 // The background must be repainted when the FrameView is resized, even if 1476 // The background must be repainted when the FrameView is resized, even if
1476 // the initial containing block does not change (so we can't rely on layout 1477 // the initial containing block does not change (so we can't rely on layout
1477 // to issue the invalidation). This is because the background fills the 1478 // to issue the invalidation). This is because the background fills the
1478 // main GraphicsLayer, which takes the size of the layout viewport. 1479 // main GraphicsLayer, which takes the size of the layout viewport.
1479 // TODO(skobes): Paint non-fixed backgrounds into the scrolling contents 1480 // TODO(skobes): Paint non-fixed backgrounds into the scrolling contents
1480 // layer and avoid this invalidation (http://crbug.com/568847). 1481 // layer and avoid this invalidation (http://crbug.com/568847).
1481 LayoutViewItem lvi = layoutViewItem(); 1482 LayoutViewItem lvi = layoutViewItem();
1482 if (!lvi.isNull()) 1483 if (!lvi.isNull())
1483 lvi.setShouldDoFullPaintInvalidation(); 1484 lvi.setShouldDoFullPaintInvalidation();
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
2384 } 2385 }
2385 2386
2386 bool FrameView::scrollbarsCanBeActive() const { 2387 bool FrameView::scrollbarsCanBeActive() const {
2387 if (m_frame->view() != this) 2388 if (m_frame->view() != this)
2388 return false; 2389 return false;
2389 2390
2390 return !!m_frame->document(); 2391 return !!m_frame->document();
2391 } 2392 }
2392 2393
2393 void FrameView::scrollbarVisibilityChanged() { 2394 void FrameView::scrollbarVisibilityChanged() {
2395 // Scrollbar enabled state is set from updateScrollbarGeometry.
2396 updateScrollbarGeometry();
2394 LayoutViewItem viewItem = layoutViewItem(); 2397 LayoutViewItem viewItem = layoutViewItem();
2395 if (!viewItem.isNull()) 2398 if (!viewItem.isNull())
2396 viewItem.clearHitTestCache(); 2399 viewItem.clearHitTestCache();
2397 } 2400 }
2398 2401
2399 IntRect FrameView::scrollableAreaBoundingBox() const { 2402 IntRect FrameView::scrollableAreaBoundingBox() const {
2400 LayoutPartItem ownerLayoutItem = frame().ownerLayoutItem(); 2403 LayoutPartItem ownerLayoutItem = frame().ownerLayoutItem();
2401 if (ownerLayoutItem.isNull()) 2404 if (ownerLayoutItem.isNull())
2402 return frameRect(); 2405 return frameRect();
2403 2406
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after
3597 3600
3598 return scrollbar->totalSize() - scrollbar->visibleSize(); 3601 return scrollbar->totalSize() - scrollbar->visibleSize();
3599 } 3602 }
3600 3603
3601 void FrameView::updateScrollOffset(const ScrollOffset& offset, 3604 void FrameView::updateScrollOffset(const ScrollOffset& offset,
3602 ScrollType scrollType) { 3605 ScrollType scrollType) {
3603 ScrollOffset scrollDelta = offset - m_scrollOffset; 3606 ScrollOffset scrollDelta = offset - m_scrollOffset;
3604 if (scrollDelta.isZero()) 3607 if (scrollDelta.isZero())
3605 return; 3608 return;
3606 3609
3610 showOverlayScrollbars();
3611
3607 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 3612 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
3608 // Don't scroll the FrameView! 3613 // Don't scroll the FrameView!
3609 ASSERT_NOT_REACHED(); 3614 ASSERT_NOT_REACHED();
3610 } 3615 }
3611 3616
3612 m_scrollOffset = offset; 3617 m_scrollOffset = offset;
3613 3618
3614 if (!scrollbarsSuppressed()) 3619 if (!scrollbarsSuppressed())
3615 m_pendingScrollDelta += scrollDelta; 3620 m_pendingScrollDelta += scrollDelta;
3616 3621
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
3818 return m_frame->settings()->ignoreMainFrameOverflowHiddenQuirk() && 3823 return m_frame->settings()->ignoreMainFrameOverflowHiddenQuirk() &&
3819 m_frame->isMainFrame(); 3824 m_frame->isMainFrame();
3820 } 3825 }
3821 3826
3822 void FrameView::updateScrollbarsIfNeeded() { 3827 void FrameView::updateScrollbarsIfNeeded() {
3823 if (m_needsScrollbarsUpdate || needsScrollbarReconstruction() || 3828 if (m_needsScrollbarsUpdate || needsScrollbarReconstruction() ||
3824 scrollOriginChanged()) 3829 scrollOriginChanged())
3825 updateScrollbars(); 3830 updateScrollbars();
3826 } 3831 }
3827 3832
3828 void FrameView::didChangeScrollbarsHidden() {
3829 updateScrollbars();
3830 }
3831
3832 void FrameView::updateScrollbars() { 3833 void FrameView::updateScrollbars() {
3833 m_needsScrollbarsUpdate = false; 3834 m_needsScrollbarsUpdate = false;
3834 3835
3835 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) 3836 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
3836 return; 3837 return;
3837 3838
3838 // Avoid drawing two sets of scrollbars when visual viewport is enabled. 3839 // Avoid drawing two sets of scrollbars when visual viewport is enabled.
3839 if (visualViewportSuppliesScrollbars()) { 3840 if (visualViewportSuppliesScrollbars()) {
3840 m_scrollbarManager.setHasHorizontalScrollbar(false); 3841 m_scrollbarManager.setHasHorizontalScrollbar(false);
3841 m_scrollbarManager.setHasVerticalScrollbar(false); 3842 m_scrollbarManager.setHasVerticalScrollbar(false);
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
4547 DCHECK(m_frame->isMainFrame()); 4548 DCHECK(m_frame->isMainFrame());
4548 return m_initialViewportSize.width(); 4549 return m_initialViewportSize.width();
4549 } 4550 }
4550 4551
4551 int FrameView::initialViewportHeight() const { 4552 int FrameView::initialViewportHeight() const {
4552 DCHECK(m_frame->isMainFrame()); 4553 DCHECK(m_frame->isMainFrame());
4553 return m_initialViewportSize.height(); 4554 return m_initialViewportSize.height();
4554 } 4555 }
4555 4556
4556 } // namespace blink 4557 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698