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

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 try server compile error Created 6 years, 6 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 WebCore { 35 namespace WebCore {
36 36
37 class FloatPoint; 37 class FloatPoint;
38 class GraphicsContext; 38 class GraphicsContext;
39 class GraphicsLayer; 39 class GraphicsLayer;
40 class PlatformGestureEvent; 40 class PlatformGestureEvent;
41 class PlatformWheelEvent; 41 class PlatformWheelEvent;
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 void contentAreaDidShow() const; 95 void contentAreaDidShow() const;
95 void contentAreaDidHide() const; 96 void contentAreaDidHide() const;
96 97
97 void finishCurrentScrollAnimations() const; 98 void finishCurrentScrollAnimations() const;
98 99
99 virtual void didAddScrollbar(Scrollbar*, ScrollbarOrientation); 100 virtual void didAddScrollbar(Scrollbar*, ScrollbarOrientation);
100 virtual void willRemoveScrollbar(Scrollbar*, ScrollbarOrientation); 101 virtual void willRemoveScrollbar(Scrollbar*, ScrollbarOrientation);
101 102
102 virtual void contentsResized(); 103 virtual void contentsResized();
103 104
104 bool hasOverlayScrollbars() const; 105 virtual bool hasOverlayScrollbars() const;
105 void setScrollbarOverlayStyle(ScrollbarOverlayStyle); 106 void setScrollbarOverlayStyle(ScrollbarOverlayStyle);
106 ScrollbarOverlayStyle scrollbarOverlayStyle() const { return static_cast<Scr ollbarOverlayStyle>(m_scrollbarOverlayStyle); } 107 ScrollbarOverlayStyle scrollbarOverlayStyle() const { return static_cast<Scr ollbarOverlayStyle>(m_scrollbarOverlayStyle); }
107 108
108 // This getter will create a ScrollAnimator if it doesn't already exist. 109 // This getter will create a ScrollAnimator if it doesn't already exist.
109 ScrollAnimator* scrollAnimator() const; 110 ScrollAnimator* scrollAnimator() const;
110 111
111 // This getter will return null if the ScrollAnimator hasn't been created ye t. 112 // This getter will return null if the ScrollAnimator hasn't been created ye t.
112 ScrollAnimator* existingScrollAnimator() const { return m_scrollAnimator.get (); } 113 ScrollAnimator* existingScrollAnimator() const { return m_scrollAnimator.get (); }
113 114
115 // This getter will create a ScrollbarStateTransitionAnimator if needed and doesn't already exist.
116 ScrollbarStateTransitionAnimator* scrollbarStateTransitionAnimator() const;
117 // This getter will return null if the ScrollbarStateTransitionAnimator hasn 't been created yet.
118 ScrollbarStateTransitionAnimator* existingScrollbarStateTransitionAnimator() const
119 {
120 return m_scrollbarStateTransitionAnimator.get();
121 }
122
123 bool isDuringStateTransitionAnimation() const;
124 void stateTransitionInProgress();
125
114 const IntPoint& scrollOrigin() const { return m_scrollOrigin; } 126 const IntPoint& scrollOrigin() const { return m_scrollOrigin; }
115 bool scrollOriginChanged() const { return m_scrollOriginChanged; } 127 bool scrollOriginChanged() const { return m_scrollOriginChanged; }
116 128
117 // FIXME(bokan): Meaningless name, rename to isActiveFocus 129 // FIXME(bokan): Meaningless name, rename to isActiveFocus
118 virtual bool isActive() const = 0; 130 virtual bool isActive() const = 0;
119 virtual int scrollSize(ScrollbarOrientation) const = 0; 131 virtual int scrollSize(ScrollbarOrientation) const = 0;
120 virtual void invalidateScrollbar(Scrollbar*, const IntRect&); 132 virtual void invalidateScrollbar(Scrollbar*, const IntRect&);
121 virtual bool isScrollCornerVisible() const = 0; 133 virtual bool isScrollCornerVisible() const = 0;
122 virtual IntRect scrollCornerRect() const = 0; 134 virtual IntRect scrollCornerRect() const = 0;
123 virtual void invalidateScrollCorner(const IntRect&); 135 virtual void invalidateScrollCorner(const IntRect&);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 virtual bool scrollAnimatorEnabled() const { return false; } 184 virtual bool scrollAnimatorEnabled() const { return false; }
173 185
174 // NOTE: Only called from Internals for testing. 186 // NOTE: Only called from Internals for testing.
175 void setScrollOffsetFromInternals(const IntPoint&); 187 void setScrollOffsetFromInternals(const IntPoint&);
176 188
177 IntPoint clampScrollPosition(const IntPoint&) const; 189 IntPoint clampScrollPosition(const IntPoint&) const;
178 190
179 // Let subclasses provide a way of asking for and servicing scroll 191 // Let subclasses provide a way of asking for and servicing scroll
180 // animations. 192 // animations.
181 virtual bool scheduleAnimation() { return false; } 193 virtual bool scheduleAnimation() { return false; }
182 void serviceScrollAnimations(); 194 void serviceScrollbarAnimations();
183 195
184 virtual bool usesCompositedScrolling() const { return false; } 196 virtual bool usesCompositedScrolling() const { return false; }
185 197
186 virtual void updateAfterCompositingChange() { } 198 virtual void updateAfterCompositingChange() { }
187 199
188 virtual bool userInputScrollable(ScrollbarOrientation) const = 0; 200 virtual bool userInputScrollable(ScrollbarOrientation) const = 0;
189 virtual bool shouldPlaceVerticalScrollbarOnLeft() const = 0; 201 virtual bool shouldPlaceVerticalScrollbarOnLeft() const = 0;
190 202
191 // Convenience functions 203 // Convenience functions
192 int scrollPosition(ScrollbarOrientation orientation) { return orientation == HorizontalScrollbar ? scrollPosition().x() : scrollPosition().y(); } 204 int scrollPosition(ScrollbarOrientation orientation) { return orientation == HorizontalScrollbar ? scrollPosition().x() : scrollPosition().y(); }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 // This function should be overriden by subclasses to perform the actual 262 // This function should be overriden by subclasses to perform the actual
251 // scroll of the content. 263 // scroll of the content.
252 virtual void setScrollOffset(const IntPoint&) = 0; 264 virtual void setScrollOffset(const IntPoint&) = 0;
253 265
254 virtual int lineStep(ScrollbarOrientation) const; 266 virtual int lineStep(ScrollbarOrientation) const;
255 virtual int pageStep(ScrollbarOrientation) const; 267 virtual int pageStep(ScrollbarOrientation) const;
256 virtual int documentStep(ScrollbarOrientation) const; 268 virtual int documentStep(ScrollbarOrientation) const;
257 virtual float pixelStep(ScrollbarOrientation) const; 269 virtual float pixelStep(ScrollbarOrientation) const;
258 270
259 mutable OwnPtr<ScrollAnimator> m_scrollAnimator; 271 mutable OwnPtr<ScrollAnimator> m_scrollAnimator;
272 mutable OwnPtr<ScrollbarStateTransitionAnimator> m_scrollbarStateTransitionA nimator;
260 unsigned m_constrainsScrollingToContentEdge : 1; 273 unsigned m_constrainsScrollingToContentEdge : 1;
261 274
262 unsigned m_inLiveResize : 1; 275 unsigned m_inLiveResize : 1;
263 276
264 unsigned m_verticalScrollElasticity : 2; // ScrollElasticity 277 unsigned m_verticalScrollElasticity : 2; // ScrollElasticity
265 unsigned m_horizontalScrollElasticity : 2; // ScrollElasticity 278 unsigned m_horizontalScrollElasticity : 2; // ScrollElasticity
266 279
267 unsigned m_scrollbarOverlayStyle : 2; // ScrollbarOverlayStyle 280 unsigned m_scrollbarOverlayStyle : 2; // ScrollbarOverlayStyle
268 281
269 unsigned m_scrollOriginChanged : 1; 282 unsigned m_scrollOriginChanged : 1;
270 283
271 // There are 8 possible combinations of writing mode and direction. Scroll o rigin will be non-zero in the x or y axis 284 // There are 8 possible combinations of writing mode and direction. Scroll o rigin will be non-zero in the x or y axis
272 // if there is any reversed direction or writing-mode. The combinations are: 285 // if there is any reversed direction or writing-mode. The combinations are:
273 // writing-mode / direction scrollOrigin.x() set scrollOrigin.y() set 286 // writing-mode / direction scrollOrigin.x() set scrollOrigin.y() set
274 // horizontal-tb / ltr NO NO 287 // horizontal-tb / ltr NO NO
275 // horizontal-tb / rtl YES NO 288 // horizontal-tb / rtl YES NO
276 // horizontal-bt / ltr NO YES 289 // horizontal-bt / ltr NO YES
277 // horizontal-bt / rtl YES YES 290 // horizontal-bt / rtl YES YES
278 // vertical-lr / ltr NO NO 291 // vertical-lr / ltr NO NO
279 // vertical-lr / rtl NO YES 292 // vertical-lr / rtl NO YES
280 // vertical-rl / ltr YES NO 293 // vertical-rl / ltr YES NO
281 // vertical-rl / rtl YES YES 294 // vertical-rl / rtl YES YES
282 IntPoint m_scrollOrigin; 295 IntPoint m_scrollOrigin;
283 }; 296 };
284 297
285 } // namespace WebCore 298 } // namespace WebCore
286 299
287 #endif // ScrollableArea_h 300 #endif // ScrollableArea_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698