no bug - Import translations from android-l10n r=release a=l10n CLOSED TREE
[gecko.git] / layout / base / ScrollTypes.h
blob512c2579bce92deb4109a79c76d025692bac7d1d
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_ScrollTypes_h
6 #define mozilla_ScrollTypes_h
8 #include "mozilla/TypedEnumBits.h"
10 // Types used in main-thread scrolling interfaces such as nsIScrollableFrame.
12 namespace mozilla {
14 /**
15 * Scroll modes for main-thread scroll operations. These are mostly used
16 * by nsIScrollableFrame methods.
18 * When a scroll operation is requested, we ask for instant, smooth,
19 * smooth msd, or normal scrolling.
21 * |Smooth| scrolls have a symmetrical acceleration and deceleration curve
22 * modeled with a set of splines that guarantee that the destination will be
23 * reached over a fixed time interval. |Smooth| will only be smooth if smooth
24 * scrolling is actually enabled. This behavior is utilized by keyboard and
25 * mouse wheel scrolling events.
27 * |SmoothMsd| implements a physically based model that approximates the
28 * behavior of a mass-spring-damper system. |SmoothMsd| scrolls have a
29 * non-symmetrical acceleration and deceleration curve, can potentially
30 * overshoot the destination on intermediate frames, and complete over a
31 * variable time interval. |SmoothMsd| will only be smooth if cssom-view
32 * smooth-scrolling is enabled.
34 * |Instant| is always synchronous, |Normal| can be asynchronous.
36 * If an |Instant| scroll request happens while a |Smooth| or async scroll is
37 * already in progress, the async scroll is interrupted and we instantly
38 * scroll to the destination.
40 * If an |Instant| or |Smooth| scroll request happens while a |SmoothMsd|
41 * scroll is already in progress, the |SmoothMsd| scroll is interrupted without
42 * first scrolling to the destination.
44 enum class ScrollMode { Instant, Smooth, SmoothMsd, Normal };
46 /**
47 * When scrolling by a relative amount, we can choose various units.
49 enum class ScrollUnit { DEVICE_PIXELS, LINES, PAGES, WHOLE };
51 /**
52 * Representing whether there's an on-going animation in APZC and it was
53 * triggered by script or by user input.
55 enum class APZScrollAnimationType {
56 No, // No animation.
57 TriggeredByScript, // Animation triggered by script.
58 TriggeredByUserInput // Animation triggered by user input.
61 enum class ScrollSnapFlags : uint8_t {
62 Disabled = 0,
63 // https://drafts.csswg.org/css-scroll-snap/#intended-end-position
64 IntendedEndPosition = 1 << 0,
65 // https://drafts.csswg.org/css-scroll-snap/#intended-direction
66 IntendedDirection = 1 << 1
69 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(ScrollSnapFlags);
71 } // namespace mozilla
73 #endif // mozilla_ScrollTypes_h