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

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp

Issue 2453553003: Disable overlay scrollbars in Blink when hidden by the compositor. (Closed)
Patch Set: Rebase 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) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, Google Inc. All rights reserved.
3 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved. 3 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 static const float kMinFractionToStepWhenPaging = 0.875f; 43 static const float kMinFractionToStepWhenPaging = 0.875f;
44 44
45 namespace blink { 45 namespace blink {
46 46
47 struct SameSizeAsScrollableArea { 47 struct SameSizeAsScrollableArea {
48 virtual ~SameSizeAsScrollableArea(); 48 virtual ~SameSizeAsScrollableArea();
49 #if ENABLE(ASSERT) 49 #if ENABLE(ASSERT)
50 VerifyEagerFinalization verifyEager; 50 VerifyEagerFinalization verifyEager;
51 #endif 51 #endif
52 Member<void*> pointer[2]; 52 Member<void*> pointer[2];
53 unsigned bitfields : 16; 53 unsigned bitfields : 17;
54 IntPoint origin; 54 IntPoint origin;
55 }; 55 };
56 56
57 static_assert(sizeof(ScrollableArea) == sizeof(SameSizeAsScrollableArea), 57 static_assert(sizeof(ScrollableArea) == sizeof(SameSizeAsScrollableArea),
58 "ScrollableArea should stay small"); 58 "ScrollableArea should stay small");
59 59
60 int ScrollableArea::pixelsPerLineStep(HostWindow* host) { 60 int ScrollableArea::pixelsPerLineStep(HostWindow* host) {
61 if (!host) 61 if (!host)
62 return kPixelsPerLineStep; 62 return kPixelsPerLineStep;
63 return host->windowToViewportScalar(kPixelsPerLineStep); 63 return host->windowToViewportScalar(kPixelsPerLineStep);
64 } 64 }
65 65
66 float ScrollableArea::minFractionToStepWhenPaging() { 66 float ScrollableArea::minFractionToStepWhenPaging() {
67 return kMinFractionToStepWhenPaging; 67 return kMinFractionToStepWhenPaging;
68 } 68 }
69 69
70 int ScrollableArea::maxOverlapBetweenPages() { 70 int ScrollableArea::maxOverlapBetweenPages() {
71 static int maxOverlapBetweenPages = 71 static int maxOverlapBetweenPages =
72 ScrollbarTheme::theme().maxOverlapBetweenPages(); 72 ScrollbarTheme::theme().maxOverlapBetweenPages();
73 return maxOverlapBetweenPages; 73 return maxOverlapBetweenPages;
74 } 74 }
75 75
76 ScrollableArea::ScrollableArea() 76 ScrollableArea::ScrollableArea()
77 : m_scrollbarOverlayColorTheme(ScrollbarOverlayColorThemeDark), 77 : m_scrollbarOverlayColorTheme(ScrollbarOverlayColorThemeDark),
78 m_scrollOriginChanged(false), 78 m_scrollOriginChanged(false),
79 m_horizontalScrollbarNeedsPaintInvalidation(false), 79 m_horizontalScrollbarNeedsPaintInvalidation(false),
80 m_verticalScrollbarNeedsPaintInvalidation(false), 80 m_verticalScrollbarNeedsPaintInvalidation(false),
81 m_scrollCornerNeedsPaintInvalidation(false) {} 81 m_scrollCornerNeedsPaintInvalidation(false),
82 m_scrollbarsHidden(false) {}
82 83
83 ScrollableArea::~ScrollableArea() {} 84 ScrollableArea::~ScrollableArea() {}
84 85
85 void ScrollableArea::clearScrollAnimators() { 86 void ScrollableArea::clearScrollAnimators() {
86 #if OS(MACOSX) 87 #if OS(MACOSX)
87 if (m_scrollAnimator) 88 if (m_scrollAnimator)
88 m_scrollAnimator->dispose(); 89 m_scrollAnimator->dispose();
89 #endif 90 #endif
90 m_scrollAnimator.clear(); 91 m_scrollAnimator.clear();
91 m_programmaticScrollAnimator.clear(); 92 m_programmaticScrollAnimator.clear();
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 // scheduled on the compositor. 524 // scheduled on the compositor.
524 // TODO(ymalik): We have a non-transient "main thread scrolling reason" 525 // TODO(ymalik): We have a non-transient "main thread scrolling reason"
525 // that doesn't actually cause shouldScrollOnMainThread() to be true. 526 // that doesn't actually cause shouldScrollOnMainThread() to be true.
526 // This is confusing and should be cleaned up. 527 // This is confusing and should be cleaned up.
527 return !!(reasons & 528 return !!(reasons &
528 ~MainThreadScrollingReason::kHandlingScrollFromMainThread); 529 ~MainThreadScrollingReason::kHandlingScrollFromMainThread);
529 } 530 }
530 return true; 531 return true;
531 } 532 }
532 533
534 bool ScrollableArea::scrollbarsHidden() const {
535 return hasOverlayScrollbars() && m_scrollbarsHidden;
536 }
537
538 void ScrollableArea::setScrollbarsHidden(bool hidden) {
539 if (m_scrollbarsHidden == static_cast<unsigned>(hidden))
540 return;
541 m_scrollbarsHidden = hidden;
542 didChangeScrollbarsHidden();
543 }
544
533 IntRect ScrollableArea::visibleContentRect( 545 IntRect ScrollableArea::visibleContentRect(
534 IncludeScrollbarsInRect scrollbarInclusion) const { 546 IncludeScrollbarsInRect scrollbarInclusion) const {
535 int scrollbarWidth = 547 int scrollbarWidth =
536 scrollbarInclusion == IncludeScrollbars ? verticalScrollbarWidth() : 0; 548 scrollbarInclusion == IncludeScrollbars ? verticalScrollbarWidth() : 0;
537 int scrollbarHeight = 549 int scrollbarHeight =
538 scrollbarInclusion == IncludeScrollbars ? horizontalScrollbarHeight() : 0; 550 scrollbarInclusion == IncludeScrollbars ? horizontalScrollbarHeight() : 0;
539 551
540 return enclosingIntRect( 552 return enclosingIntRect(
541 IntRect(scrollOffset().width(), scrollOffset().height(), 553 IntRect(scrollOffset().width(), scrollOffset().height(),
542 std::max(0, visibleWidth() + scrollbarWidth), 554 std::max(0, visibleWidth() + scrollbarWidth),
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 return IntSize(std::max(0, size.width() - verticalScrollbarWidth()), 604 return IntSize(std::max(0, size.width() - verticalScrollbarWidth()),
593 std::max(0, size.height() - horizontalScrollbarHeight())); 605 std::max(0, size.height() - horizontalScrollbarHeight()));
594 } 606 }
595 607
596 DEFINE_TRACE(ScrollableArea) { 608 DEFINE_TRACE(ScrollableArea) {
597 visitor->trace(m_scrollAnimator); 609 visitor->trace(m_scrollAnimator);
598 visitor->trace(m_programmaticScrollAnimator); 610 visitor->trace(m_programmaticScrollAnimator);
599 } 611 }
600 612
601 } // namespace blink 613 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/ScrollableArea.h ('k') | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698