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

Side by Side Diff: Source/platform/scroll/ScrollableArea.h

Issue 246293006: Blink Support for Overlay Scrollbar Animation Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix unittest and move unittest to blink_platform_unittests Created 6 years, 3 months 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) 2008, 2011 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 22 matching lines...) Expand all
33 #include "wtf/Vector.h" 33 #include "wtf/Vector.h"
34 34
35 namespace blink { 35 namespace blink {
36 36
37 class FloatPoint; 37 class FloatPoint;
38 class GraphicsLayer; 38 class GraphicsLayer;
39 class HostWindow; 39 class HostWindow;
40 class PlatformWheelEvent; 40 class PlatformWheelEvent;
41 class ProgrammaticScrollAnimator; 41 class ProgrammaticScrollAnimator;
42 class ScrollAnimator; 42 class ScrollAnimator;
43 class ScrollbarStateTransitionAnimator;
43 44
44 enum ScrollBehavior { 45 enum ScrollBehavior {
45 ScrollBehaviorAuto, 46 ScrollBehaviorAuto,
46 ScrollBehaviorInstant, 47 ScrollBehaviorInstant,
47 ScrollBehaviorSmooth, 48 ScrollBehaviorSmooth,
48 }; 49 };
49 50
50 enum IncludeScrollbarsInRect { 51 enum IncludeScrollbarsInRect {
51 ExcludeScrollbars, 52 ExcludeScrollbars,
52 IncludeScrollbars, 53 IncludeScrollbars,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 void contentAreaDidShow() const; 101 void contentAreaDidShow() const;
101 void contentAreaDidHide() const; 102 void contentAreaDidHide() const;
102 103
103 void finishCurrentScrollAnimations() const; 104 void finishCurrentScrollAnimations() const;
104 105
105 virtual void didAddScrollbar(Scrollbar*, ScrollbarOrientation); 106 virtual void didAddScrollbar(Scrollbar*, ScrollbarOrientation);
106 virtual void willRemoveScrollbar(Scrollbar*, ScrollbarOrientation); 107 virtual void willRemoveScrollbar(Scrollbar*, ScrollbarOrientation);
107 108
108 virtual void contentsResized(); 109 virtual void contentsResized();
109 110
110 bool hasOverlayScrollbars() const; 111 virtual bool hasOverlayScrollbars() const;
111 void setScrollbarOverlayStyle(ScrollbarOverlayStyle); 112 void setScrollbarOverlayStyle(ScrollbarOverlayStyle);
112 ScrollbarOverlayStyle scrollbarOverlayStyle() const { return static_cast<Scr ollbarOverlayStyle>(m_scrollbarOverlayStyle); } 113 ScrollbarOverlayStyle scrollbarOverlayStyle() const { return static_cast<Scr ollbarOverlayStyle>(m_scrollbarOverlayStyle); }
113 114
114 // This getter will create a ScrollAnimator if it doesn't already exist. 115 // This getter will create a ScrollAnimator if it doesn't already exist.
115 ScrollAnimator* scrollAnimator() const; 116 ScrollAnimator* scrollAnimator() const;
116 117
117 // This getter will return null if the ScrollAnimator hasn't been created ye t. 118 // This getter will return null if the ScrollAnimator hasn't been created ye t.
118 ScrollAnimator* existingScrollAnimator() const { return m_animators ? m_anim ators->scrollAnimator.get() : 0; } 119 ScrollAnimator* existingScrollAnimator() const { return m_animators ? m_anim ators->scrollAnimator.get() : 0; }
119 120
120 ProgrammaticScrollAnimator* programmaticScrollAnimator() const; 121 ProgrammaticScrollAnimator* programmaticScrollAnimator() const;
121 ProgrammaticScrollAnimator* existingProgrammaticScrollAnimator() const 122 ProgrammaticScrollAnimator* existingProgrammaticScrollAnimator() const
122 { 123 {
123 return m_animators ? m_animators->programmaticScrollAnimator.get() : 0; 124 return m_animators ? m_animators->programmaticScrollAnimator.get() : 0;
124 } 125 }
125 126
127 // This getter will create a ScrollbarStateTransitionAnimator if needed and doesn't already exist.
128 ScrollbarStateTransitionAnimator* scrollbarStateTransitionAnimator() const;
129 // This getter will return null if the ScrollbarStateTransitionAnimator hasn 't been created yet.
130 ScrollbarStateTransitionAnimator* existingScrollbarStateTransitionAnimator() const
131 {
132 return m_animators ? m_animators->scrollbarStateTransitionAnimator.get() : 0;
133 }
134
135 bool isDuringStateTransitionAnimation() const;
136 void stateTransitionInProgress();
137
126 const IntPoint& scrollOrigin() const { return m_scrollOrigin; } 138 const IntPoint& scrollOrigin() const { return m_scrollOrigin; }
127 bool scrollOriginChanged() const { return m_scrollOriginChanged; } 139 bool scrollOriginChanged() const { return m_scrollOriginChanged; }
128 140
129 // FIXME(bokan): Meaningless name, rename to isActiveFocus 141 // FIXME(bokan): Meaningless name, rename to isActiveFocus
130 virtual bool isActive() const = 0; 142 virtual bool isActive() const = 0;
131 virtual int scrollSize(ScrollbarOrientation) const = 0; 143 virtual int scrollSize(ScrollbarOrientation) const = 0;
132 virtual void invalidateScrollbar(Scrollbar*, const IntRect&); 144 virtual void invalidateScrollbar(Scrollbar*, const IntRect&);
133 virtual bool isScrollCornerVisible() const = 0; 145 virtual bool isScrollCornerVisible() const = 0;
134 virtual IntRect scrollCornerRect() const = 0; 146 virtual IntRect scrollCornerRect() const = 0;
135 virtual void invalidateScrollCorner(const IntRect&); 147 virtual void invalidateScrollCorner(const IntRect&);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 197
186 // NOTE: Only called from Internals for testing. 198 // NOTE: Only called from Internals for testing.
187 void setScrollOffsetFromInternals(const IntPoint&); 199 void setScrollOffsetFromInternals(const IntPoint&);
188 200
189 IntPoint clampScrollPosition(const IntPoint&) const; 201 IntPoint clampScrollPosition(const IntPoint&) const;
190 202
191 // Let subclasses provide a way of asking for and servicing scroll 203 // Let subclasses provide a way of asking for and servicing scroll
192 // animations. 204 // animations.
193 bool scheduleAnimation(); 205 bool scheduleAnimation();
194 void serviceScrollAnimations(double monotonicTime); 206 void serviceScrollAnimations(double monotonicTime);
207 void serviceScrollbarAnimations();
195 208
196 virtual bool usesCompositedScrolling() const { return false; } 209 virtual bool usesCompositedScrolling() const { return false; }
197 210
198 // Returns true if the GraphicsLayer tree needs to be rebuilt. 211 // Returns true if the GraphicsLayer tree needs to be rebuilt.
199 virtual bool updateAfterCompositingChange() { return false; } 212 virtual bool updateAfterCompositingChange() { return false; }
200 213
201 virtual bool userInputScrollable(ScrollbarOrientation) const = 0; 214 virtual bool userInputScrollable(ScrollbarOrientation) const = 0;
202 virtual bool shouldPlaceVerticalScrollbarOnLeft() const = 0; 215 virtual bool shouldPlaceVerticalScrollbarOnLeft() const = 0;
203 216
204 // Convenience functions 217 // Convenience functions
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 virtual int documentStep(ScrollbarOrientation) const; 276 virtual int documentStep(ScrollbarOrientation) const;
264 virtual float pixelStep(ScrollbarOrientation) const; 277 virtual float pixelStep(ScrollbarOrientation) const;
265 278
266 // Stores the paint invalidations for the scrollbars during layout. 279 // Stores the paint invalidations for the scrollbars during layout.
267 IntRect m_horizontalBarDamage; 280 IntRect m_horizontalBarDamage;
268 IntRect m_verticalBarDamage; 281 IntRect m_verticalBarDamage;
269 282
270 struct ScrollableAreaAnimators { 283 struct ScrollableAreaAnimators {
271 OwnPtr<ScrollAnimator> scrollAnimator; 284 OwnPtr<ScrollAnimator> scrollAnimator;
272 OwnPtr<ProgrammaticScrollAnimator> programmaticScrollAnimator; 285 OwnPtr<ProgrammaticScrollAnimator> programmaticScrollAnimator;
286 OwnPtr<ScrollbarStateTransitionAnimator> scrollbarStateTransitionAnimato r;
273 }; 287 };
274 288
275 mutable OwnPtr<ScrollableAreaAnimators> m_animators; 289 mutable OwnPtr<ScrollableAreaAnimators> m_animators;
276 unsigned m_constrainsScrollingToContentEdge : 1; 290 unsigned m_constrainsScrollingToContentEdge : 1;
277 291
278 unsigned m_inLiveResize : 1; 292 unsigned m_inLiveResize : 1;
279 293
280 unsigned m_verticalScrollElasticity : 2; // ScrollElasticity 294 unsigned m_verticalScrollElasticity : 2; // ScrollElasticity
281 unsigned m_horizontalScrollElasticity : 2; // ScrollElasticity 295 unsigned m_horizontalScrollElasticity : 2; // ScrollElasticity
282 296
(...skipping 11 matching lines...) Expand all
294 // vertical-lr / ltr NO NO 308 // vertical-lr / ltr NO NO
295 // vertical-lr / rtl NO YES 309 // vertical-lr / rtl NO YES
296 // vertical-rl / ltr YES NO 310 // vertical-rl / ltr YES NO
297 // vertical-rl / rtl YES YES 311 // vertical-rl / rtl YES YES
298 IntPoint m_scrollOrigin; 312 IntPoint m_scrollOrigin;
299 }; 313 };
300 314
301 } // namespace blink 315 } // namespace blink
302 316
303 #endif // ScrollableArea_h 317 #endif // ScrollableArea_h
OLDNEW
« no previous file with comments | « Source/platform/scroll/ScrollAnimatorNone.cpp ('k') | Source/platform/scroll/ScrollableArea.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698