summaryrefslogtreecommitdiffstats
path: root/widget/WidgetMessageUtils.h
blob: 8aa2e01591b75dd862b21167400c7c8c9399ebef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef mozilla_WidgetMessageUtils_h
#define mozilla_WidgetMessageUtils_h

#include "ipc/EnumSerializer.h"
#include "ipc/IPCMessageUtils.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/widget/ThemeChangeKind.h"
#include "nsIWidget.h"
#include "nsStyleConsts.h"

namespace IPC {

template <>
struct ParamTraits<mozilla::widget::ThemeChangeKind>
    : public BitFlagsEnumSerializer<mozilla::widget::ThemeChangeKind,
                                    mozilla::widget::ThemeChangeKind::AllBits> {
};

template <>
struct ParamTraits<mozilla::LookAndFeel::IntID>
    : ContiguousEnumSerializer<mozilla::LookAndFeel::IntID,
                               mozilla::LookAndFeel::IntID::CaretBlinkTime,
                               mozilla::LookAndFeel::IntID::End> {
  using IdType = std::underlying_type_t<mozilla::LookAndFeel::IntID>;
  static_assert(static_cast<IdType>(
                    mozilla::LookAndFeel::IntID::CaretBlinkTime) == IdType(0));
};

template <>
struct ParamTraits<mozilla::LookAndFeel::ColorID>
    : ContiguousEnumSerializer<mozilla::LookAndFeel::ColorID,
                               mozilla::LookAndFeel::ColorID::WindowBackground,
                               mozilla::LookAndFeel::ColorID::End> {
  using IdType = std::underlying_type_t<mozilla::LookAndFeel::ColorID>;
  static_assert(
      static_cast<IdType>(mozilla::LookAndFeel::ColorID::WindowBackground) ==
      IdType(0));
};

template <>
struct ParamTraits<nsTransparencyMode>
    : ContiguousEnumSerializerInclusive<nsTransparencyMode, eTransparencyOpaque,
                                        eTransparencyBorderlessGlass> {};

template <>
struct ParamTraits<nsCursor>
    : ContiguousEnumSerializer<nsCursor, eCursor_standard, eCursorCount> {};

template <>
struct ParamTraits<nsIWidget::TouchPointerState>
    : public BitFlagsEnumSerializer<nsIWidget::TouchPointerState,
                                    nsIWidget::TouchPointerState::ALL_BITS> {};

}  // namespace IPC

#endif  // WidgetMessageUtils_h