2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2009-11-17 17:22:23 +03:00
|
|
|
|
|
|
|
#ifndef TABMESSAGE_UTILS_H
|
|
|
|
#define TABMESSAGE_UTILS_H
|
|
|
|
|
2020-12-10 14:09:21 +03:00
|
|
|
#include "ipc/EnumSerializer.h"
|
2018-04-20 07:49:30 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
|
|
|
#include "mozilla/dom/Event.h"
|
2019-05-01 02:31:36 +03:00
|
|
|
#include "nsIRemoteTab.h"
|
2016-06-09 14:59:31 +03:00
|
|
|
#include "nsPIDOMWindow.h"
|
2009-11-17 17:22:23 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2019-05-15 23:26:25 +03:00
|
|
|
#include "mozilla/dom/EffectsInfo.h"
|
|
|
|
#include "mozilla/layers/LayersMessageUtils.h"
|
2020-07-15 16:24:20 +03:00
|
|
|
#include "TabMessageTypes.h"
|
2019-07-09 08:34:27 +03:00
|
|
|
#include "X11UndefineNone.h"
|
2009-11-17 17:22:23 +03:00
|
|
|
|
2020-07-15 16:24:20 +03:00
|
|
|
namespace mozilla::dom {
|
2009-11-17 17:22:23 +03:00
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
bool ReadRemoteEvent(const IPC::Message* aMsg, PickleIterator* aIter,
|
2009-11-17 17:22:23 +03:00
|
|
|
mozilla::dom::RemoteDOMEvent* aResult);
|
|
|
|
|
2020-07-15 16:24:20 +03:00
|
|
|
} // namespace mozilla::dom
|
2009-11-17 17:22:23 +03:00
|
|
|
|
|
|
|
namespace IPC {
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::dom::RemoteDOMEvent> {
|
|
|
|
typedef mozilla::dom::RemoteDOMEvent paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
2011-10-17 18:59:28 +04:00
|
|
|
aParam.mEvent->Serialize(aMsg, true);
|
2009-11-17 17:22:23 +03:00
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
2009-11-17 17:22:23 +03:00
|
|
|
return mozilla::dom::ReadRemoteEvent(aMsg, aIter, aResult);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void Log(const paramType& aParam, std::wstring* aLog) {}
|
|
|
|
};
|
|
|
|
|
2015-08-29 04:12:41 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<nsSizeMode>
|
|
|
|
: public ContiguousEnumSerializer<nsSizeMode, nsSizeMode_Normal,
|
|
|
|
nsSizeMode_Invalid> {};
|
|
|
|
|
2016-06-09 14:59:31 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<UIStateChangeType>
|
|
|
|
: public ContiguousEnumSerializer<UIStateChangeType,
|
|
|
|
UIStateChangeType_NoChange,
|
|
|
|
UIStateChangeType_Invalid> {};
|
|
|
|
|
2019-05-01 02:31:36 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<nsIRemoteTab::NavigationType>
|
|
|
|
: public ContiguousEnumSerializerInclusive<
|
|
|
|
nsIRemoteTab::NavigationType,
|
|
|
|
nsIRemoteTab::NavigationType::NAVIGATE_BACK,
|
|
|
|
nsIRemoteTab::NavigationType::NAVIGATE_URL> {};
|
|
|
|
|
2019-05-15 23:26:25 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::dom::EffectsInfo> {
|
|
|
|
typedef mozilla::dom::EffectsInfo paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
2019-06-11 15:50:40 +03:00
|
|
|
WriteParam(aMsg, aParam.mVisibleRect);
|
|
|
|
WriteParam(aMsg, aParam.mScaleX);
|
|
|
|
WriteParam(aMsg, aParam.mScaleY);
|
2019-05-15 23:26:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
2019-06-11 15:50:40 +03:00
|
|
|
return ReadParam(aMsg, aIter, &aResult->mVisibleRect) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mScaleX) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mScaleY);
|
2019-05-15 23:26:25 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-07-09 08:34:27 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::WhenToScroll>
|
|
|
|
: public ContiguousEnumSerializerInclusive<
|
|
|
|
mozilla::WhenToScroll, mozilla::WhenToScroll::Always,
|
|
|
|
mozilla::WhenToScroll::IfNotFullyVisible> {};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::ScrollFlags>
|
|
|
|
: public BitFlagsEnumSerializer<mozilla::ScrollFlags,
|
|
|
|
mozilla::ScrollFlags::ALL_BITS> {};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::ScrollAxis> {
|
|
|
|
typedef mozilla::ScrollAxis paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
WriteParam(aMsg, aParam.mWhereToScroll);
|
|
|
|
WriteParam(aMsg, aParam.mWhenToScroll);
|
|
|
|
WriteParam(aMsg, aParam.mOnlyIfPerceivedScrollableDirection);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
|
|
|
if (!ReadParam(aMsg, aIter, &aResult->mWhereToScroll)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (!ReadParam(aMsg, aIter, &aResult->mWhenToScroll)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// We can't set mOnlyIfPerceivedScrollableDirection directly since it's
|
|
|
|
// a bitfield.
|
|
|
|
bool value;
|
|
|
|
if (!ReadParam(aMsg, aIter, &value)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
aResult->mOnlyIfPerceivedScrollableDirection = value;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-04-16 01:30:13 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::dom::EmbedderElementEventType>
|
|
|
|
: public ContiguousEnumSerializer<
|
|
|
|
mozilla::dom::EmbedderElementEventType,
|
|
|
|
mozilla::dom::EmbedderElementEventType::NoEvent,
|
|
|
|
mozilla::dom::EmbedderElementEventType::EndGuard_> {};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace IPC
|
2009-11-17 17:22:23 +03:00
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
#endif // TABMESSAGE_UTILS_H
|