| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011, Google Inc. All rights reserved. | 2 * Copyright (c) 2011, 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef ScrollAnimatorNone_h | 31 #ifndef ScrollAnimatorNone_h |
| 32 #define ScrollAnimatorNone_h | 32 #define ScrollAnimatorNone_h |
| 33 | 33 |
| 34 #include "core/platform/ScrollAnimator.h" | |
| 35 #include "platform/Timer.h" | 34 #include "platform/Timer.h" |
| 36 #include "platform/geometry/FloatPoint.h" | 35 #include "platform/geometry/FloatPoint.h" |
| 37 #include "wtf/OwnPtr.h" | 36 #include "platform/scroll/ScrollAnimator.h" |
| 38 | 37 |
| 39 class ScrollAnimatorNoneTest; | 38 class ScrollAnimatorNoneTest; |
| 40 | 39 |
| 41 namespace WebCore { | 40 namespace WebCore { |
| 42 | 41 |
| 43 class IntPoint; | 42 class IntPoint; |
| 44 class ActivePlatformGestureAnimation; | 43 class ActivePlatformGestureAnimation; |
| 45 struct ScrollAnimatorParameters; | 44 struct ScrollAnimatorParameters; |
| 46 | 45 |
| 47 class ScrollAnimatorNone : public ScrollAnimator { | 46 class PLATFORM_EXPORT ScrollAnimatorNone : public ScrollAnimator { |
| 48 public: | 47 public: |
| 49 explicit ScrollAnimatorNone(ScrollableArea*); | 48 explicit ScrollAnimatorNone(ScrollableArea*); |
| 50 virtual ~ScrollAnimatorNone(); | 49 virtual ~ScrollAnimatorNone(); |
| 51 | 50 |
| 52 virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, flo
at multiplier); | 51 virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, flo
at multiplier); |
| 53 virtual void scrollToOffsetWithoutAnimation(const FloatPoint&); | 52 virtual void scrollToOffsetWithoutAnimation(const FloatPoint&); |
| 54 | 53 |
| 55 virtual void cancelAnimations(); | 54 virtual void cancelAnimations(); |
| 56 virtual void serviceScrollAnimations(); | 55 virtual void serviceScrollAnimations(); |
| 57 | 56 |
| 58 virtual void willEndLiveResize(); | 57 virtual void willEndLiveResize(); |
| 59 virtual void didAddVerticalScrollbar(Scrollbar*); | 58 virtual void didAddVerticalScrollbar(Scrollbar*); |
| 60 virtual void didAddHorizontalScrollbar(Scrollbar*); | 59 virtual void didAddHorizontalScrollbar(Scrollbar*); |
| 61 | 60 |
| 62 enum Curve { | 61 enum Curve { |
| 63 Linear, | 62 Linear, |
| 64 Quadratic, | 63 Quadratic, |
| 65 Cubic, | 64 Cubic, |
| 66 Quartic, | 65 Quartic, |
| 67 Bounce | 66 Bounce |
| 68 }; | 67 }; |
| 69 | 68 |
| 70 struct Parameters { | 69 struct PLATFORM_EXPORT Parameters { |
| 71 Parameters(); | 70 Parameters(); |
| 72 Parameters(bool isEnabled, double animationTime, double repeatMinimumSus
tainTime, Curve attackCurve, double attackTime, Curve releaseCurve, double relea
seTime, Curve coastTimeCurve, double maximumCoastTime); | 71 Parameters(bool isEnabled, double animationTime, double repeatMinimumSus
tainTime, Curve attackCurve, double attackTime, Curve releaseCurve, double relea
seTime, Curve coastTimeCurve, double maximumCoastTime); |
| 73 | 72 |
| 74 // Note that the times can be overspecified such that releaseTime or rel
easeTime and attackTime are greater | 73 // Note that the times can be overspecified such that releaseTime or rel
easeTime and attackTime are greater |
| 75 // than animationTime. animationTime takes priority over releaseTime, ca
pping it. attackTime is capped at | 74 // than animationTime. animationTime takes priority over releaseTime, ca
pping it. attackTime is capped at |
| 76 // whatever time remains, or zero if none. | 75 // whatever time remains, or zero if none. |
| 77 bool m_isEnabled; | 76 bool m_isEnabled; |
| 78 double m_animationTime; | 77 double m_animationTime; |
| 79 double m_repeatMinimumSustainTime; | 78 double m_repeatMinimumSustainTime; |
| 80 | 79 |
| 81 Curve m_attackCurve; | 80 Curve m_attackCurve; |
| 82 double m_attackTime; | 81 double m_attackTime; |
| 83 | 82 |
| 84 Curve m_releaseCurve; | 83 Curve m_releaseCurve; |
| 85 double m_releaseTime; | 84 double m_releaseTime; |
| 86 | 85 |
| 87 Curve m_coastTimeCurve; | 86 Curve m_coastTimeCurve; |
| 88 double m_maximumCoastTime; | 87 double m_maximumCoastTime; |
| 89 }; | 88 }; |
| 90 | 89 |
| 91 protected: | 90 protected: |
| 92 virtual void animationWillStart() { } | 91 virtual void animationWillStart() { } |
| 93 virtual void animationDidFinish() { } | 92 virtual void animationDidFinish() { } |
| 94 | 93 |
| 95 Parameters parametersForScrollGranularity(ScrollGranularity) const; | 94 Parameters parametersForScrollGranularity(ScrollGranularity) const; |
| 96 | 95 |
| 97 friend class ::ScrollAnimatorNoneTest; | 96 friend class ::ScrollAnimatorNoneTest; |
| 98 | 97 |
| 99 struct PerAxisData { | 98 struct PLATFORM_EXPORT PerAxisData { |
| 100 PerAxisData(ScrollAnimatorNone* parent, float* currentPos, int visibleLe
ngth); | 99 PerAxisData(ScrollAnimatorNone* parent, float* currentPos, int visibleLe
ngth); |
| 101 void reset(); | 100 void reset(); |
| 102 bool updateDataFromParameters(float step, float multiplier, float scroll
ableSize, double currentTime, Parameters*); | 101 bool updateDataFromParameters(float step, float multiplier, float scroll
ableSize, double currentTime, Parameters*); |
| 103 bool animateScroll(double currentTime); | 102 bool animateScroll(double currentTime); |
| 104 void updateVisibleLength(int visibleLength); | 103 void updateVisibleLength(int visibleLength); |
| 105 | 104 |
| 106 static double curveAt(Curve, double t); | 105 static double curveAt(Curve, double t); |
| 107 static double attackCurve(Curve, double deltaT, double curveT, double st
artPos, double attackPos); | 106 static double attackCurve(Curve, double deltaT, double curveT, double st
artPos, double attackPos); |
| 108 static double releaseCurve(Curve, double deltaT, double curveT, double r
eleasePos, double desiredPos); | 107 static double releaseCurve(Curve, double deltaT, double curveT, double r
eleasePos, double desiredPos); |
| 109 static double coastCurve(Curve, double factor); | 108 static double coastCurve(Curve, double factor); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 PerAxisData m_horizontalData; | 145 PerAxisData m_horizontalData; |
| 147 PerAxisData m_verticalData; | 146 PerAxisData m_verticalData; |
| 148 | 147 |
| 149 double m_startTime; | 148 double m_startTime; |
| 150 bool m_animationActive; | 149 bool m_animationActive; |
| 151 }; | 150 }; |
| 152 | 151 |
| 153 } // namespace WebCore | 152 } // namespace WebCore |
| 154 | 153 |
| 155 #endif // ScrollAnimatorNone_h | 154 #endif // ScrollAnimatorNone_h |
| OLD | NEW |