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

Unified Diff: third_party/WebKit/Source/platform/scroll/ScrollableArea.h

Issue 2467693002: Implement overlay scrollbar fade out for non-composited scrollers. (Closed)
Patch Set: sigh....git cl format 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/scroll/ScrollableArea.h
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollableArea.h b/third_party/WebKit/Source/platform/scroll/ScrollableArea.h
index 2de87e1c4717c03d7d404e07f1f2173a8066f0e4..eb2188d991bef84d430ee3ae6369dca28dc90d9a 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollableArea.h
+++ b/third_party/WebKit/Source/platform/scroll/ScrollableArea.h
@@ -109,8 +109,10 @@ class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin {
void mouseEnteredContentArea() const;
void mouseExitedContentArea() const;
void mouseMovedInContentArea() const;
- void mouseEnteredScrollbar(Scrollbar&) const;
- void mouseExitedScrollbar(Scrollbar&) const;
+ void mouseEnteredScrollbar(Scrollbar&);
+ void mouseExitedScrollbar(Scrollbar&);
+ void mouseCapturedScrollbar();
+ void mouseReleasedScrollbar();
void contentAreaDidShow() const;
void contentAreaDidHide() const;
@@ -229,7 +231,6 @@ class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin {
virtual bool shouldSuspendScrollAnimations() const { return true; }
virtual void scrollbarStyleChanged() {}
- virtual void scrollbarVisibilityChanged() {}
virtual bool scrollbarsCanBeActive() const = 0;
// Returns the bounding box of this scrollable area, in the coordinate system
@@ -258,7 +259,6 @@ class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin {
// Overlay scrollbars can "fade-out" when inactive.
virtual bool scrollbarsHidden() const;
virtual void setScrollbarsHidden(bool);
- virtual void didChangeScrollbarsHidden(){};
// Returns true if the GraphicsLayer tree needs to be rebuilt.
virtual bool updateAfterCompositingChange() { return false; }
@@ -358,7 +358,7 @@ class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin {
EAGERLY_FINALIZE();
DECLARE_VIRTUAL_TRACE();
- virtual void clearScrollAnimators();
+ virtual void clearScrollableArea();
virtual ScrollAnchor* scrollAnchor() { return nullptr; }
@@ -390,11 +390,20 @@ class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin {
m_verticalScrollbarNeedsPaintInvalidation = false;
m_scrollCornerNeedsPaintInvalidation = false;
}
+ void showOverlayScrollbars();
+
+ // Called when scrollbar hides/shows for overlay scrollbars. This callback
+ // shouldn't do any significant work as it can be called unexpectadly often
+ // on Mac. This happens because painting code has to set alpha to 1, paint,
+ // then reset to alpha, causing spurrious "visibilityChanged" calls.
+ virtual void scrollbarVisibilityChanged() {}
private:
void programmaticScrollHelper(const ScrollOffset&, ScrollBehavior);
void userScrollHelper(const ScrollOffset&, ScrollBehavior);
+ void fadeOverlayScrollbarsTimerFired(TimerBase*);
+
// This function should be overriden by subclasses to perform the actual
// scroll of the content.
virtual void updateScrollOffset(const ScrollOffset&, ScrollType) = 0;
@@ -407,6 +416,8 @@ class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin {
mutable Member<ScrollAnimatorBase> m_scrollAnimator;
mutable Member<ProgrammaticScrollAnimator> m_programmaticScrollAnimator;
+ std::unique_ptr<Timer<ScrollableArea>> m_fadeOverlayScrollbarsTimer;
+
unsigned m_scrollbarOverlayColorTheme : 2;
unsigned m_scrollOriginChanged : 1;
@@ -415,6 +426,7 @@ class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin {
unsigned m_verticalScrollbarNeedsPaintInvalidation : 1;
unsigned m_scrollCornerNeedsPaintInvalidation : 1;
unsigned m_scrollbarsHidden : 1;
+ unsigned m_scrollbarCaptured : 1;
// There are 6 possible combinations of writing mode and direction. Scroll
// origin will be non-zero in the x or y axis if there is any reversed

Powered by Google App Engine
This is Rietveld 408576698