Bug 1769547 - Do not MOZ_CRASH() on missing process r=nika
[gecko.git] / widget / WidgetMessageUtils.h
blobb4f917d91bab982a3b41671becc89df3f70fe386
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/LookAndFeel.h"
11 #include "mozilla/widget/ThemeChangeKind.h"
12 #include "nsIWidget.h"
13 #include "nsStyleConsts.h"
15 namespace IPC {
17 template <>
18 struct ParamTraits<mozilla::widget::ThemeChangeKind>
19 : public BitFlagsEnumSerializer<mozilla::widget::ThemeChangeKind,
20 mozilla::widget::ThemeChangeKind::AllBits> {
23 template <>
24 struct ParamTraits<mozilla::LookAndFeel::IntID>
25 : ContiguousEnumSerializer<mozilla::LookAndFeel::IntID,
26 mozilla::LookAndFeel::IntID::CaretBlinkTime,
27 mozilla::LookAndFeel::IntID::End> {
28 using IdType = std::underlying_type_t<mozilla::LookAndFeel::IntID>;
29 static_assert(static_cast<IdType>(
30 mozilla::LookAndFeel::IntID::CaretBlinkTime) == IdType(0));
33 template <>
34 struct ParamTraits<mozilla::LookAndFeel::ColorID>
35 : ContiguousEnumSerializer<
36 mozilla::LookAndFeel::ColorID,
37 mozilla::LookAndFeel::ColorID::TextSelectDisabledBackground,
38 mozilla::LookAndFeel::ColorID::End> {
39 using IdType = std::underlying_type_t<mozilla::LookAndFeel::ColorID>;
40 static_assert(
41 static_cast<IdType>(
42 mozilla::LookAndFeel::ColorID::TextSelectDisabledBackground) ==
43 IdType(0));
46 template <>
47 struct ParamTraits<nsTransparencyMode>
48 : ContiguousEnumSerializerInclusive<nsTransparencyMode, eTransparencyOpaque,
49 eTransparencyBorderlessGlass> {};
51 template <>
52 struct ParamTraits<nsCursor>
53 : ContiguousEnumSerializer<nsCursor, eCursor_standard, eCursorCount> {};
55 template <>
56 struct ParamTraits<nsIWidget::TouchpadGesturePhase>
57 : ContiguousEnumSerializerInclusive<
58 nsIWidget::TouchpadGesturePhase,
59 nsIWidget::TouchpadGesturePhase::PHASE_BEGIN,
60 nsIWidget::TouchpadGesturePhase::PHASE_END> {};
62 template <>
63 struct ParamTraits<nsIWidget::TouchPointerState>
64 : public BitFlagsEnumSerializer<nsIWidget::TouchPointerState,
65 nsIWidget::TouchPointerState::ALL_BITS> {};
67 } // namespace IPC
69 #endif // WidgetMessageUtils_h