Bug 1357754 - Add ScrollDirection IPC serialization code. r=botond
In the next patch we'll need to send ScrollDirection over IPDL so we
need to add serialization code for it.
MozReview-Commit-ID: HK8ibuhhnkS
--- a/gfx/ipc/GfxMessageUtils.h
+++ b/gfx/ipc/GfxMessageUtils.h
@@ -290,16 +290,24 @@ struct ParamTraits<mozilla::layers::Text
template <>
struct ParamTraits<mozilla::layers::DiagnosticTypes>
: public BitFlagsEnumSerializer<
mozilla::layers::DiagnosticTypes,
mozilla::layers::DiagnosticTypes::ALL_BITS>
{};
+template <>
+struct ParamTraits<mozilla::layers::ScrollDirection>
+ : public ContiguousEnumSerializer<
+ mozilla::layers::ScrollDirection,
+ mozilla::layers::ScrollDirection::NONE,
+ mozilla::layers::ScrollDirection::SENTINEL>
+{};
+
/*
template <>
struct ParamTraits<mozilla::PixelFormat>
: public EnumSerializer<mozilla::PixelFormat,
SurfaceFormat::A8R8G8B8_UINT32,
SurfaceFormat::UNKNOWN>
{};
*/
--- a/gfx/layers/LayersTypes.h
+++ b/gfx/layers/LayersTypes.h
@@ -297,15 +297,16 @@ public:
}
private:
uint64_t mHandle;
};
enum class ScrollDirection : uint32_t {
NONE,
VERTICAL,
- HORIZONTAL
+ HORIZONTAL,
+ SENTINEL /* for IPC serialization */
};
} // namespace layers
} // namespace mozilla
#endif /* GFX_LAYERSTYPES_H */
--- a/gfx/layers/apz/test/gtest/APZTestCommon.h
+++ b/gfx/layers/apz/test/gtest/APZTestCommon.h
@@ -263,16 +263,19 @@ public:
EXPECT_EQ(PANNING, mState);
break;
case ScrollDirection::HORIZONTAL:
EXPECT_EQ(PANNING_LOCKED_X, mState);
break;
case ScrollDirection::VERTICAL:
EXPECT_EQ(PANNING_LOCKED_Y, mState);
break;
+ case ScrollDirection::SENTINEL:
+ MOZ_ASSERT(false, "Invalid value");
+ break;
}
}
void AdvanceAnimationsUntilEnd(const TimeDuration& aIncrement = TimeDuration::FromMilliseconds(10)) {
while (AdvanceAnimations(mcc->Time())) {
mcc->AdvanceBy(aIncrement);
}
}