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