Source code

Revision control

Other Tools

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_layers_GenericScrollAnimation_h_
8
#define mozilla_layers_GenericScrollAnimation_h_
9
10
#include "AsyncPanZoomAnimation.h"
11
12
namespace mozilla {
13
14
struct ScrollAnimationBezierPhysicsSettings;
15
class ScrollAnimationPhysics;
16
17
namespace layers {
18
19
class AsyncPanZoomController;
20
21
class GenericScrollAnimation : public AsyncPanZoomAnimation {
22
public:
23
GenericScrollAnimation(AsyncPanZoomController& aApzc,
24
const nsPoint& aInitialPosition,
25
const ScrollAnimationBezierPhysicsSettings& aSettings);
26
27
bool DoSample(FrameMetrics& aFrameMetrics,
28
const TimeDuration& aDelta) override;
29
30
bool HandleScrollOffsetUpdate(const Maybe<CSSPoint>& aRelativeDelta) override;
31
32
void UpdateDelta(TimeStamp aTime, const nsPoint& aDelta,
33
const nsSize& aCurrentVelocity);
34
void UpdateDestination(TimeStamp aTime, const nsPoint& aDestination,
35
const nsSize& aCurrentVelocity);
36
37
CSSPoint GetDestination() const {
38
return CSSPoint::FromAppUnits(mFinalDestination);
39
}
40
41
private:
42
void Update(TimeStamp aTime, const nsSize& aCurrentVelocity);
43
44
protected:
45
AsyncPanZoomController& mApzc;
46
UniquePtr<ScrollAnimationPhysics> mAnimationPhysics;
47
nsPoint mFinalDestination;
48
// If a direction is forced to overscroll, it means it's axis in that
49
// direction is locked, and scroll in that direction is treated as overscroll
50
// of an equal amount, which, for example, may then bubble up a scroll action
51
// to its parent, or may behave as whatever an overscroll occurence requires
52
// to behave
53
Maybe<ScrollDirection> mDirectionForcedToOverscroll;
54
};
55
56
} // namespace layers
57
} // namespace mozilla
58
59
#endif // mozilla_layers_GenericScrollAnimation_h_