OLD | NEW |
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 26 matching lines...) Expand all Loading... |
37 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
38 #include "platform/scroll/ScrollTypes.h" | 38 #include "platform/scroll/ScrollTypes.h" |
39 #include "wtf/Forward.h" | 39 #include "wtf/Forward.h" |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
43 class FloatPoint; | 43 class FloatPoint; |
44 class ScrollableArea; | 44 class ScrollableArea; |
45 class Scrollbar; | 45 class Scrollbar; |
46 | 46 |
47 class PLATFORM_EXPORT ScrollAnimatorBase { | 47 class PLATFORM_EXPORT ScrollAnimatorBase : public GarbageCollectedFinalized<Scro
llAnimatorBase> { |
48 public: | 48 public: |
49 static PassOwnPtr<ScrollAnimatorBase> create(ScrollableArea*); | 49 static ScrollAnimatorBase* create(ScrollableArea*); |
50 | 50 |
51 virtual ~ScrollAnimatorBase(); | 51 virtual ~ScrollAnimatorBase(); |
| 52 virtual void cleanup() { } |
52 | 53 |
53 // Computes a scroll destination for the given parameters. The returned | 54 // Computes a scroll destination for the given parameters. The returned |
54 // ScrollResultOneDimensional will have didScroll set to false if already at | 55 // ScrollResultOneDimensional will have didScroll set to false if already at |
55 // the destination. Otherwise, starts scrolling towards the destination and | 56 // the destination. Otherwise, starts scrolling towards the destination and |
56 // didScroll is true. Scrolling may be immediate or animated. The base | 57 // didScroll is true. Scrolling may be immediate or animated. The base |
57 // class implementation always scrolls immediately, never animates. | 58 // class implementation always scrolls immediately, never animates. |
58 virtual ScrollResultOneDimensional userScroll(ScrollbarOrientation, ScrollGr
anularity, float step, float delta); | 59 virtual ScrollResultOneDimensional userScroll(ScrollbarOrientation, ScrollGr
anularity, float step, float delta); |
59 | 60 |
60 virtual void scrollToOffsetWithoutAnimation(const FloatPoint&); | 61 virtual void scrollToOffsetWithoutAnimation(const FloatPoint&); |
61 | 62 |
(...skipping 30 matching lines...) Expand all Loading... |
92 virtual void didAddVerticalScrollbar(Scrollbar*) { } | 93 virtual void didAddVerticalScrollbar(Scrollbar*) { } |
93 virtual void willRemoveVerticalScrollbar(Scrollbar*) { } | 94 virtual void willRemoveVerticalScrollbar(Scrollbar*) { } |
94 virtual void didAddHorizontalScrollbar(Scrollbar*) { } | 95 virtual void didAddHorizontalScrollbar(Scrollbar*) { } |
95 virtual void willRemoveHorizontalScrollbar(Scrollbar*) { } | 96 virtual void willRemoveHorizontalScrollbar(Scrollbar*) { } |
96 | 97 |
97 virtual bool shouldScrollbarParticipateInHitTesting(Scrollbar*) { return tru
e; } | 98 virtual bool shouldScrollbarParticipateInHitTesting(Scrollbar*) { return tru
e; } |
98 | 99 |
99 virtual void notifyContentAreaScrolled(const FloatSize&) { } | 100 virtual void notifyContentAreaScrolled(const FloatSize&) { } |
100 | 101 |
101 virtual bool setScrollbarsVisibleForTesting(bool) { return false; } | 102 virtual bool setScrollbarsVisibleForTesting(bool) { return false; } |
| 103 |
| 104 DECLARE_VIRTUAL_TRACE(); |
| 105 |
102 protected: | 106 protected: |
103 explicit ScrollAnimatorBase(ScrollableArea*); | 107 explicit ScrollAnimatorBase(ScrollableArea*); |
104 | 108 |
105 virtual void notifyPositionChanged(); | 109 virtual void notifyPositionChanged(); |
106 | 110 |
107 GC_PLUGIN_IGNORE("509911") | 111 RawPtrWillBeMember<ScrollableArea> m_scrollableArea; |
108 ScrollableArea* m_scrollableArea; | |
109 float m_currentPosX; // We avoid using a FloatPoint in order to reduce | 112 float m_currentPosX; // We avoid using a FloatPoint in order to reduce |
110 float m_currentPosY; // subclass code complexity. | 113 float m_currentPosY; // subclass code complexity. |
111 | 114 |
112 private: | 115 private: |
113 float clampScrollPosition(ScrollbarOrientation, float); | 116 float clampScrollPosition(ScrollbarOrientation, float); |
114 }; | 117 }; |
115 | 118 |
116 } // namespace blink | 119 } // namespace blink |
117 | 120 |
118 #endif // ScrollAnimatorBase_h | 121 #endif // ScrollAnimatorBase_h |
OLD | NEW |