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

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

Issue 1215973002: Oilpan: improve ScrollableArea handling. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove too conservative null check Created 5 years, 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #ifndef ScrollAnimator_h 31 #ifndef ScrollAnimator_h
32 #define ScrollAnimator_h 32 #define ScrollAnimator_h
33 33
34 #include "platform/PlatformExport.h" 34 #include "platform/PlatformExport.h"
35 #include "platform/PlatformWheelEvent.h" 35 #include "platform/PlatformWheelEvent.h"
36 #include "platform/geometry/FloatSize.h" 36 #include "platform/geometry/FloatSize.h"
37 #include "platform/scroll/ScrollTypes.h" 37 #include "platform/scroll/ScrollTypes.h"
38 #include "wtf/Forward.h" 38 #include "wtf/Forward.h"
39 #include "wtf/RefCounted.h"
40 39
41 namespace blink { 40 namespace blink {
42 41
43 class FloatPoint; 42 class FloatPoint;
44 class ScrollableArea; 43 class ScrollableArea;
45 class Scrollbar; 44 class Scrollbar;
46 45
47 class PLATFORM_EXPORT ScrollAnimator : public RefCounted<ScrollAnimator> { 46 class PLATFORM_EXPORT ScrollAnimator {
48 public: 47 public:
49 static PassRefPtr<ScrollAnimator> create(ScrollableArea*); 48 static PassOwnPtr<ScrollAnimator> create(ScrollableArea*);
50 49
51 virtual ~ScrollAnimator(); 50 virtual ~ScrollAnimator();
52 51
53 // Computes a scroll destination for the given parameters. The returned 52 // Computes a scroll destination for the given parameters. The returned
54 // ScrollResultOneDimensional will have didScroll set to false if already at 53 // ScrollResultOneDimensional will have didScroll set to false if already at
55 // the destination. Otherwise, starts scrolling towards the destination and 54 // the destination. Otherwise, starts scrolling towards the destination and
56 // didScroll is true. Scrolling may be immediate or animated. The base 55 // didScroll is true. Scrolling may be immediate or animated. The base
57 // class implementation always scrolls immediately, never animates. 56 // class implementation always scrolls immediately, never animates.
58 virtual ScrollResultOneDimensional userScroll(ScrollbarOrientation, ScrollGr anularity, float step, float delta); 57 virtual ScrollResultOneDimensional userScroll(ScrollbarOrientation, ScrollGr anularity, float step, float delta);
59 58
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 97
99 virtual bool shouldScrollbarParticipateInHitTesting(Scrollbar*) { return tru e; } 98 virtual bool shouldScrollbarParticipateInHitTesting(Scrollbar*) { return tru e; }
100 99
101 virtual void notifyContentAreaScrolled(const FloatSize&) { } 100 virtual void notifyContentAreaScrolled(const FloatSize&) { }
102 101
103 protected: 102 protected:
104 explicit ScrollAnimator(ScrollableArea*); 103 explicit ScrollAnimator(ScrollableArea*);
105 104
106 virtual void notifyPositionChanged(); 105 virtual void notifyPositionChanged();
107 106
108 ScrollableArea* m_scrollableArea; 107 ScrollableArea* m_scrollableArea;
haraken 2015/06/29 15:20:22 Maybe can we move ScrollAnimator to the heap and u
sof 2015/06/29 15:59:41 Keeping "platform near" objects like ScrollAnimato
109 float m_currentPosX; // We avoid using a FloatPoint in order to reduce 108 float m_currentPosX; // We avoid using a FloatPoint in order to reduce
110 float m_currentPosY; // subclass code complexity. 109 float m_currentPosY; // subclass code complexity.
111 110
112 private: 111 private:
113 float clampScrollPosition(ScrollbarOrientation, float); 112 float clampScrollPosition(ScrollbarOrientation, float);
114 }; 113 };
115 114
116 } // namespace blink 115 } // namespace blink
117 116
118 #endif // ScrollAnimator_h 117 #endif // ScrollAnimator_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698