Bug 1869043 allow a device to be specified with MediaTrackGraph::NotifyWhenDeviceStar...
[gecko.git] / layout / generic / LayoutMessageUtils.h
blob0cc694382fcf45f0ae8024f80a74f80eebe7c945
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef LAYOUT_GENERIC_LAYOUTMESSAGEUTILS_H_
8 #define LAYOUT_GENERIC_LAYOUTMESSAGEUTILS_H_
10 #include "ipc/EnumSerializer.h"
11 #include "ipc/IPCMessageUtils.h"
12 #include "nsIFrame.h"
13 #include "mozilla/AspectRatio.h"
14 #include "mozilla/webrender/WebRenderTypes.h"
16 namespace IPC {
18 template <>
19 struct ParamTraits<mozilla::IntrinsicSize> {
20 using paramType = mozilla::IntrinsicSize;
22 static void Write(MessageWriter* aWriter, const paramType& aParam) {
23 WriteParam(aWriter, aParam.width);
24 WriteParam(aWriter, aParam.height);
27 static bool Read(MessageReader* aReader, paramType* aResult) {
28 return ReadParam(aReader, &aResult->width) &&
29 ReadParam(aReader, &aResult->height);
33 template <>
34 struct ParamTraits<mozilla::AspectRatio> {
35 using paramType = mozilla::AspectRatio;
37 static void Write(MessageWriter* aWriter, const paramType& aParam) {
38 WriteParam(aWriter, aParam.mRatio);
41 static bool Read(MessageReader* aReader, paramType* aResult) {
42 return ReadParam(aReader, &aResult->mRatio);
46 template <>
47 struct ParamTraits<mozilla::StyleImageRendering>
48 : public ContiguousEnumSerializerInclusive<
49 mozilla::StyleImageRendering, mozilla::StyleImageRendering::Auto,
50 mozilla::StyleImageRendering::Optimizequality> {};
52 } // namespace IPC
54 #endif // LAYOUT_GENERIC_LAYOUTMESSAGEUTILS_H_