mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 06:09:19 +00:00
Bug 1931447 - Use MOZ_DEFINE_ENUM_CLASS_WITH_BASE_AND_TOSTRING for some scroll related enums. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D229065
This commit is contained in:
parent
7505e73ed0
commit
713419caca
@ -5,6 +5,7 @@
|
|||||||
#ifndef mozilla_ScrollTypes_h
|
#ifndef mozilla_ScrollTypes_h
|
||||||
#define mozilla_ScrollTypes_h
|
#define mozilla_ScrollTypes_h
|
||||||
|
|
||||||
|
#include "mozilla/DefineEnum.h"
|
||||||
#include "mozilla/TypedEnumBits.h"
|
#include "mozilla/TypedEnumBits.h"
|
||||||
|
|
||||||
// Types used in main-thread scrolling interfaces such as ScrollContainerFrame.
|
// Types used in main-thread scrolling interfaces such as ScrollContainerFrame.
|
||||||
@ -41,7 +42,9 @@ namespace mozilla {
|
|||||||
* scroll is already in progress, the |SmoothMsd| scroll is interrupted without
|
* scroll is already in progress, the |SmoothMsd| scroll is interrupted without
|
||||||
* first scrolling to the destination.
|
* first scrolling to the destination.
|
||||||
*/
|
*/
|
||||||
enum class ScrollMode { Instant, Smooth, SmoothMsd, Normal };
|
MOZ_DEFINE_ENUM_CLASS_WITH_BASE_AND_TOSTRING(ScrollMode, uint8_t,
|
||||||
|
(Instant, Smooth, SmoothMsd,
|
||||||
|
Normal));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When scrolling by a relative amount, we can choose various units.
|
* When scrolling by a relative amount, we can choose various units.
|
||||||
|
@ -5,61 +5,65 @@
|
|||||||
#ifndef mozilla_ScrollOrigin_h_
|
#ifndef mozilla_ScrollOrigin_h_
|
||||||
#define mozilla_ScrollOrigin_h_
|
#define mozilla_ScrollOrigin_h_
|
||||||
|
|
||||||
|
#include "mozilla/DefineEnum.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
// A scroll origin is a bit of a combination of "what part of the code caused
|
// A scroll origin is a bit of a combination of "what part of the code caused
|
||||||
// this scroll" and "what special properties does this scroll have, in the
|
// this scroll" and "what special properties does this scroll have, in the
|
||||||
// context of what caused it". See specific comments below.
|
// context of what caused it". See specific comments below.
|
||||||
enum class ScrollOrigin : uint8_t {
|
MOZ_DEFINE_ENUM_CLASS_WITH_BASE_AND_TOSTRING(
|
||||||
// This is used as an initial value for the "LastScrollOrigin" property on
|
ScrollOrigin, uint8_t,
|
||||||
// scrollable frames. It is not intended to be an actual scroll origin, but
|
(
|
||||||
// a sentinel value that indicates that there was no "last scroll". It is
|
// This is used as an initial value for the "LastScrollOrigin" property
|
||||||
// used similarly for the "LastSmoothScrollOrigin" property, to indicate
|
// on scrollable frames. It is not intended to be an actual scroll
|
||||||
// no smooth scroll is in progress.
|
// origin, but a sentinel value that indicates that there was no "last
|
||||||
|
// scroll". It is used similarly for the "LastSmoothScrollOrigin"
|
||||||
|
// property, to indicate no smooth scroll is in progress.
|
||||||
None,
|
None,
|
||||||
|
|
||||||
// This is a default value that we use when we don't know of a more specific
|
// This is a default value that we use when we don't know of a more
|
||||||
// value that we can use.
|
// specific value that we can use.
|
||||||
NotSpecified,
|
NotSpecified,
|
||||||
// The scroll came from APZ code.
|
// The scroll came from APZ code.
|
||||||
Apz,
|
Apz,
|
||||||
// The scroll came from an attempt at restoring a scroll position saved in
|
// The scroll came from an attempt at restoring a scroll position saved
|
||||||
// the bfcache or history.
|
// in the bfcache or history.
|
||||||
Restore,
|
Restore,
|
||||||
// The scroll came from a "relative" scroll method like ScrollBy, where the
|
// The scroll came from a "relative" scroll method like ScrollBy, where
|
||||||
// scroll destination is indicated by a delta from the current position
|
// the scroll destination is indicated by a delta from the current
|
||||||
// instead of an absolute value.
|
// position instead of an absolute value.
|
||||||
Relative,
|
Relative,
|
||||||
// The scroll came from an attempt by the main thread to re-clamp the scroll
|
// The scroll came from an attempt by the main thread to re-clamp the
|
||||||
// position after a reflow.
|
// scroll position after a reflow.
|
||||||
Clamp,
|
Clamp,
|
||||||
|
|
||||||
// The following scroll origins also are associated with prefs of the form
|
// The following scroll origins also are associated with prefs of the
|
||||||
|
// form
|
||||||
// general.smoothScroll.<origin>(.*)
|
// general.smoothScroll.<origin>(.*)
|
||||||
// e.g. general.smoothScroll.lines indicates whether or not a scroll with
|
// e.g. general.smoothScroll.lines indicates whether or not a scroll
|
||||||
// origin Lines will be animated smoothly, and e.g. subprefs like
|
// with origin Lines will be animated smoothly, and e.g. subprefs like
|
||||||
// general.smoothScroll.lines.durationMinMS control some of the animation
|
// general.smoothScroll.lines.durationMinMS control some of the
|
||||||
// timing behavior.
|
// animation timing behavior.
|
||||||
|
|
||||||
// The scroll came from some sort of input that's not one of the above or
|
// The scroll came from some sort of input that's not one of the above
|
||||||
// below values. Generally this means it came from a content-exposed API,
|
// or below values. Generally this means it came from a content-exposed
|
||||||
// like window.scrollTo, but may also be from other sources that don't need
|
// API, like window.scrollTo, but may also be from other sources that
|
||||||
// any particular special handling.
|
// don't need any particular special handling.
|
||||||
Other,
|
Other,
|
||||||
// The scroll was originated by pixel-scrolling input device (e.g. precision
|
// The scroll was originated by pixel-scrolling input device (e.g.
|
||||||
// mouse wheel).
|
// precision mouse wheel).
|
||||||
Pixels,
|
Pixels,
|
||||||
// The scroll was originated by a line-scrolling input device (e.g. up/down
|
// The scroll was originated by a line-scrolling input device (e.g.
|
||||||
// keyboard buttons).
|
// up/down keyboard buttons).
|
||||||
Lines,
|
Lines,
|
||||||
// The scroll was originated by a page-scrolling input device (e.g. pgup/
|
// The scroll was originated by a page-scrolling input device (e.g.
|
||||||
// pgdn keyboard buttons).
|
// pgup/ pgdn keyboard buttons).
|
||||||
Pages,
|
Pages,
|
||||||
// The scroll was originated by a mousewheel that scrolls by lines.
|
// The scroll was originated by a mousewheel that scrolls by lines.
|
||||||
MouseWheel,
|
MouseWheel,
|
||||||
// The scroll was originated by moving the scrollbars.
|
// The scroll was originated by moving the scrollbars.
|
||||||
Scrollbars,
|
Scrollbars));
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
|
@ -128,10 +128,9 @@ CSSPoint ScrollPositionUpdate::GetDelta() const {
|
|||||||
|
|
||||||
std::ostream& operator<<(std::ostream& aStream,
|
std::ostream& operator<<(std::ostream& aStream,
|
||||||
const ScrollPositionUpdate& aUpdate) {
|
const ScrollPositionUpdate& aUpdate) {
|
||||||
aStream << "{ gen=" << aUpdate.mScrollGeneration
|
aStream << "{ gen=" << aUpdate.mScrollGeneration << ", type=" << aUpdate.mType
|
||||||
<< ", type=" << (int)aUpdate.mType
|
<< ", mode=" << aUpdate.mScrollMode
|
||||||
<< ", mode=" << (int)aUpdate.mScrollMode
|
<< ", origin=" << aUpdate.mScrollOrigin
|
||||||
<< ", origin=" << (int)aUpdate.mScrollOrigin
|
|
||||||
<< ", dst=" << aUpdate.mDestination << ", src=" << aUpdate.mSource
|
<< ", dst=" << aUpdate.mDestination << ", src=" << aUpdate.mSource
|
||||||
<< ", delta=" << aUpdate.mDelta
|
<< ", delta=" << aUpdate.mDelta
|
||||||
<< ", triggered by script=" << aUpdate.WasTriggeredByScript() << " }";
|
<< ", triggered by script=" << aUpdate.WasTriggeredByScript() << " }";
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
|
|
||||||
#include "nsPoint.h"
|
#include "nsPoint.h"
|
||||||
|
#include "mozilla/DefineEnum.h"
|
||||||
#include "mozilla/ScrollGeneration.h"
|
#include "mozilla/ScrollGeneration.h"
|
||||||
#include "mozilla/ScrollOrigin.h"
|
#include "mozilla/ScrollOrigin.h"
|
||||||
#include "mozilla/ScrollSnapTargetId.h"
|
#include "mozilla/ScrollSnapTargetId.h"
|
||||||
@ -22,19 +23,20 @@ struct ParamTraits;
|
|||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
enum class ScrollUpdateType {
|
MOZ_DEFINE_ENUM_CLASS_WITH_BASE_AND_TOSTRING(
|
||||||
|
ScrollUpdateType, uint8_t,
|
||||||
|
(
|
||||||
// A scroll update to a specific destination, regardless of the current
|
// A scroll update to a specific destination, regardless of the current
|
||||||
// scroll position.
|
// scroll position.
|
||||||
Absolute,
|
Absolute,
|
||||||
// A scroll update by a specific amount, based off a given starting scroll
|
// A scroll update by a specific amount, based off a given starting
|
||||||
// position. XXX Fold this into PureRelative, it should be relatively
|
// scroll position. XXX Fold this into PureRelative, it should be
|
||||||
// straightforward after bug 1655733.
|
// relatively straightforward after bug 1655733.
|
||||||
Relative,
|
Relative,
|
||||||
// A scroll update by a specific amount, where only the delta is provided.
|
// A scroll update by a specific amount, where only the delta is
|
||||||
// The delta should be applied to whatever the current scroll position is
|
// provided. The delta should be applied to whatever the current scroll
|
||||||
// on the receiver side.
|
// position is on the receiver side.
|
||||||
PureRelative,
|
PureRelative));
|
||||||
};
|
|
||||||
|
|
||||||
enum class ScrollTriggeredByScript : bool { No, Yes };
|
enum class ScrollTriggeredByScript : bool { No, Yes };
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user