Bug 1377020 - Use MOZ_DEFINE_ENUM instead of a sentinel enumerator for enumerations in gfx/layers. r=kats

MozReview-Commit-ID: IUQDb0VIAwQ

--HG--
extra : rebase_source : 50d05ab09a5fb03d16c044edd38f0f3e0dba7ada
This commit is contained in:
Botond Ballo 2017-06-30 21:18:55 -04:00
Родитель 12b5fbce7d
Коммит 8b7ba8ac1c
24 изменённых файлов: 227 добавлений и 353 удалений

Просмотреть файл

@ -1369,11 +1369,6 @@ TabChild::RecvHandleTap(const GeckoContentController::TapType& aType,
mAPZEventState->ProcessLongTapUp(presShell, point, scale, aModifiers);
}
break;
case GeckoContentController::TapType::eSentinel:
// Should never happen, but we need to handle this case to make the compiler
// happy.
MOZ_ASSERT(false);
break;
}
return IPC_OK();
}

Просмотреть файл

@ -8,6 +8,7 @@
#include <stdint.h> // for uint32_t, uint64_t
#include "Units.h" // for CSSRect, CSSPixel, etc
#include "mozilla/DefineEnum.h" // for MOZ_DEFINE_ENUM
#include "mozilla/HashFunctions.h" // for HashGeneric
#include "mozilla/Maybe.h"
#include "mozilla/gfx/BasePoint.h" // for BasePoint
@ -50,23 +51,22 @@ public:
static const ViewID START_SCROLL_ID = 2; // This is the ID that scrolling subframes
// will begin at.
enum ScrollOffsetUpdateType : uint8_t {
eNone, // The default; the scroll offset was not updated
eMainThread, // The scroll offset was updated by the main thread.
ePending, // The scroll offset was updated on the main thread, but not
// painted, so the layer texture data is still at the old
// offset.
eUserAction, // In an APZ repaint request, this means the APZ generated
// the scroll position based on user action (the alternative
// is eNone which means it's just request a repaint because
// it got a scroll update from the main thread).
eRestore, // The scroll offset was updated by the main thread, but as
// a restore from history or after a frame reconstruction.
// In this case, APZ can ignore the offset change if the
// user has done an APZ scroll already.
eSentinel // For IPC use only
};
MOZ_DEFINE_ENUM_WITH_BASE_AT_CLASS_SCOPE(
ScrollOffsetUpdateType, uint8_t, (
eNone, // The default; the scroll offset was not updated
eMainThread, // The scroll offset was updated by the main thread.
ePending, // The scroll offset was updated on the main thread, but not
// painted, so the layer texture data is still at the old
// offset.
eUserAction, // In an APZ repaint request, this means the APZ generated
// the scroll position based on user action (the alternative
// is eNone which means it's just request a repaint because
// it got a scroll update from the main thread).
eRestore // The scroll offset was updated by the main thread, but as
// a restore from history or after a frame reconstruction.
// In this case, APZ can ignore the offset change if the
// user has done an APZ scroll already.
));
FrameMetrics()
: mScrollId(NULL_SCROLL_ID)

Просмотреть файл

@ -9,6 +9,7 @@
#include <stdint.h> // for uint32_t
#include "Units.h"
#include "mozilla/DefineEnum.h" // for MOZ_DEFINE_ENUM
#include "mozilla/gfx/Point.h" // for IntPoint
#include "mozilla/Maybe.h"
#include "mozilla/TypedEnumBits.h"
@ -72,12 +73,12 @@ enum class SurfaceMode : int8_t {
SURFACE_COMPONENT_ALPHA
};
enum class ScaleMode : int8_t {
SCALE_NONE,
STRETCH,
SENTINEL
MOZ_DEFINE_ENUM_CLASS_WITH_BASE(
ScaleMode, int8_t, (
SCALE_NONE,
STRETCH
// Unimplemented - PRESERVE_ASPECT_RATIO_CONTAIN
};
));
struct EventRegions {
// The hit region for a layer contains all areas on the layer that are
@ -304,12 +305,11 @@ private:
uint64_t mHandle;
};
enum class ScrollDirection : uint32_t {
MOZ_DEFINE_ENUM_CLASS_WITH_BASE(ScrollDirection, uint32_t, (
NONE,
VERTICAL,
HORIZONTAL,
SENTINEL /* for IPC serialization */
};
HORIZONTAL
));
enum class CSSFilterType : int8_t {
BLUR,

Просмотреть файл

@ -11,6 +11,7 @@
#include "InputData.h" // for PinchGestureInput
#include "Units.h" // for CSSPoint, CSSRect, etc
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
#include "mozilla/DefineEnum.h" // for MOZ_DEFINE_ENUM
#include "mozilla/EventForwards.h" // for Modifiers
#include "nsISupportsImpl.h"
@ -49,15 +50,14 @@ public:
* a click event with detail=2 to web content (similar to what a mouse double-
* click would do).
*/
enum class TapType {
eSingleTap,
eDoubleTap,
eSecondTap,
eLongTap,
eLongTapUp,
eSentinel,
};
MOZ_DEFINE_ENUM_CLASS_AT_CLASS_SCOPE(
TapType, (
eSingleTap,
eDoubleTap,
eSecondTap,
eLongTap,
eLongTapUp
));
/**
* Requests handling of a tap event. |aPoint| is in LD pixels, relative to the
@ -107,34 +107,32 @@ public:
*/
virtual void DispatchToRepaintThread(already_AddRefed<Runnable> aTask) = 0;
enum class APZStateChange {
/**
* APZ started modifying the view (including panning, zooming, and fling).
*/
eTransformBegin,
/**
* APZ finished modifying the view.
*/
eTransformEnd,
/**
* APZ started a touch.
* |aArg| is 1 if touch can be a pan, 0 otherwise.
*/
eStartTouch,
/**
* APZ started a pan.
*/
eStartPanning,
/**
* APZ finished processing a touch.
* |aArg| is 1 if touch was a click, 0 otherwise.
*/
eEndTouch,
MOZ_DEFINE_ENUM_CLASS_AT_CLASS_SCOPE(
APZStateChange, (
/**
* APZ started modifying the view (including panning, zooming, and fling).
*/
eTransformBegin,
/**
* APZ finished modifying the view.
*/
eTransformEnd,
/**
* APZ started a touch.
* |aArg| is 1 if touch can be a pan, 0 otherwise.
*/
eStartTouch,
/**
* APZ started a pan.
*/
eStartPanning,
/**
* APZ finished processing a touch.
* |aArg| is 1 if touch was a click, 0 otherwise.
*/
eEndTouch
));
// Sentinel value for IPC, this must be the last item in the enum and
// should not be used as an actual message value.
eSentinel
};
/**
* General notices of APZ state changes for consumers.
* |aGuid| identifies the APZC originating the state change.

Просмотреть файл

@ -1305,10 +1305,6 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
targetGuid = mFocusState.GetVerticalTarget();
break;
}
case KeyboardScrollAction::eSentinel: {
MOZ_ASSERT_UNREACHABLE("Invalid KeyboardScrollActionType");
}
}
// If we don't have a scroll target then either we have a stale focus target,
@ -1347,9 +1343,6 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
keyInput.mHandledByAPZ = true;
focusSetter.MarkAsNonFocusChanging();
break;
} case SENTINEL_INPUT: {
MOZ_ASSERT_UNREACHABLE("Invalid InputType.");
break;
}
}

Просмотреть файл

@ -131,8 +131,6 @@ AndroidDynamicToolbarAnimator::ReceiveInputEvent(InputData& aEvent, const Screen
case MultiTouchInput::MULTITOUCH_CANCEL:
mControllerTouchCount -= multiTouch.mTouches.Length();
break;
case MultiTouchInput::MULTITOUCH_SENTINEL:
MOZ_FALLTHROUGH_ASSERT("Invalid value");
case MultiTouchInput::MULTITOUCH_MOVE:
break;
}
@ -203,9 +201,6 @@ AndroidDynamicToolbarAnimator::ReceiveInputEvent(InputData& aEvent, const Screen
HandleTouchEnd(currentToolbarState, currentTouch);
}
break;
case MultiTouchInput::MULTITOUCH_SENTINEL:
MOZ_ASSERT_UNREACHABLE("Invalid value");
break;
}
TranslateTouchEvent(multiTouch);

Просмотреть файл

@ -949,7 +949,6 @@ nsEventStatus AsyncPanZoomController::HandleInputEvent(const InputData& aEvent,
case MultiTouchInput::MULTITOUCH_MOVE: rv = OnTouchMove(multiTouchInput); break;
case MultiTouchInput::MULTITOUCH_END: rv = OnTouchEnd(multiTouchInput); break;
case MultiTouchInput::MULTITOUCH_CANCEL: rv = OnTouchCancel(multiTouchInput); break;
case MultiTouchInput::MULTITOUCH_SENTINEL: MOZ_ASSERT_UNREACHABLE("Invalid value"); break;
}
break;
}
@ -968,7 +967,6 @@ nsEventStatus AsyncPanZoomController::HandleInputEvent(const InputData& aEvent,
case PanGestureInput::PANGESTURE_MOMENTUMSTART: rv = OnPanMomentumStart(panGestureInput); break;
case PanGestureInput::PANGESTURE_MOMENTUMPAN: rv = OnPan(panGestureInput, false); break;
case PanGestureInput::PANGESTURE_MOMENTUMEND: rv = OnPanMomentumEnd(panGestureInput); break;
case PanGestureInput::PANGESTURE_SENTINEL: MOZ_ASSERT_UNREACHABLE("Invalid value"); break;
}
break;
}
@ -1011,10 +1009,6 @@ nsEventStatus AsyncPanZoomController::HandleInputEvent(const InputData& aEvent,
rv = OnKeyboard(keyInput);
break;
}
case SENTINEL_INPUT: {
MOZ_ASSERT_UNREACHABLE("Invalid value");
break;
}
}
return rv;
@ -1033,7 +1027,6 @@ nsEventStatus AsyncPanZoomController::HandleGestureEvent(const InputData& aEvent
case PinchGestureInput::PINCHGESTURE_START: rv = OnScaleBegin(pinchGestureInput); break;
case PinchGestureInput::PINCHGESTURE_SCALE: rv = OnScale(pinchGestureInput); break;
case PinchGestureInput::PINCHGESTURE_END: rv = OnScaleEnd(pinchGestureInput); break;
case PinchGestureInput::PINCHGESTURE_SENTINEL: MOZ_ASSERT_UNREACHABLE("Invalid value"); break;
}
break;
}
@ -1047,7 +1040,6 @@ nsEventStatus AsyncPanZoomController::HandleGestureEvent(const InputData& aEvent
case TapGestureInput::TAPGESTURE_DOUBLE: rv = OnDoubleTap(tapGestureInput); break;
case TapGestureInput::TAPGESTURE_SECOND: rv = OnSecondTap(tapGestureInput); break;
case TapGestureInput::TAPGESTURE_CANCEL: rv = OnCancelTap(tapGestureInput); break;
case TapGestureInput::TAPGESTURE_SENTINEL: MOZ_ASSERT_UNREACHABLE("Invalid value"); break;
}
break;
}
@ -1610,10 +1602,6 @@ AsyncPanZoomController::GetScrollWheelDelta(const ScrollWheelInput& aEvent) cons
delta = ToParentLayerCoordinates(ScreenPoint(aEvent.mDeltaX, aEvent.mDeltaY), aEvent.mOrigin);
break;
}
case ScrollWheelInput::SCROLLDELTA_SENTINEL: {
MOZ_ASSERT_UNREACHABLE("Invalid value");
break;
}
}
// Apply user-set multipliers.
@ -1687,10 +1675,6 @@ void ReportKeyboardScrollAction(const KeyboardScrollAction& aAction)
scrollMethod = ScrollInputMethod::ApzCompleteScroll;
break;
}
case KeyboardScrollAction::eSentinel: {
MOZ_ASSERT_UNREACHABLE("Invalid KeyboardScrollAction.");
return;
}
}
mozilla::Telemetry::Accumulate(mozilla::Telemetry::SCROLL_INPUT_METHODS,
@ -1816,8 +1800,6 @@ AsyncPanZoomController::GetKeyboardDestination(const KeyboardScrollAction& aActi
}
break;
}
case KeyboardScrollAction::eSentinel:
MOZ_ASSERT_UNREACHABLE("unexpected keyboard delta type");
}
return scrollDestination;
@ -1863,7 +1845,6 @@ AsyncPanZoomController::CanScroll(ScrollDirection aDirection) const
case ScrollDirection::VERTICAL: return mY.CanScroll();
case ScrollDirection::NONE:
case ScrollDirection::SENTINEL:
MOZ_ASSERT_UNREACHABLE("Invalid value");
break;
}
@ -1907,8 +1888,6 @@ ScrollInputMethodForWheelDeltaType(ScrollWheelInput::ScrollDeltaType aDeltaType)
case ScrollWheelInput::SCROLLDELTA_PIXEL: {
return ScrollInputMethod::ApzWheelPixel;
}
case ScrollWheelInput::SCROLLDELTA_SENTINEL:
break;
}
MOZ_ASSERT_UNREACHABLE("Invalid value");
return ScrollInputMethod::ApzWheelLine;
@ -2023,11 +2002,6 @@ nsEventStatus AsyncPanZoomController::OnScrollWheel(const ScrollWheelInput& aEve
animation->UpdateDelta(aEvent.mTimeStamp, deltaInAppUnits, nsSize(velocity.x, velocity.y));
break;
}
case ScrollWheelInput::SCROLLMODE_SENTINEL: {
MOZ_ASSERT_UNREACHABLE("Invalid ScrollMode.");
break;
}
}
return nsEventStatus_eConsumeNoDefault;

Просмотреть файл

@ -159,7 +159,7 @@ CheckerboardEvent::StartEvent()
}
MonitorAutoLock lock(mRendertraceLock);
std::vector<PropertyValue> history;
for (int i = 0; i < MAX_RendertraceProperty; i++) {
for (size_t i = 0; i < sRendertracePropertyCount; i++) {
mBufferedProperties[i].Flush(history, lock);
}
std::sort(history.begin(), history.end());

Просмотреть файл

@ -6,6 +6,7 @@
#ifndef mozilla_layers_CheckerboardEvent_h
#define mozilla_layers_CheckerboardEvent_h
#include "mozilla/DefineEnum.h"
#include "mozilla/Monitor.h"
#include "mozilla/TimeStamp.h"
#include <sstream>
@ -25,19 +26,17 @@ namespace layers {
*/
class CheckerboardEvent {
public:
enum RendertraceProperty {
Page,
PaintedCriticalDisplayPort,
PaintedDisplayPort,
RequestedDisplayPort,
UserVisible,
MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
RendertraceProperty, (
Page,
PaintedCriticalDisplayPort,
PaintedDisplayPort,
RequestedDisplayPort,
UserVisible
));
// sentinel final value
MAX_RendertraceProperty
};
static const char* sDescriptions[MAX_RendertraceProperty];
static const char* sColors[MAX_RendertraceProperty];
static const char* sDescriptions[sRendertracePropertyCount];
static const char* sColors[sRendertracePropertyCount];
public:
explicit CheckerboardEvent(bool aRecordTrace);
@ -207,7 +206,7 @@ private:
* checkerboarding actually starts, so that we have some data on what
* was happening before the checkerboarding started.
*/
PropertyBuffer mBufferedProperties[MAX_RendertraceProperty];
PropertyBuffer mBufferedProperties[sRendertracePropertyCount];
/**
* The rendertrace info buffer that gives us info on what was happening
* during the checkerboard event.

Просмотреть файл

@ -113,9 +113,6 @@ FocusState::Update(uint64_t aRootLayerTreeId,
mLastContentProcessedEvent = target.mSequenceNumber;
return;
}
case FocusTarget::eSentinel: {
MOZ_ASSERT_UNREACHABLE("Invalid FocusTargetType");
}
}
}
}

Просмотреть файл

@ -8,7 +8,8 @@
#include <stdint.h> // for int32_t, uint32_t
#include "FrameMetrics.h" // for FrameMetrics::ViewID
#include "FrameMetrics.h" // for FrameMetrics::ViewID
#include "mozilla/DefineEnum.h" // for MOZ_DEFINE_ENUM
class nsIPresShell;
@ -30,15 +31,13 @@ public:
FrameMetrics::ViewID mVertical;
};
enum FocusTargetType
{
eNone,
eRefLayer,
eScrollLayer,
MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
FocusTargetType, (
eNone,
eRefLayer,
eScrollLayer
));
// Used as an upper bound for ContiguousEnumSerializer
eSentinel,
};
union FocusTargetData
{
uint64_t mRefLayerId;

Просмотреть файл

@ -146,9 +146,6 @@ nsEventStatus GestureEventListener::HandleInputEvent(const MultiTouchInput& aEve
mTouches.Clear();
rv = HandleInputTouchCancel();
break;
case MultiTouchInput::MULTITOUCH_SENTINEL:
MOZ_ASSERT_UNREACHABLE("Invalid MultTouchInput.");
break;
}
return rv;

Просмотреть файл

@ -20,9 +20,6 @@ KeyboardScrollAction::GetScrollUnit(KeyboardScrollAction::KeyboardScrollActionTy
return nsIScrollableFrame::PAGES;
case KeyboardScrollAction::eScrollComplete:
return nsIScrollableFrame::WHOLE;
case KeyboardScrollAction::eSentinel:
MOZ_ASSERT_UNREACHABLE("Invalid KeyboardScrollActionType.");
return nsIScrollableFrame::WHOLE;
}
// Silence an overzealous warning

Просмотреть файл

@ -6,6 +6,7 @@
#ifndef mozilla_layers_KeyboardScrollAction_h
#define mozilla_layers_KeyboardScrollAction_h
#include "mozilla/DefineEnum.h" // for MOZ_DEFINE_ENUM
#include "nsIScrollableFrame.h" // for nsIScrollableFrame::ScrollUnit
namespace mozilla {
@ -17,16 +18,13 @@ namespace layers {
struct KeyboardScrollAction final
{
public:
enum KeyboardScrollActionType : uint8_t
{
eScrollCharacter,
eScrollLine,
eScrollPage,
eScrollComplete,
// Used as an upper bound for ContiguousEnumSerializer
eSentinel,
};
MOZ_DEFINE_ENUM_WITH_BASE_AT_CLASS_SCOPE(
KeyboardScrollActionType, uint8_t, (
eScrollCharacter,
eScrollLine,
eScrollPage,
eScrollComplete
));
static nsIScrollableFrame::ScrollUnit
GetScrollUnit(KeyboardScrollActionType aDeltaType);

Просмотреть файл

@ -33,9 +33,6 @@ KeyboardScrollAnimation::KeyboardScrollAnimation(AsyncPanZoomController& aApzc,
mOriginMinMS = clamped(gfxPrefs::OtherSmoothScrollMinDurationMs(), 0, mOriginMaxMS);
break;
}
case KeyboardScrollAction::eSentinel: {
MOZ_ASSERT_UNREACHABLE("Invalid KeyboardScrollActionType.");
}
}
// The pref is 100-based int percentage, while mIntervalRatio is 1-based ratio

Просмотреть файл

@ -37,9 +37,6 @@ TouchCounter::Update(const MultiTouchInput& aInput)
break;
case MultiTouchInput::MULTITOUCH_MOVE:
break;
case MultiTouchInput::MULTITOUCH_SENTINEL:
MOZ_ASSERT_UNREACHABLE("Invalid input");
break;
}
}

Просмотреть файл

@ -29,8 +29,6 @@ WheelScrollAnimation::WheelScrollAnimation(AsyncPanZoomController& aApzc,
mOriginMaxMS = clamped(gfxPrefs::PixelSmoothScrollMaxDurationMs(), 0, 10000);
mOriginMinMS = clamped(gfxPrefs::PixelSmoothScrollMinDurationMs(), 0, mOriginMaxMS);
break;
case ScrollWheelInput::SCROLLDELTA_SENTINEL:
MOZ_FALLTHROUGH_ASSERT("Invalid value");
case ScrollWheelInput::SCROLLDELTA_LINE:
mOriginMaxMS = clamped(gfxPrefs::WheelSmoothScrollMaxDurationMs(), 0, 10000);
mOriginMinMS = clamped(gfxPrefs::WheelSmoothScrollMinDurationMs(), 0, mOriginMaxMS);

Просмотреть файл

@ -272,9 +272,6 @@ public:
case ScrollDirection::VERTICAL:
EXPECT_EQ(PANNING_LOCKED_Y, mState);
break;
case ScrollDirection::SENTINEL:
MOZ_ASSERT(false, "Invalid value");
break;
}
}

Просмотреть файл

@ -975,9 +975,6 @@ APZCCallbackHelper::NotifyPinchGesture(PinchGestureInput::PinchGestureType aType
case PinchGestureInput::PINCHGESTURE_END:
msg = eMagnifyGesture;
break;
case PinchGestureInput::PINCHGESTURE_SENTINEL:
MOZ_ASSERT_UNREACHABLE("Invalid value");
return;
}
WidgetSimpleGestureEvent event(true, msg, aWidget);

Просмотреть файл

@ -490,11 +490,6 @@ APZEventState::ProcessAPZStateChange(ViewID aViewId,
mActiveElementManager->HandleTouchEnd();
break;
}
case APZStateChange::eSentinel:
// Should never happen, but we want this case branch to stop the compiler
// whining about unhandled values.
MOZ_ASSERT(false);
break;
}
}

Просмотреть файл

@ -217,11 +217,6 @@ ChromeProcessController::HandleTap(TapType aType,
case TapType::eLongTapUp:
mAPZEventState->ProcessLongTapUp(presShell, point, scale, aModifiers);
break;
case TapType::eSentinel:
// Should never happen, but we need to handle this case branch for the
// compiler to be happy.
MOZ_ASSERT(false);
break;
}
}

Просмотреть файл

@ -42,10 +42,10 @@ struct ParamTraits<mozilla::layers::LayersBackend>
template <>
struct ParamTraits<mozilla::layers::ScaleMode>
: public ContiguousEnumSerializer<
: public ContiguousEnumSerializerInclusive<
mozilla::layers::ScaleMode,
mozilla::layers::ScaleMode::SCALE_NONE,
mozilla::layers::ScaleMode::SENTINEL>
mozilla::layers::kHighestScaleMode>
{};
template <>
@ -64,18 +64,18 @@ struct ParamTraits<mozilla::layers::DiagnosticTypes>
template <>
struct ParamTraits<mozilla::layers::ScrollDirection>
: public ContiguousEnumSerializer<
: public ContiguousEnumSerializerInclusive<
mozilla::layers::ScrollDirection,
mozilla::layers::ScrollDirection::NONE,
mozilla::layers::ScrollDirection::SENTINEL>
mozilla::layers::kHighestScrollDirection>
{};
template<>
struct ParamTraits<mozilla::layers::FrameMetrics::ScrollOffsetUpdateType>
: public ContiguousEnumSerializer<
: public ContiguousEnumSerializerInclusive<
mozilla::layers::FrameMetrics::ScrollOffsetUpdateType,
mozilla::layers::FrameMetrics::ScrollOffsetUpdateType::eNone,
mozilla::layers::FrameMetrics::ScrollOffsetUpdateType::eSentinel>
mozilla::layers::FrameMetrics::sHighestScrollOffsetUpdateType>
{};
template<>
@ -441,10 +441,10 @@ struct ParamTraits<mozilla::layers::FocusTarget::ScrollTargets>
template <>
struct ParamTraits<mozilla::layers::FocusTarget::FocusTargetType>
: public ContiguousEnumSerializer<
: public ContiguousEnumSerializerInclusive<
mozilla::layers::FocusTarget::FocusTargetType,
mozilla::layers::FocusTarget::eNone,
mozilla::layers::FocusTarget::eSentinel>
mozilla::layers::FocusTarget::sHighestFocusTargetType>
{};
template <>
@ -484,10 +484,10 @@ struct ParamTraits<mozilla::layers::FocusTarget>
template <>
struct ParamTraits<mozilla::layers::KeyboardScrollAction::KeyboardScrollActionType>
: public ContiguousEnumSerializer<
: public ContiguousEnumSerializerInclusive<
mozilla::layers::KeyboardScrollAction::KeyboardScrollActionType,
mozilla::layers::KeyboardScrollAction::KeyboardScrollActionType::eScrollCharacter,
mozilla::layers::KeyboardScrollAction::KeyboardScrollActionType::eSentinel>
mozilla::layers::KeyboardScrollAction::sHighestKeyboardScrollActionType>
{};
template <>
@ -557,24 +557,25 @@ struct ParamTraits<mozilla::layers::KeyboardMap>
}
};
typedef mozilla::layers::GeckoContentController::TapType TapType;
typedef mozilla::layers::GeckoContentController GeckoContentController;
typedef GeckoContentController::TapType TapType;
template <>
struct ParamTraits<TapType>
: public ContiguousEnumSerializer<
: public ContiguousEnumSerializerInclusive<
TapType,
TapType::eSingleTap,
TapType::eSentinel>
GeckoContentController::sHighestTapType>
{};
typedef mozilla::layers::GeckoContentController::APZStateChange APZStateChange;
typedef GeckoContentController::APZStateChange APZStateChange;
template <>
struct ParamTraits<APZStateChange>
: public ContiguousEnumSerializer<
: public ContiguousEnumSerializerInclusive<
APZStateChange,
APZStateChange::eTransformBegin,
APZStateChange::eSentinel>
GeckoContentController::sHighestAPZStateChange>
{};
template<>

Просмотреть файл

@ -12,6 +12,7 @@
#include "nsPoint.h"
#include "nsTArray.h"
#include "Units.h"
#include "mozilla/DefineEnum.h"
#include "mozilla/EventForwards.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/gfx/MatrixFwd.h"
@ -31,21 +32,16 @@ namespace dom {
class Touch;
} // namespace dom
enum InputType
{
// Warning, this enum is serialized and sent over IPC. If you reorder, add,
// or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
MULTITOUCH_INPUT,
MOUSE_INPUT,
PANGESTURE_INPUT,
PINCHGESTURE_INPUT,
TAPGESTURE_INPUT,
SCROLLWHEEL_INPUT,
KEYBOARD_INPUT,
// Used as an upper bound for ContiguousEnumSerializer
SENTINEL_INPUT,
};
MOZ_DEFINE_ENUM(
InputType, (
MULTITOUCH_INPUT,
MOUSE_INPUT,
PANGESTURE_INPUT,
PINCHGESTURE_INPUT,
TAPGESTURE_INPUT,
SCROLLWHEEL_INPUT,
KEYBOARD_INPUT
));
class MultiTouchInput;
class MouseInput;
@ -191,18 +187,13 @@ public:
class MultiTouchInput : public InputData
{
public:
enum MultiTouchType
{
// Warning, this enum is serialized and sent over IPC. If you reorder, add,
// or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
MULTITOUCH_START,
MULTITOUCH_MOVE,
MULTITOUCH_END,
MULTITOUCH_CANCEL,
// Used as an upper bound for ContiguousEnumSerializer
MULTITOUCH_SENTINEL,
};
MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
MultiTouchType, (
MULTITOUCH_START,
MULTITOUCH_MOVE,
MULTITOUCH_END,
MULTITOUCH_CANCEL
));
MultiTouchInput(MultiTouchType aType, uint32_t aTime, TimeStamp aTimeStamp,
Modifiers aModifiers);
@ -243,35 +234,26 @@ protected:
MouseInput();
public:
enum MouseType
{
// Warning, this enum is serialized and sent over IPC. If you reorder, add,
// or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
MOUSE_NONE,
MOUSE_MOVE,
MOUSE_DOWN,
MOUSE_UP,
MOUSE_DRAG_START,
MOUSE_DRAG_END,
MOUSE_WIDGET_ENTER,
MOUSE_WIDGET_EXIT,
// Used as an upper bound for ContiguousEnumSerializer
MOUSE_SENTINEL,
};
MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
MouseType, (
MOUSE_NONE,
MOUSE_MOVE,
MOUSE_DOWN,
MOUSE_UP,
MOUSE_DRAG_START,
MOUSE_DRAG_END,
MOUSE_WIDGET_ENTER,
MOUSE_WIDGET_EXIT
));
enum ButtonType
{
// Warning, this enum is serialized and sent over IPC. If you reorder, add,
// or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
LEFT_BUTTON,
MIDDLE_BUTTON,
RIGHT_BUTTON,
NONE,
// Used as an upper bound for ContiguousEnumSerializer
BUTTON_SENTINEL,
};
MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
ButtonType, (
LEFT_BUTTON,
MIDDLE_BUTTON,
RIGHT_BUTTON,
NONE
));
MouseInput(MouseType aType, ButtonType aButtonType, uint16_t aInputSource,
int16_t aButtons, const ScreenPoint& aPoint, uint32_t aTime,
@ -307,57 +289,51 @@ protected:
PanGestureInput();
public:
enum PanGestureType
{
// Warning, this enum is serialized and sent over IPC. If you reorder, add,
// or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
PanGestureType, (
// MayStart: Dispatched before any actual panning has occurred but when a
// pan gesture is probably about to start, for example when the user
// starts touching the touchpad. Should interrupt any ongoing APZ
// animation and can be used to trigger scrollability indicators (e.g.
// flashing overlay scrollbars).
PANGESTURE_MAYSTART,
// MayStart: Dispatched before any actual panning has occurred but when a
// pan gesture is probably about to start, for example when the user
// starts touching the touchpad. Should interrupt any ongoing APZ
// animation and can be used to trigger scrollability indicators (e.g.
// flashing overlay scrollbars).
PANGESTURE_MAYSTART,
// Cancelled: Dispatched after MayStart when no pan gesture is going to
// happen after all, for example when the user lifts their fingers from a
// touchpad without having done any scrolling.
PANGESTURE_CANCELLED,
// Cancelled: Dispatched after MayStart when no pan gesture is going to
// happen after all, for example when the user lifts their fingers from a
// touchpad without having done any scrolling.
PANGESTURE_CANCELLED,
// Start: A pan gesture is starting.
// For devices that do not support the MayStart event type, this event can
// be used to interrupt ongoing APZ animations.
PANGESTURE_START,
// Start: A pan gesture is starting.
// For devices that do not support the MayStart event type, this event can
// be used to interrupt ongoing APZ animations.
PANGESTURE_START,
// Pan: The actual pan motion by mPanDisplacement.
PANGESTURE_PAN,
// Pan: The actual pan motion by mPanDisplacement.
PANGESTURE_PAN,
// End: The pan gesture has ended, for example because the user has lifted
// their fingers from a touchpad after scrolling.
// Any potential momentum events fire after this event.
PANGESTURE_END,
// End: The pan gesture has ended, for example because the user has lifted
// their fingers from a touchpad after scrolling.
// Any potential momentum events fire after this event.
PANGESTURE_END,
// The following momentum event types are used in order to control the pan
// momentum animation. Using these instead of our own animation ensures
// that the animation curve is OS native and that the animation stops
// reliably if it is cancelled by the user.
// The following momentum event types are used in order to control the pan
// momentum animation. Using these instead of our own animation ensures
// that the animation curve is OS native and that the animation stops
// reliably if it is cancelled by the user.
// MomentumStart: Dispatched between the End event of the actual
// user-controlled pan, and the first MomentumPan event of the momentum
// animation.
PANGESTURE_MOMENTUMSTART,
// MomentumStart: Dispatched between the End event of the actual
// user-controlled pan, and the first MomentumPan event of the momentum
// animation.
PANGESTURE_MOMENTUMSTART,
// MomentumPan: The actual momentum motion by mPanDisplacement.
PANGESTURE_MOMENTUMPAN,
// MomentumPan: The actual momentum motion by mPanDisplacement.
PANGESTURE_MOMENTUMPAN,
// MomentumEnd: The momentum animation has ended, for example because the
// momentum velocity has gone below the stopping threshold, or because the
// user has stopped the animation by putting their fingers on a touchpad.
PANGESTURE_MOMENTUMEND,
// Used as an upper bound for ContiguousEnumSerializer
PANGESTURE_SENTINEL,
};
// MomentumEnd: The momentum animation has ended, for example because the
// momentum velocity has gone below the stopping threshold, or because the
// user has stopped the animation by putting their fingers on a touchpad.
PANGESTURE_MOMENTUMEND
));
PanGestureInput(PanGestureType aType,
uint32_t aTime,
@ -425,17 +401,12 @@ protected:
PinchGestureInput();
public:
enum PinchGestureType
{
// Warning, this enum is serialized and sent over IPC. If you reorder, add,
// or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
PINCHGESTURE_START,
PINCHGESTURE_SCALE,
PINCHGESTURE_END,
// Used as an upper bound for ContiguousEnumSerializer
PINCHGESTURE_SENTINEL,
};
MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
PinchGestureType, (
PINCHGESTURE_START,
PINCHGESTURE_SCALE,
PINCHGESTURE_END
));
// Construct a pinch gesture from a ParentLayer point.
// mFocusPoint remains (0,0) unless it's set later.
@ -487,21 +458,16 @@ protected:
TapGestureInput();
public:
enum TapGestureType
{
// Warning, this enum is serialized and sent over IPC. If you reorder, add,
// or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
TAPGESTURE_LONG,
TAPGESTURE_LONG_UP,
TAPGESTURE_UP,
TAPGESTURE_CONFIRMED,
TAPGESTURE_DOUBLE,
TAPGESTURE_SECOND, // See GeckoContentController::TapType::eSecondTap
TAPGESTURE_CANCEL,
// Used as an upper bound for ContiguousEnumSerializer
TAPGESTURE_SENTINEL,
};
MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
TapGestureType, (
TAPGESTURE_LONG,
TAPGESTURE_LONG_UP,
TAPGESTURE_UP,
TAPGESTURE_CONFIRMED,
TAPGESTURE_DOUBLE,
TAPGESTURE_SECOND, // See GeckoContentController::TapType::eSecondTap
TAPGESTURE_CANCEL
));
// Construct a tap gesture from a Screen point.
// mLocalPoint remains (0,0) unless it's set later.
@ -539,32 +505,21 @@ protected:
ScrollWheelInput();
public:
enum ScrollDeltaType
{
// Warning, this enum is serialized and sent over IPC. If you reorder, add,
// or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
ScrollDeltaType, (
// There are three kinds of scroll delta modes in Gecko: "page", "line" and
// "pixel".
SCROLLDELTA_LINE,
SCROLLDELTA_PAGE,
SCROLLDELTA_PIXEL
));
// There are three kinds of scroll delta modes in Gecko: "page", "line" and
// "pixel".
SCROLLDELTA_LINE,
SCROLLDELTA_PAGE,
SCROLLDELTA_PIXEL,
// Used as an upper bound for ContiguousEnumSerializer
SCROLLDELTA_SENTINEL,
};
enum ScrollMode
{
// Warning, this enum is serialized and sent over IPC. If you reorder, add,
// or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
SCROLLMODE_INSTANT,
SCROLLMODE_SMOOTH,
// Used as an upper bound for ContiguousEnumSerializer
SCROLLMODE_SENTINEL,
};
MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
ScrollMode, (
SCROLLMODE_INSTANT,
SCROLLMODE_SMOOTH
)
);
ScrollWheelInput(uint32_t aTime, TimeStamp aTimeStamp, Modifiers aModifiers,
ScrollMode aScrollMode, ScrollDeltaType aDeltaType,

Просмотреть файл

@ -1064,10 +1064,10 @@ struct ParamTraits<mozilla::widget::CandidateWindowPosition>
template<>
struct ParamTraits<mozilla::InputType>
: public ContiguousEnumSerializer<
: public ContiguousEnumSerializerInclusive<
mozilla::InputType,
mozilla::InputType::MULTITOUCH_INPUT,
mozilla::InputType::SENTINEL_INPUT>
mozilla::kHighestInputType>
{};
template<>
@ -1122,10 +1122,10 @@ struct ParamTraits<mozilla::SingleTouchData>
template<>
struct ParamTraits<mozilla::MultiTouchInput::MultiTouchType>
: public ContiguousEnumSerializer<
: public ContiguousEnumSerializerInclusive<
mozilla::MultiTouchInput::MultiTouchType,
mozilla::MultiTouchInput::MultiTouchType::MULTITOUCH_START,
mozilla::MultiTouchInput::MultiTouchType::MULTITOUCH_SENTINEL>
mozilla::MultiTouchInput::sHighestMultiTouchType>
{};
template<>
@ -1152,18 +1152,18 @@ struct ParamTraits<mozilla::MultiTouchInput>
template<>
struct ParamTraits<mozilla::MouseInput::MouseType>
: public ContiguousEnumSerializer<
: public ContiguousEnumSerializerInclusive<
mozilla::MouseInput::MouseType,
mozilla::MouseInput::MouseType::MOUSE_NONE,
mozilla::MouseInput::MouseType::MOUSE_SENTINEL>
mozilla::MouseInput::sHighestMouseType>
{};
template<>
struct ParamTraits<mozilla::MouseInput::ButtonType>
: public ContiguousEnumSerializer<
: public ContiguousEnumSerializerInclusive<
mozilla::MouseInput::ButtonType,
mozilla::MouseInput::ButtonType::LEFT_BUTTON,
mozilla::MouseInput::ButtonType::BUTTON_SENTINEL>
mozilla::MouseInput::sHighestButtonType>
{};
template<>
@ -1198,10 +1198,10 @@ struct ParamTraits<mozilla::MouseInput>
template<>
struct ParamTraits<mozilla::PanGestureInput::PanGestureType>
: public ContiguousEnumSerializer<
: public ContiguousEnumSerializerInclusive<
mozilla::PanGestureInput::PanGestureType,
mozilla::PanGestureInput::PanGestureType::PANGESTURE_MAYSTART,
mozilla::PanGestureInput::PanGestureType::PANGESTURE_SENTINEL>
mozilla::PanGestureInput::sHighestPanGestureType>
{};
template<>
@ -1246,10 +1246,10 @@ struct ParamTraits<mozilla::PanGestureInput>
template<>
struct ParamTraits<mozilla::PinchGestureInput::PinchGestureType>
: public ContiguousEnumSerializer<
: public ContiguousEnumSerializerInclusive<
mozilla::PinchGestureInput::PinchGestureType,
mozilla::PinchGestureInput::PinchGestureType::PINCHGESTURE_START,
mozilla::PinchGestureInput::PinchGestureType::PINCHGESTURE_SENTINEL>
mozilla::PinchGestureInput::sHighestPinchGestureType>
{};
template<>
@ -1280,10 +1280,10 @@ struct ParamTraits<mozilla::PinchGestureInput>
template<>
struct ParamTraits<mozilla::TapGestureInput::TapGestureType>
: public ContiguousEnumSerializer<
: public ContiguousEnumSerializerInclusive<
mozilla::TapGestureInput::TapGestureType,
mozilla::TapGestureInput::TapGestureType::TAPGESTURE_LONG,
mozilla::TapGestureInput::TapGestureType::TAPGESTURE_SENTINEL>
mozilla::TapGestureInput::sHighestTapGestureType>
{};
template<>
@ -1310,18 +1310,18 @@ struct ParamTraits<mozilla::TapGestureInput>
template<>
struct ParamTraits<mozilla::ScrollWheelInput::ScrollDeltaType>
: public ContiguousEnumSerializer<
: public ContiguousEnumSerializerInclusive<
mozilla::ScrollWheelInput::ScrollDeltaType,
mozilla::ScrollWheelInput::ScrollDeltaType::SCROLLDELTA_LINE,
mozilla::ScrollWheelInput::ScrollDeltaType::SCROLLDELTA_SENTINEL>
mozilla::ScrollWheelInput::sHighestScrollDeltaType>
{};
template<>
struct ParamTraits<mozilla::ScrollWheelInput::ScrollMode>
: public ContiguousEnumSerializer<
: public ContiguousEnumSerializerInclusive<
mozilla::ScrollWheelInput::ScrollMode,
mozilla::ScrollWheelInput::ScrollMode::SCROLLMODE_INSTANT,
mozilla::ScrollWheelInput::ScrollMode::SCROLLMODE_SENTINEL>
mozilla::ScrollWheelInput::sHighestScrollMode>
{};
template<>