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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp

Issue 2489703002: Revert of Implement overlay scrollbar fade out for non-composited scrollers. (Closed)
Patch Set: 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) 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 box().document().rootScrollerController()) 165 box().document().rootScrollerController())
166 controller->didDisposePaintLayerScrollableArea(*this); 166 controller->didDisposePaintLayerScrollableArea(*this);
167 167
168 m_scrollbarManager.dispose(); 168 m_scrollbarManager.dispose();
169 169
170 if (m_scrollCorner) 170 if (m_scrollCorner)
171 m_scrollCorner->destroy(); 171 m_scrollCorner->destroy();
172 if (m_resizer) 172 if (m_resizer)
173 m_resizer->destroy(); 173 m_resizer->destroy();
174 174
175 clearScrollableArea(); 175 clearScrollAnimators();
176 176
177 // Note: it is not safe to call ScrollAnchor::clear if the document is being 177 // Note: it is not safe to call ScrollAnchor::clear if the document is being
178 // destroyed, because LayoutObjectChildList::removeChildNode skips the call to 178 // destroyed, because LayoutObjectChildList::removeChildNode skips the call to
179 // willBeRemovedFromTree, 179 // willBeRemovedFromTree,
180 // leaving the ScrollAnchor with a stale LayoutObject pointer. 180 // leaving the ScrollAnchor with a stale LayoutObject pointer.
181 if (RuntimeEnabledFeatures::scrollAnchoringEnabled() && 181 if (RuntimeEnabledFeatures::scrollAnchoringEnabled() &&
182 !box().documentBeingDestroyed()) 182 !box().documentBeingDestroyed())
183 m_scrollAnchor.clearSelf(); 183 m_scrollAnchor.clearSelf();
184 184
185 #if DCHECK_IS_ON() 185 #if DCHECK_IS_ON()
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 maximumScrollOffsetInt() - minimumScrollOffsetInt(); 361 maximumScrollOffsetInt() - minimumScrollOffsetInt();
362 return (orientation == HorizontalScrollbar) ? scrollDimensions.width() 362 return (orientation == HorizontalScrollbar) ? scrollDimensions.width()
363 : scrollDimensions.height(); 363 : scrollDimensions.height();
364 } 364 }
365 365
366 void PaintLayerScrollableArea::updateScrollOffset(const ScrollOffset& newOffset, 366 void PaintLayerScrollableArea::updateScrollOffset(const ScrollOffset& newOffset,
367 ScrollType scrollType) { 367 ScrollType scrollType) {
368 if (scrollOffset() == newOffset) 368 if (scrollOffset() == newOffset)
369 return; 369 return;
370 370
371 showOverlayScrollbars();
372 ScrollOffset scrollDelta = scrollOffset() - newOffset; 371 ScrollOffset scrollDelta = scrollOffset() - newOffset;
373 m_scrollOffset = newOffset; 372 m_scrollOffset = newOffset;
374 373
375 LocalFrame* frame = box().frame(); 374 LocalFrame* frame = box().frame();
376 DCHECK(frame); 375 DCHECK(frame);
377 376
378 FrameView* frameView = box().frameView(); 377 FrameView* frameView = box().frameView();
379 378
380 TRACE_EVENT1("devtools.timeline", "ScrollLayer", "data", 379 TRACE_EVENT1("devtools.timeline", "ScrollLayer", "data",
381 InspectorScrollLayerEvent::data(&box())); 380 InspectorScrollLayerEvent::data(&box()));
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 : 0; 508 : 0;
510 } 509 }
511 510
512 // TODO(szager): Handle fractional scroll offsets correctly. 511 // TODO(szager): Handle fractional scroll offsets correctly.
513 return IntRect( 512 return IntRect(
514 flooredIntPoint(scrollPosition()), 513 flooredIntPoint(scrollPosition()),
515 IntSize(max(0, layer()->size().width() - verticalScrollbarWidth), 514 IntSize(max(0, layer()->size().width() - verticalScrollbarWidth),
516 max(0, layer()->size().height() - horizontalScrollbarHeight))); 515 max(0, layer()->size().height() - horizontalScrollbarHeight)));
517 } 516 }
518 517
519 void PaintLayerScrollableArea::visibleSizeChanged() {
520 showOverlayScrollbars();
521 }
522
523 int PaintLayerScrollableArea::visibleHeight() const { 518 int PaintLayerScrollableArea::visibleHeight() const {
524 return layer()->size().height(); 519 return layer()->size().height();
525 } 520 }
526 521
527 int PaintLayerScrollableArea::visibleWidth() const { 522 int PaintLayerScrollableArea::visibleWidth() const {
528 return layer()->size().width(); 523 return layer()->size().width();
529 } 524 }
530 525
531 IntSize PaintLayerScrollableArea::contentsSize() const { 526 IntSize PaintLayerScrollableArea::contentsSize() const {
532 return IntSize(pixelSnappedScrollWidth(), pixelSnappedScrollHeight()); 527 return IntSize(pixelSnappedScrollWidth(), pixelSnappedScrollHeight());
(...skipping 11 matching lines...) Expand all
544 } 539 }
545 540
546 bool PaintLayerScrollableArea::shouldSuspendScrollAnimations() const { 541 bool PaintLayerScrollableArea::shouldSuspendScrollAnimations() const {
547 LayoutView* view = box().view(); 542 LayoutView* view = box().view();
548 if (!view) 543 if (!view)
549 return true; 544 return true;
550 return view->frameView()->shouldSuspendScrollAnimations(); 545 return view->frameView()->shouldSuspendScrollAnimations();
551 } 546 }
552 547
553 void PaintLayerScrollableArea::scrollbarVisibilityChanged() { 548 void PaintLayerScrollableArea::scrollbarVisibilityChanged() {
554 updateScrollbarsEnabledState();
555 if (LayoutView* view = box().view()) 549 if (LayoutView* view = box().view())
556 return view->clearHitTestCache(); 550 return view->clearHitTestCache();
557 } 551 }
558 552
559 bool PaintLayerScrollableArea::scrollbarsCanBeActive() const { 553 bool PaintLayerScrollableArea::scrollbarsCanBeActive() const {
560 LayoutView* view = box().view(); 554 LayoutView* view = box().view();
561 if (!view) 555 if (!view)
562 return false; 556 return false;
563 return view->frameView()->scrollbarsCanBeActive(); 557 return view->frameView()->scrollbarsCanBeActive();
564 } 558 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 if (overflowRect().isEmpty()) 635 if (overflowRect().isEmpty())
642 return; 636 return;
643 LayoutPoint scrollableOverflow = 637 LayoutPoint scrollableOverflow =
644 m_overflowRect.location() - 638 m_overflowRect.location() -
645 LayoutSize(box().borderLeft(), box().borderTop()); 639 LayoutSize(box().borderLeft(), box().borderTop());
646 setScrollOrigin(flooredIntPoint(-scrollableOverflow) + 640 setScrollOrigin(flooredIntPoint(-scrollableOverflow) +
647 box().originAdjustmentForScrollbars()); 641 box().originAdjustmentForScrollbars());
648 } 642 }
649 643
650 void PaintLayerScrollableArea::updateScrollDimensions() { 644 void PaintLayerScrollableArea::updateScrollDimensions() {
651 if (m_overflowRect.size() != box().layoutOverflowRect().size())
652 contentsResized();
653 m_overflowRect = box().layoutOverflowRect(); 645 m_overflowRect = box().layoutOverflowRect();
654 box().flipForWritingMode(m_overflowRect); 646 box().flipForWritingMode(m_overflowRect);
655 updateScrollOrigin(); 647 updateScrollOrigin();
656 } 648 }
657 649
658 void PaintLayerScrollableArea::setScrollOffsetUnconditionally( 650 void PaintLayerScrollableArea::setScrollOffsetUnconditionally(
659 const ScrollOffset& offset, 651 const ScrollOffset& offset,
660 ScrollType scrollType) { 652 ScrollType scrollType) {
661 cancelScrollAnimation(); 653 cancelScrollAnimation();
662 scrollOffsetChanged(offset, scrollType); 654 scrollOffsetChanged(offset, scrollType);
663 } 655 }
664 656
657 void PaintLayerScrollableArea::didChangeScrollbarsHidden() {
658 updateScrollbarsEnabledState();
659 }
660
665 void PaintLayerScrollableArea::updateScrollbarsEnabledState() { 661 void PaintLayerScrollableArea::updateScrollbarsEnabledState() {
666 // overflow:scroll should just enable/disable. 662 // overflow:scroll should just enable/disable.
667 if (box().style()->overflowX() == OverflowScroll && horizontalScrollbar()) { 663 if (box().style()->overflowX() == OverflowScroll && horizontalScrollbar()) {
668 horizontalScrollbar()->setEnabled(hasHorizontalOverflow() && 664 horizontalScrollbar()->setEnabled(hasHorizontalOverflow() &&
669 !scrollbarsHidden()); 665 !scrollbarsHidden());
670 } 666 }
671 if (box().style()->overflowY() == OverflowScroll && verticalScrollbar()) { 667 if (box().style()->overflowY() == OverflowScroll && verticalScrollbar()) {
672 verticalScrollbar()->setEnabled(hasVerticalOverflow() && 668 verticalScrollbar()->setEnabled(hasVerticalOverflow() &&
673 !scrollbarsHidden()); 669 !scrollbarsHidden());
674 } 670 }
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1976 1972
1977 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: 1973 void PaintLayerScrollableArea::DelayScrollOffsetClampScope::
1978 clampScrollableAreas() { 1974 clampScrollableAreas() {
1979 for (auto& scrollableArea : *s_needsClamp) 1975 for (auto& scrollableArea : *s_needsClamp)
1980 scrollableArea->clampScrollOffsetsAfterLayout(); 1976 scrollableArea->clampScrollOffsetsAfterLayout();
1981 delete s_needsClamp; 1977 delete s_needsClamp;
1982 s_needsClamp = nullptr; 1978 s_needsClamp = nullptr;
1983 } 1979 }
1984 1980
1985 } // namespace blink 1981 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698