/src/mozilla-central/layout/generic/ScrollAnimationPhysics.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef mozilla_layout_ScrollAnimationPhysics_h_ |
8 | | #define mozilla_layout_ScrollAnimationPhysics_h_ |
9 | | |
10 | | #include "mozilla/TimeStamp.h" |
11 | | #include "nsPoint.h" |
12 | | |
13 | | namespace mozilla { |
14 | | |
15 | | class ScrollAnimationPhysics |
16 | | { |
17 | | public: |
18 | | virtual void Update(const TimeStamp& aTime, |
19 | | const nsPoint& aDestination, |
20 | | const nsSize& aCurrentVelocity) = 0; |
21 | | |
22 | | // Get the velocity at a point in time in nscoords/sec. |
23 | | virtual nsSize VelocityAt(const TimeStamp& aTime) = 0; |
24 | | |
25 | | // Returns the expected scroll position at a given point in time, in app |
26 | | // units, relative to the scroll frame. |
27 | | virtual nsPoint PositionAt(const TimeStamp& aTime) = 0; |
28 | | |
29 | | virtual bool IsFinished(const TimeStamp& aTime) = 0; |
30 | | |
31 | 0 | virtual ~ScrollAnimationPhysics() {} |
32 | | }; |
33 | | |
34 | | // Helper for accelerated wheel deltas. This can be called from the main thread |
35 | | // or the APZ Controller thread. |
36 | | static inline double |
37 | | ComputeAcceleratedWheelDelta(double aDelta, int32_t aCounter, int32_t aFactor) |
38 | 0 | { |
39 | 0 | if (!aDelta) { |
40 | 0 | return aDelta; |
41 | 0 | } |
42 | 0 | return (aDelta * aCounter * double(aFactor) / 10); |
43 | 0 | } Unexecuted instantiation: Unified_cpp_gfx_layers2.cpp:mozilla::ComputeAcceleratedWheelDelta(double, int, int) Unexecuted instantiation: Unified_cpp_gfx_layers3.cpp:mozilla::ComputeAcceleratedWheelDelta(double, int, int) Unexecuted instantiation: Unified_cpp_dom_events2.cpp:mozilla::ComputeAcceleratedWheelDelta(double, int, int) Unexecuted instantiation: Unified_cpp_layout_generic0.cpp:mozilla::ComputeAcceleratedWheelDelta(double, int, int) Unexecuted instantiation: Unified_cpp_layout_generic2.cpp:mozilla::ComputeAcceleratedWheelDelta(double, int, int) |
44 | | |
45 | | static const uint32_t kScrollSeriesTimeoutMs = 80; // in milliseconds |
46 | | |
47 | | } // namespace mozilla |
48 | | |
49 | | #endif // mozilla_layout_ScrollAnimationPhysics_h_ |