Bug 1942006 - Upstream a variety of Servo-specific code from Servo's downstream fork...
[gecko.git] / widget / WidgetMessageUtils.h
blobd84931368767f8619b3285b6c404f57a483d8594
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_WidgetMessageUtils_h
6 #define mozilla_WidgetMessageUtils_h
8 #include "ipc/EnumSerializer.h"
9 #include "ipc/IPCMessageUtils.h"
10 #include "mozilla/DimensionRequest.h"
11 #include "mozilla/GfxMessageUtils.h"
12 #include "mozilla/LookAndFeel.h"
13 #include "mozilla/widget/ThemeChangeKind.h"
14 #include "nsIClipboard.h"
15 #include "nsIWidget.h"
16 #include "nsStyleConsts.h"
18 namespace IPC {
20 template <>
21 struct ParamTraits<mozilla::widget::ThemeChangeKind>
22 : public BitFlagsEnumSerializer<mozilla::widget::ThemeChangeKind,
23 mozilla::widget::ThemeChangeKind::AllBits> {
26 template <>
27 struct ParamTraits<mozilla::LookAndFeel::IntID>
28 : ContiguousEnumSerializer<mozilla::LookAndFeel::IntID,
29 mozilla::LookAndFeel::IntID(0),
30 mozilla::LookAndFeel::IntID::End> {
31 using IdType = std::underlying_type_t<mozilla::LookAndFeel::IntID>;
34 template <>
35 struct ParamTraits<mozilla::LookAndFeel::ColorID>
36 : ContiguousEnumSerializer<mozilla::LookAndFeel::ColorID,
37 mozilla::LookAndFeel::ColorID(0),
38 mozilla::LookAndFeel::ColorID::End> {
39 using IdType = std::underlying_type_t<mozilla::LookAndFeel::ColorID>;
42 template <>
43 struct ParamTraits<mozilla::widget::TransparencyMode>
44 : ContiguousEnumSerializerInclusive<
45 mozilla::widget::TransparencyMode,
46 mozilla::widget::TransparencyMode::Opaque,
47 mozilla::widget::TransparencyMode::Transparent> {};
49 template <>
50 struct ParamTraits<nsCursor>
51 : ContiguousEnumSerializer<nsCursor, eCursor_standard, eCursorCount> {};
53 template <>
54 struct ParamTraits<nsIWidget::TouchpadGesturePhase>
55 : ContiguousEnumSerializerInclusive<
56 nsIWidget::TouchpadGesturePhase,
57 nsIWidget::TouchpadGesturePhase::PHASE_BEGIN,
58 nsIWidget::TouchpadGesturePhase::PHASE_END> {};
60 template <>
61 struct ParamTraits<nsIWidget::TouchPointerState>
62 : public BitFlagsEnumSerializer<nsIWidget::TouchPointerState,
63 nsIWidget::TouchPointerState::ALL_BITS> {};
65 template <>
66 struct ParamTraits<mozilla::DimensionKind>
67 : public ContiguousEnumSerializerInclusive<mozilla::DimensionKind,
68 mozilla::DimensionKind::Inner,
69 mozilla::DimensionKind::Outer> {
72 DEFINE_IPC_SERIALIZER_WITH_FIELDS(mozilla::DimensionRequest, mDimensionKind, mX,
73 mY, mWidth, mHeight);
75 template <>
76 struct ParamTraits<nsIClipboard::ClipboardType>
77 : public ContiguousEnumSerializerInclusive<
78 nsIClipboard::ClipboardType, nsIClipboard::kSelectionClipboard,
79 nsIClipboard::kSelectionCache> {};
81 } // namespace IPC
83 #endif // WidgetMessageUtils_h