1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsGUIEventIPC_h__
7 #define nsGUIEventIPC_h__
9 #include "ipc/EnumSerializer.h"
10 #include "ipc/IPCMessageUtils.h"
11 #include "mozilla/ContentCache.h"
12 #include "mozilla/GfxMessageUtils.h"
13 #include "mozilla/dom/Touch.h"
14 #include "mozilla/ipc/IPDLParamTraits.h" // for ReadIPDLParam and WriteIPDLParam
15 #include "mozilla/ipc/URIUtils.h" // for IPDLParamTraits<nsIURI*>
16 #include "mozilla/layers/LayersMessageUtils.h"
17 #include "mozilla/MiscEvents.h"
18 #include "mozilla/MouseEvents.h"
19 #include "mozilla/TextEvents.h"
20 #include "mozilla/TouchEvents.h"
21 #include "mozilla/WheelHandlingHelper.h" // for WheelDeltaAdjustmentStrategy
22 #include "mozilla/dom/Selection.h"
23 #include "InputData.h"
28 struct ParamTraits
<mozilla::EventMessage
>
29 : public ContiguousEnumSerializer
<
30 mozilla::EventMessage
, mozilla::EventMessage(0),
31 mozilla::EventMessage::eEventMessage_MaxValue
> {};
34 struct ParamTraits
<mozilla::BaseEventFlags
> {
35 using paramType
= mozilla::BaseEventFlags
;
37 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
38 aWriter
->WriteBytes(&aParam
, sizeof(aParam
));
41 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
42 return aReader
->ReadBytesInto(aResult
, sizeof(*aResult
));
47 struct ParamTraits
<mozilla::WidgetEvent
> {
48 using paramType
= mozilla::WidgetEvent
;
50 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
51 // Mark the event as posted to another process.
52 const_cast<mozilla::WidgetEvent
&>(aParam
).MarkAsPostedToRemoteProcess();
54 WriteParam(aWriter
, static_cast<mozilla::EventClassIDType
>(aParam
.mClass
));
55 WriteParam(aWriter
, aParam
.mMessage
);
56 WriteParam(aWriter
, aParam
.mRefPoint
);
57 WriteParam(aWriter
, aParam
.mFocusSequenceNumber
);
58 WriteParam(aWriter
, aParam
.mTimeStamp
);
59 WriteParam(aWriter
, aParam
.mFlags
);
60 WriteParam(aWriter
, aParam
.mLayersId
);
63 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
64 mozilla::EventClassIDType eventClassID
= 0;
65 bool ret
= ReadParam(aReader
, &eventClassID
) &&
66 ReadParam(aReader
, &aResult
->mMessage
) &&
67 ReadParam(aReader
, &aResult
->mRefPoint
) &&
68 ReadParam(aReader
, &aResult
->mFocusSequenceNumber
) &&
69 ReadParam(aReader
, &aResult
->mTimeStamp
) &&
70 ReadParam(aReader
, &aResult
->mFlags
) &&
71 ReadParam(aReader
, &aResult
->mLayersId
);
72 aResult
->mClass
= static_cast<mozilla::EventClassID
>(eventClassID
);
74 // Reset cross process dispatching state here because the event has not
75 // been dispatched to different process from current process.
76 aResult
->ResetCrossProcessDispatchingState();
77 // Mark the event comes from another process.
78 aResult
->MarkAsComingFromAnotherProcess();
85 struct ParamTraits
<mozilla::WidgetGUIEvent
> {
86 using paramType
= mozilla::WidgetGUIEvent
;
88 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
89 WriteParam(aWriter
, static_cast<const mozilla::WidgetEvent
&>(aParam
));
92 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
93 return ReadParam(aReader
, static_cast<mozilla::WidgetEvent
*>(aResult
));
98 struct ParamTraits
<mozilla::WidgetInputEvent
> {
99 using paramType
= mozilla::WidgetInputEvent
;
101 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
102 WriteParam(aWriter
, static_cast<const mozilla::WidgetGUIEvent
&>(aParam
));
103 WriteParam(aWriter
, aParam
.mModifiers
);
106 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
107 return ReadParam(aReader
, static_cast<mozilla::WidgetGUIEvent
*>(aResult
)) &&
108 ReadParam(aReader
, &aResult
->mModifiers
);
113 struct ParamTraits
<mozilla::WidgetMouseEventBase
> {
114 using paramType
= mozilla::WidgetMouseEventBase
;
116 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
117 WriteParam(aWriter
, static_cast<const mozilla::WidgetInputEvent
&>(aParam
));
118 WriteParam(aWriter
, aParam
.mButton
);
119 WriteParam(aWriter
, aParam
.mButtons
);
120 WriteParam(aWriter
, aParam
.mPressure
);
121 WriteParam(aWriter
, aParam
.mInputSource
);
124 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
125 return ReadParam(aReader
,
126 static_cast<mozilla::WidgetInputEvent
*>(aResult
)) &&
127 ReadParam(aReader
, &aResult
->mButton
) &&
128 ReadParam(aReader
, &aResult
->mButtons
) &&
129 ReadParam(aReader
, &aResult
->mPressure
) &&
130 ReadParam(aReader
, &aResult
->mInputSource
);
135 struct ParamTraits
<mozilla::WidgetWheelEvent
> {
136 using paramType
= mozilla::WidgetWheelEvent
;
138 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
140 static_cast<const mozilla::WidgetMouseEventBase
&>(aParam
));
141 WriteParam(aWriter
, aParam
.mDeltaX
);
142 WriteParam(aWriter
, aParam
.mDeltaY
);
143 WriteParam(aWriter
, aParam
.mDeltaZ
);
144 WriteParam(aWriter
, aParam
.mDeltaMode
);
145 WriteParam(aWriter
, aParam
.mWheelTicksX
);
146 WriteParam(aWriter
, aParam
.mWheelTicksY
);
147 WriteParam(aWriter
, aParam
.mCustomizedByUserPrefs
);
148 WriteParam(aWriter
, aParam
.mMayHaveMomentum
);
149 WriteParam(aWriter
, aParam
.mIsMomentum
);
150 WriteParam(aWriter
, aParam
.mIsNoLineOrPageDelta
);
151 WriteParam(aWriter
, aParam
.mLineOrPageDeltaX
);
152 WriteParam(aWriter
, aParam
.mLineOrPageDeltaY
);
153 WriteParam(aWriter
, static_cast<uint8_t>(aParam
.mScrollType
));
154 WriteParam(aWriter
, aParam
.mOverflowDeltaX
);
155 WriteParam(aWriter
, aParam
.mOverflowDeltaY
);
156 WriteParam(aWriter
, aParam
.mViewPortIsOverscrolled
);
157 WriteParam(aWriter
, aParam
.mCanTriggerSwipe
);
158 WriteParam(aWriter
, aParam
.mAllowToOverrideSystemScrollSpeed
);
159 WriteParam(aWriter
, aParam
.mDeltaValuesHorizontalizedForDefaultHandler
);
162 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
163 uint8_t scrollType
= 0;
164 bool rv
= ReadParam(aReader
,
165 static_cast<mozilla::WidgetMouseEventBase
*>(aResult
)) &&
166 ReadParam(aReader
, &aResult
->mDeltaX
) &&
167 ReadParam(aReader
, &aResult
->mDeltaY
) &&
168 ReadParam(aReader
, &aResult
->mDeltaZ
) &&
169 ReadParam(aReader
, &aResult
->mDeltaMode
) &&
170 ReadParam(aReader
, &aResult
->mWheelTicksX
) &&
171 ReadParam(aReader
, &aResult
->mWheelTicksY
) &&
172 ReadParam(aReader
, &aResult
->mCustomizedByUserPrefs
) &&
173 ReadParam(aReader
, &aResult
->mMayHaveMomentum
) &&
174 ReadParam(aReader
, &aResult
->mIsMomentum
) &&
175 ReadParam(aReader
, &aResult
->mIsNoLineOrPageDelta
) &&
176 ReadParam(aReader
, &aResult
->mLineOrPageDeltaX
) &&
177 ReadParam(aReader
, &aResult
->mLineOrPageDeltaY
) &&
178 ReadParam(aReader
, &scrollType
) &&
179 ReadParam(aReader
, &aResult
->mOverflowDeltaX
) &&
180 ReadParam(aReader
, &aResult
->mOverflowDeltaY
) &&
181 ReadParam(aReader
, &aResult
->mViewPortIsOverscrolled
) &&
182 ReadParam(aReader
, &aResult
->mCanTriggerSwipe
) &&
183 ReadParam(aReader
, &aResult
->mAllowToOverrideSystemScrollSpeed
) &&
185 &aResult
->mDeltaValuesHorizontalizedForDefaultHandler
);
186 aResult
->mScrollType
=
187 static_cast<mozilla::WidgetWheelEvent::ScrollType
>(scrollType
);
193 struct ParamTraits
<mozilla::WidgetPointerHelper
> {
194 using paramType
= mozilla::WidgetPointerHelper
;
196 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
197 WriteParam(aWriter
, aParam
.pointerId
);
198 WriteParam(aWriter
, aParam
.tiltX
);
199 WriteParam(aWriter
, aParam
.tiltY
);
200 WriteParam(aWriter
, aParam
.twist
);
201 WriteParam(aWriter
, aParam
.tangentialPressure
);
202 // We don't serialize convertToPointer since it's temporarily variable and
203 // should be reset to default.
206 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
208 rv
= ReadParam(aReader
, &aResult
->pointerId
) &&
209 ReadParam(aReader
, &aResult
->tiltX
) &&
210 ReadParam(aReader
, &aResult
->tiltY
) &&
211 ReadParam(aReader
, &aResult
->twist
) &&
212 ReadParam(aReader
, &aResult
->tangentialPressure
);
218 struct ParamTraits
<mozilla::WidgetMouseEvent
> {
219 using paramType
= mozilla::WidgetMouseEvent
;
221 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
223 static_cast<const mozilla::WidgetMouseEventBase
&>(aParam
));
225 static_cast<const mozilla::WidgetPointerHelper
&>(aParam
));
226 WriteParam(aWriter
, aParam
.mIgnoreRootScrollFrame
);
227 WriteParam(aWriter
, aParam
.mClickEventPrevented
);
228 WriteParam(aWriter
, static_cast<paramType::ReasonType
>(aParam
.mReason
));
229 WriteParam(aWriter
, static_cast<paramType::ContextMenuTriggerType
>(
230 aParam
.mContextMenuTrigger
));
231 WriteParam(aWriter
, aParam
.mExitFrom
.isSome());
232 if (aParam
.mExitFrom
.isSome()) {
233 WriteParam(aWriter
, static_cast<paramType::ExitFromType
>(
234 aParam
.mExitFrom
.value()));
236 WriteParam(aWriter
, aParam
.mClickCount
);
239 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
241 paramType::ReasonType reason
= 0;
242 paramType::ContextMenuTriggerType contextMenuTrigger
= 0;
243 bool hasExitFrom
= false;
244 rv
= ReadParam(aReader
,
245 static_cast<mozilla::WidgetMouseEventBase
*>(aResult
)) &&
247 static_cast<mozilla::WidgetPointerHelper
*>(aResult
)) &&
248 ReadParam(aReader
, &aResult
->mIgnoreRootScrollFrame
) &&
249 ReadParam(aReader
, &aResult
->mClickEventPrevented
) &&
250 ReadParam(aReader
, &reason
) && ReadParam(aReader
, &contextMenuTrigger
);
251 aResult
->mReason
= static_cast<paramType::Reason
>(reason
);
252 aResult
->mContextMenuTrigger
=
253 static_cast<paramType::ContextMenuTrigger
>(contextMenuTrigger
);
254 rv
= rv
&& ReadParam(aReader
, &hasExitFrom
);
256 paramType::ExitFromType exitFrom
= 0;
257 rv
= rv
&& ReadParam(aReader
, &exitFrom
);
258 aResult
->mExitFrom
= Some(static_cast<paramType::ExitFrom
>(exitFrom
));
260 rv
= rv
&& ReadParam(aReader
, &aResult
->mClickCount
);
266 struct ParamTraits
<mozilla::WidgetDragEvent
> {
267 using paramType
= mozilla::WidgetDragEvent
;
269 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
270 WriteParam(aWriter
, static_cast<const mozilla::WidgetMouseEvent
&>(aParam
));
271 WriteParam(aWriter
, aParam
.mUserCancelled
);
272 WriteParam(aWriter
, aParam
.mDefaultPreventedOnContent
);
273 WriteParam(aWriter
, aParam
.mInHTMLEditorEventListener
);
276 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
278 ReadParam(aReader
, static_cast<mozilla::WidgetMouseEvent
*>(aResult
)) &&
279 ReadParam(aReader
, &aResult
->mUserCancelled
) &&
280 ReadParam(aReader
, &aResult
->mDefaultPreventedOnContent
) &&
281 ReadParam(aReader
, &aResult
->mInHTMLEditorEventListener
);
287 struct ParamTraits
<mozilla::WidgetPointerEvent
> {
288 using paramType
= mozilla::WidgetPointerEvent
;
290 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
291 WriteParam(aWriter
, static_cast<const mozilla::WidgetMouseEvent
&>(aParam
));
292 WriteParam(aWriter
, aParam
.mWidth
);
293 WriteParam(aWriter
, aParam
.mHeight
);
294 WriteParam(aWriter
, aParam
.mIsPrimary
);
297 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
299 ReadParam(aReader
, static_cast<mozilla::WidgetMouseEvent
*>(aResult
)) &&
300 ReadParam(aReader
, &aResult
->mWidth
) &&
301 ReadParam(aReader
, &aResult
->mHeight
) &&
302 ReadParam(aReader
, &aResult
->mIsPrimary
);
308 struct ParamTraits
<mozilla::WidgetTouchEvent
> {
309 using paramType
= mozilla::WidgetTouchEvent
;
311 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
312 WriteParam(aWriter
, static_cast<const mozilla::WidgetInputEvent
&>(aParam
));
313 WriteParam(aWriter
, aParam
.mInputSource
);
314 WriteParam(aWriter
, aParam
.mButton
);
315 WriteParam(aWriter
, aParam
.mButtons
);
316 // Sigh, Touch bites us again! We want to be able to do
317 // WriteParam(aWriter, aParam.mTouches);
318 const paramType::TouchArray
& touches
= aParam
.mTouches
;
319 WriteParam(aWriter
, touches
.Length());
320 for (uint32_t i
= 0; i
< touches
.Length(); ++i
) {
321 mozilla::dom::Touch
* touch
= touches
[i
];
322 WriteParam(aWriter
, touch
->mIdentifier
);
323 WriteParam(aWriter
, touch
->mRefPoint
);
324 WriteParam(aWriter
, touch
->mRadius
);
325 WriteParam(aWriter
, touch
->mRotationAngle
);
326 WriteParam(aWriter
, touch
->mForce
);
327 WriteParam(aWriter
, touch
->tiltX
);
328 WriteParam(aWriter
, touch
->tiltY
);
329 WriteParam(aWriter
, touch
->twist
);
333 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
334 paramType::TouchArray::size_type numTouches
;
335 if (!ReadParam(aReader
, static_cast<mozilla::WidgetInputEvent
*>(aResult
)) ||
336 !ReadParam(aReader
, &aResult
->mInputSource
) ||
337 !ReadParam(aReader
, &aResult
->mButton
) ||
338 !ReadParam(aReader
, &aResult
->mButtons
) ||
339 !ReadParam(aReader
, &numTouches
)) {
342 for (uint32_t i
= 0; i
< numTouches
; ++i
) {
344 mozilla::LayoutDeviceIntPoint refPoint
;
345 mozilla::LayoutDeviceIntPoint radius
;
351 if (!ReadParam(aReader
, &identifier
) || !ReadParam(aReader
, &refPoint
) ||
352 !ReadParam(aReader
, &radius
) || !ReadParam(aReader
, &rotationAngle
) ||
353 !ReadParam(aReader
, &force
) || !ReadParam(aReader
, &tiltX
) ||
354 !ReadParam(aReader
, &tiltY
) || !ReadParam(aReader
, &twist
)) {
357 auto* touch
= new mozilla::dom::Touch(identifier
, refPoint
, radius
,
358 rotationAngle
, force
);
359 touch
->tiltX
= tiltX
;
360 touch
->tiltY
= tiltY
;
361 touch
->twist
= twist
;
362 aResult
->mTouches
.AppendElement(touch
);
369 struct ParamTraits
<mozilla::AlternativeCharCode
> {
370 using paramType
= mozilla::AlternativeCharCode
;
372 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
373 WriteParam(aWriter
, aParam
.mUnshiftedCharCode
);
374 WriteParam(aWriter
, aParam
.mShiftedCharCode
);
377 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
378 return ReadParam(aReader
, &aResult
->mUnshiftedCharCode
) &&
379 ReadParam(aReader
, &aResult
->mShiftedCharCode
);
384 struct ParamTraits
<mozilla::ShortcutKeyCandidate::ShiftState
>
385 : public ContiguousEnumSerializerInclusive
<
386 mozilla::ShortcutKeyCandidate::ShiftState
,
387 mozilla::ShortcutKeyCandidate::ShiftState::Ignorable
,
388 mozilla::ShortcutKeyCandidate::ShiftState::MatchExactly
> {};
391 struct ParamTraits
<mozilla::ShortcutKeyCandidate::SkipIfEarlierHandlerDisabled
>
392 : public ContiguousEnumSerializerInclusive
<
393 mozilla::ShortcutKeyCandidate::SkipIfEarlierHandlerDisabled
,
394 mozilla::ShortcutKeyCandidate::SkipIfEarlierHandlerDisabled::No
,
395 mozilla::ShortcutKeyCandidate::SkipIfEarlierHandlerDisabled::Yes
> {};
398 struct ParamTraits
<mozilla::ShortcutKeyCandidate
> {
399 using paramType
= mozilla::ShortcutKeyCandidate
;
401 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
402 WriteParam(aWriter
, aParam
.mCharCode
);
403 WriteParam(aWriter
, aParam
.mShiftState
);
404 WriteParam(aWriter
, aParam
.mSkipIfEarlierHandlerDisabled
);
407 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
408 return ReadParam(aReader
, &aResult
->mCharCode
) &&
409 ReadParam(aReader
, &aResult
->mShiftState
) &&
410 ReadParam(aReader
, &aResult
->mSkipIfEarlierHandlerDisabled
);
415 struct ParamTraits
<mozilla::WidgetKeyboardEvent
> {
416 using paramType
= mozilla::WidgetKeyboardEvent
;
418 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
419 WriteParam(aWriter
, static_cast<const mozilla::WidgetInputEvent
&>(aParam
));
421 static_cast<mozilla::KeyNameIndexType
>(aParam
.mKeyNameIndex
));
423 static_cast<mozilla::CodeNameIndexType
>(aParam
.mCodeNameIndex
));
424 WriteParam(aWriter
, aParam
.mKeyValue
);
425 WriteParam(aWriter
, aParam
.mCodeValue
);
426 WriteParam(aWriter
, aParam
.mKeyCode
);
427 WriteParam(aWriter
, aParam
.mCharCode
);
428 WriteParam(aWriter
, aParam
.mPseudoCharCode
);
429 WriteParam(aWriter
, aParam
.mAlternativeCharCodes
);
430 WriteParam(aWriter
, aParam
.mIsRepeat
);
431 WriteParam(aWriter
, aParam
.mLocation
);
432 WriteParam(aWriter
, aParam
.mUniqueId
);
433 WriteParam(aWriter
, aParam
.mIsSynthesizedByTIP
);
434 WriteParam(aWriter
, aParam
.mMaybeSkippableInRemoteProcess
);
436 // An OS-specific native event might be attached in |mNativeKeyEvent|, but
437 // that cannot be copied across process boundaries.
439 WriteParam(aWriter
, aParam
.mEditCommandsForSingleLineEditor
);
440 WriteParam(aWriter
, aParam
.mEditCommandsForMultiLineEditor
);
441 WriteParam(aWriter
, aParam
.mEditCommandsForRichTextEditor
);
442 WriteParam(aWriter
, aParam
.mEditCommandsForSingleLineEditorInitialized
);
443 WriteParam(aWriter
, aParam
.mEditCommandsForMultiLineEditorInitialized
);
444 WriteParam(aWriter
, aParam
.mEditCommandsForRichTextEditorInitialized
);
447 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
448 mozilla::KeyNameIndexType keyNameIndex
= 0;
449 mozilla::CodeNameIndexType codeNameIndex
= 0;
450 if (ReadParam(aReader
, static_cast<mozilla::WidgetInputEvent
*>(aResult
)) &&
451 ReadParam(aReader
, &keyNameIndex
) &&
452 ReadParam(aReader
, &codeNameIndex
) &&
453 ReadParam(aReader
, &aResult
->mKeyValue
) &&
454 ReadParam(aReader
, &aResult
->mCodeValue
) &&
455 ReadParam(aReader
, &aResult
->mKeyCode
) &&
456 ReadParam(aReader
, &aResult
->mCharCode
) &&
457 ReadParam(aReader
, &aResult
->mPseudoCharCode
) &&
458 ReadParam(aReader
, &aResult
->mAlternativeCharCodes
) &&
459 ReadParam(aReader
, &aResult
->mIsRepeat
) &&
460 ReadParam(aReader
, &aResult
->mLocation
) &&
461 ReadParam(aReader
, &aResult
->mUniqueId
) &&
462 ReadParam(aReader
, &aResult
->mIsSynthesizedByTIP
) &&
463 ReadParam(aReader
, &aResult
->mMaybeSkippableInRemoteProcess
) &&
464 ReadParam(aReader
, &aResult
->mEditCommandsForSingleLineEditor
) &&
465 ReadParam(aReader
, &aResult
->mEditCommandsForMultiLineEditor
) &&
466 ReadParam(aReader
, &aResult
->mEditCommandsForRichTextEditor
) &&
468 &aResult
->mEditCommandsForSingleLineEditorInitialized
) &&
470 &aResult
->mEditCommandsForMultiLineEditorInitialized
) &&
472 &aResult
->mEditCommandsForRichTextEditorInitialized
)) {
473 aResult
->mKeyNameIndex
= static_cast<mozilla::KeyNameIndex
>(keyNameIndex
);
474 aResult
->mCodeNameIndex
=
475 static_cast<mozilla::CodeNameIndex
>(codeNameIndex
);
476 aResult
->mNativeKeyEvent
= nullptr;
484 struct ParamTraits
<mozilla::TextRangeStyle
> {
485 using paramType
= mozilla::TextRangeStyle
;
487 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
488 WriteParam(aWriter
, aParam
.mDefinedStyles
);
489 WriteParam(aWriter
, static_cast<mozilla::TextRangeStyle::LineStyleType
>(
491 WriteParam(aWriter
, aParam
.mIsBoldLine
);
492 WriteParam(aWriter
, aParam
.mForegroundColor
);
493 WriteParam(aWriter
, aParam
.mBackgroundColor
);
494 WriteParam(aWriter
, aParam
.mUnderlineColor
);
497 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
498 mozilla::TextRangeStyle::LineStyleType lineStyle
;
499 if (!ReadParam(aReader
, &aResult
->mDefinedStyles
) ||
500 !ReadParam(aReader
, &lineStyle
) ||
501 !ReadParam(aReader
, &aResult
->mIsBoldLine
) ||
502 !ReadParam(aReader
, &aResult
->mForegroundColor
) ||
503 !ReadParam(aReader
, &aResult
->mBackgroundColor
) ||
504 !ReadParam(aReader
, &aResult
->mUnderlineColor
)) {
507 aResult
->mLineStyle
= mozilla::TextRangeStyle::ToLineStyle(lineStyle
);
513 struct ParamTraits
<mozilla::TextRange
> {
514 using paramType
= mozilla::TextRange
;
516 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
517 WriteParam(aWriter
, aParam
.mStartOffset
);
518 WriteParam(aWriter
, aParam
.mEndOffset
);
519 WriteParam(aWriter
, mozilla::ToRawTextRangeType(aParam
.mRangeType
));
520 WriteParam(aWriter
, aParam
.mRangeStyle
);
523 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
524 mozilla::RawTextRangeType rawTextRangeType
;
525 if (ReadParam(aReader
, &aResult
->mStartOffset
) &&
526 ReadParam(aReader
, &aResult
->mEndOffset
) &&
527 ReadParam(aReader
, &rawTextRangeType
) &&
528 ReadParam(aReader
, &aResult
->mRangeStyle
)) {
529 aResult
->mRangeType
= mozilla::ToTextRangeType(rawTextRangeType
);
537 struct ParamTraits
<mozilla::TextRangeArray
> {
538 using paramType
= mozilla::TextRangeArray
;
540 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
541 WriteParam(aWriter
, aParam
.Length());
542 for (uint32_t index
= 0; index
< aParam
.Length(); index
++) {
543 WriteParam(aWriter
, aParam
[index
]);
547 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
548 paramType::size_type length
;
549 if (!ReadParam(aReader
, &length
)) {
552 for (uint32_t index
= 0; index
< length
; index
++) {
553 mozilla::TextRange textRange
;
554 if (!ReadParam(aReader
, &textRange
)) {
558 aResult
->AppendElement(textRange
);
565 struct ParamTraits
<mozilla::WidgetCompositionEvent
> {
566 using paramType
= mozilla::WidgetCompositionEvent
;
568 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
569 WriteParam(aWriter
, static_cast<const mozilla::WidgetGUIEvent
&>(aParam
));
570 WriteParam(aWriter
, aParam
.mData
);
571 WriteParam(aWriter
, aParam
.mNativeIMEContext
);
572 WriteParam(aWriter
, aParam
.mCompositionId
);
573 bool hasRanges
= !!aParam
.mRanges
;
574 WriteParam(aWriter
, hasRanges
);
576 WriteParam(aWriter
, *aParam
.mRanges
.get());
580 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
582 if (!ReadParam(aReader
, static_cast<mozilla::WidgetGUIEvent
*>(aResult
)) ||
583 !ReadParam(aReader
, &aResult
->mData
) ||
584 !ReadParam(aReader
, &aResult
->mNativeIMEContext
) ||
585 !ReadParam(aReader
, &aResult
->mCompositionId
) ||
586 !ReadParam(aReader
, &hasRanges
)) {
591 aResult
->mRanges
= nullptr;
593 aResult
->mRanges
= new mozilla::TextRangeArray();
594 if (!ReadParam(aReader
, aResult
->mRanges
.get())) {
603 struct ParamTraits
<mozilla::FontRange
> {
604 using paramType
= mozilla::FontRange
;
606 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
607 WriteParam(aWriter
, aParam
.mStartOffset
);
608 WriteParam(aWriter
, aParam
.mFontName
);
609 WriteParam(aWriter
, aParam
.mFontSize
);
612 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
613 return ReadParam(aReader
, &aResult
->mStartOffset
) &&
614 ReadParam(aReader
, &aResult
->mFontName
) &&
615 ReadParam(aReader
, &aResult
->mFontSize
);
620 struct ParamTraits
<mozilla::WidgetSelectionEvent
> {
621 using paramType
= mozilla::WidgetSelectionEvent
;
623 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
624 WriteParam(aWriter
, static_cast<const mozilla::WidgetGUIEvent
&>(aParam
));
625 WriteParam(aWriter
, aParam
.mOffset
);
626 WriteParam(aWriter
, aParam
.mLength
);
627 WriteParam(aWriter
, aParam
.mReversed
);
628 WriteParam(aWriter
, aParam
.mExpandToClusterBoundary
);
629 WriteParam(aWriter
, aParam
.mSucceeded
);
630 WriteParam(aWriter
, aParam
.mUseNativeLineBreak
);
633 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
634 return ReadParam(aReader
, static_cast<mozilla::WidgetGUIEvent
*>(aResult
)) &&
635 ReadParam(aReader
, &aResult
->mOffset
) &&
636 ReadParam(aReader
, &aResult
->mLength
) &&
637 ReadParam(aReader
, &aResult
->mReversed
) &&
638 ReadParam(aReader
, &aResult
->mExpandToClusterBoundary
) &&
639 ReadParam(aReader
, &aResult
->mSucceeded
) &&
640 ReadParam(aReader
, &aResult
->mUseNativeLineBreak
);
645 struct ParamTraits
<mozilla::widget::IMENotificationRequests
> {
646 using paramType
= mozilla::widget::IMENotificationRequests
;
648 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
649 WriteParam(aWriter
, aParam
.mWantUpdates
);
652 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
653 return ReadParam(aReader
, &aResult
->mWantUpdates
);
658 struct ParamTraits
<mozilla::widget::NativeIMEContext
> {
659 using paramType
= mozilla::widget::NativeIMEContext
;
661 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
662 WriteParam(aWriter
, aParam
.mRawNativeIMEContext
);
663 WriteParam(aWriter
, aParam
.mOriginProcessID
);
666 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
667 return ReadParam(aReader
, &aResult
->mRawNativeIMEContext
) &&
668 ReadParam(aReader
, &aResult
->mOriginProcessID
);
673 struct ParamTraits
<mozilla::widget::IMENotification::SelectionChangeDataBase
> {
674 using paramType
= mozilla::widget::IMENotification::SelectionChangeDataBase
;
676 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
677 MOZ_RELEASE_ASSERT(aParam
.mString
);
678 WriteParam(aWriter
, aParam
.mOffset
);
679 WriteParam(aWriter
, *aParam
.mString
);
680 WriteParam(aWriter
, aParam
.mWritingModeBits
);
681 WriteParam(aWriter
, aParam
.mIsInitialized
);
682 WriteParam(aWriter
, aParam
.mHasRange
);
683 WriteParam(aWriter
, aParam
.mReversed
);
684 WriteParam(aWriter
, aParam
.mCausedByComposition
);
685 WriteParam(aWriter
, aParam
.mCausedBySelectionEvent
);
686 WriteParam(aWriter
, aParam
.mOccurredDuringComposition
);
689 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
690 aResult
->mString
= new nsString();
691 return ReadParam(aReader
, &aResult
->mOffset
) &&
692 ReadParam(aReader
, aResult
->mString
) &&
693 ReadParam(aReader
, &aResult
->mWritingModeBits
) &&
694 ReadParam(aReader
, &aResult
->mIsInitialized
) &&
695 ReadParam(aReader
, &aResult
->mHasRange
) &&
696 ReadParam(aReader
, &aResult
->mReversed
) &&
697 ReadParam(aReader
, &aResult
->mCausedByComposition
) &&
698 ReadParam(aReader
, &aResult
->mCausedBySelectionEvent
) &&
699 ReadParam(aReader
, &aResult
->mOccurredDuringComposition
);
704 struct ParamTraits
<mozilla::widget::IMENotification::TextChangeDataBase
> {
705 using paramType
= mozilla::widget::IMENotification::TextChangeDataBase
;
707 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
708 WriteParam(aWriter
, aParam
.mStartOffset
);
709 WriteParam(aWriter
, aParam
.mRemovedEndOffset
);
710 WriteParam(aWriter
, aParam
.mAddedEndOffset
);
711 WriteParam(aWriter
, aParam
.mCausedOnlyByComposition
);
712 WriteParam(aWriter
, aParam
.mIncludingChangesDuringComposition
);
713 WriteParam(aWriter
, aParam
.mIncludingChangesWithoutComposition
);
716 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
717 return ReadParam(aReader
, &aResult
->mStartOffset
) &&
718 ReadParam(aReader
, &aResult
->mRemovedEndOffset
) &&
719 ReadParam(aReader
, &aResult
->mAddedEndOffset
) &&
720 ReadParam(aReader
, &aResult
->mCausedOnlyByComposition
) &&
721 ReadParam(aReader
, &aResult
->mIncludingChangesDuringComposition
) &&
722 ReadParam(aReader
, &aResult
->mIncludingChangesWithoutComposition
);
727 struct ParamTraits
<mozilla::widget::IMENotification::MouseButtonEventData
> {
728 using paramType
= mozilla::widget::IMENotification::MouseButtonEventData
;
730 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
731 WriteParam(aWriter
, aParam
.mEventMessage
);
732 WriteParam(aWriter
, aParam
.mOffset
);
733 WriteParam(aWriter
, aParam
.mCursorPos
);
734 WriteParam(aWriter
, aParam
.mCharRect
);
735 WriteParam(aWriter
, aParam
.mButton
);
736 WriteParam(aWriter
, aParam
.mButtons
);
737 WriteParam(aWriter
, aParam
.mModifiers
);
740 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
741 return ReadParam(aReader
, &aResult
->mEventMessage
) &&
742 ReadParam(aReader
, &aResult
->mOffset
) &&
743 ReadParam(aReader
, &aResult
->mCursorPos
) &&
744 ReadParam(aReader
, &aResult
->mCharRect
) &&
745 ReadParam(aReader
, &aResult
->mButton
) &&
746 ReadParam(aReader
, &aResult
->mButtons
) &&
747 ReadParam(aReader
, &aResult
->mModifiers
);
752 struct ParamTraits
<mozilla::widget::IMENotification
> {
753 using paramType
= mozilla::widget::IMENotification
;
755 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
757 static_cast<mozilla::widget::IMEMessageType
>(aParam
.mMessage
));
758 switch (aParam
.mMessage
) {
759 case mozilla::widget::NOTIFY_IME_OF_SELECTION_CHANGE
:
760 WriteParam(aWriter
, aParam
.mSelectionChangeData
);
762 case mozilla::widget::NOTIFY_IME_OF_TEXT_CHANGE
:
763 WriteParam(aWriter
, aParam
.mTextChangeData
);
765 case mozilla::widget::NOTIFY_IME_OF_MOUSE_BUTTON_EVENT
:
766 WriteParam(aWriter
, aParam
.mMouseButtonEventData
);
773 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
774 mozilla::widget::IMEMessageType IMEMessage
= 0;
775 if (!ReadParam(aReader
, &IMEMessage
)) {
778 aResult
->mMessage
= static_cast<mozilla::widget::IMEMessage
>(IMEMessage
);
779 switch (aResult
->mMessage
) {
780 case mozilla::widget::NOTIFY_IME_OF_SELECTION_CHANGE
:
781 return ReadParam(aReader
, &aResult
->mSelectionChangeData
);
782 case mozilla::widget::NOTIFY_IME_OF_TEXT_CHANGE
:
783 return ReadParam(aReader
, &aResult
->mTextChangeData
);
784 case mozilla::widget::NOTIFY_IME_OF_MOUSE_BUTTON_EVENT
:
785 return ReadParam(aReader
, &aResult
->mMouseButtonEventData
);
793 struct ParamTraits
<mozilla::widget::IMEEnabled
>
794 : ContiguousEnumSerializer
<mozilla::widget::IMEEnabled
,
795 mozilla::widget::IMEEnabled::Disabled
,
796 mozilla::widget::IMEEnabled::Unknown
> {};
799 struct ParamTraits
<mozilla::widget::IMEState::Open
>
800 : ContiguousEnumSerializerInclusive
<
801 mozilla::widget::IMEState::Open
,
802 mozilla::widget::IMEState::Open::OPEN_STATE_NOT_SUPPORTED
,
803 mozilla::widget::IMEState::Open::CLOSED
> {};
806 struct ParamTraits
<mozilla::widget::IMEState
> {
807 using paramType
= mozilla::widget::IMEState
;
809 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
810 WriteParam(aWriter
, aParam
.mEnabled
);
811 WriteParam(aWriter
, aParam
.mOpen
);
814 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
815 return ReadParam(aReader
, &aResult
->mEnabled
) &&
816 ReadParam(aReader
, &aResult
->mOpen
);
821 struct ParamTraits
<mozilla::widget::InputContext::Origin
>
822 : ContiguousEnumSerializerInclusive
<
823 mozilla::widget::InputContext::Origin
,
824 mozilla::widget::InputContext::Origin::ORIGIN_MAIN
,
825 mozilla::widget::InputContext::Origin::ORIGIN_CONTENT
> {};
828 struct ParamTraits
<mozilla::widget::InputContext
> {
829 using paramType
= mozilla::widget::InputContext
;
831 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
832 WriteParam(aWriter
, aParam
.mIMEState
);
833 WriteParam(aWriter
, aParam
.mHTMLInputType
);
834 WriteParam(aWriter
, aParam
.mHTMLInputMode
);
835 WriteParam(aWriter
, aParam
.mActionHint
);
836 WriteParam(aWriter
, aParam
.mAutocapitalize
);
837 WriteParam(aWriter
, aParam
.mOrigin
);
838 WriteParam(aWriter
, aParam
.mHasHandledUserInput
);
839 WriteParam(aWriter
, aParam
.mInPrivateBrowsing
);
840 mozilla::ipc::WriteIPDLParam(aWriter
, aWriter
->GetActor(), aParam
.mURI
);
843 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
844 return ReadParam(aReader
, &aResult
->mIMEState
) &&
845 ReadParam(aReader
, &aResult
->mHTMLInputType
) &&
846 ReadParam(aReader
, &aResult
->mHTMLInputMode
) &&
847 ReadParam(aReader
, &aResult
->mActionHint
) &&
848 ReadParam(aReader
, &aResult
->mAutocapitalize
) &&
849 ReadParam(aReader
, &aResult
->mOrigin
) &&
850 ReadParam(aReader
, &aResult
->mHasHandledUserInput
) &&
851 ReadParam(aReader
, &aResult
->mInPrivateBrowsing
) &&
852 mozilla::ipc::ReadIPDLParam(aReader
, aReader
->GetActor(),
853 address_of(aResult
->mURI
));
858 struct ParamTraits
<mozilla::widget::InputContextAction::Cause
>
859 : ContiguousEnumSerializerInclusive
<
860 mozilla::widget::InputContextAction::Cause
,
861 mozilla::widget::InputContextAction::Cause::CAUSE_UNKNOWN
,
862 mozilla::widget::InputContextAction::Cause::
863 CAUSE_UNKNOWN_DURING_KEYBOARD_INPUT
> {};
866 struct ParamTraits
<mozilla::widget::InputContextAction::FocusChange
>
867 : ContiguousEnumSerializerInclusive
<
868 mozilla::widget::InputContextAction::FocusChange
,
869 mozilla::widget::InputContextAction::FocusChange::FOCUS_NOT_CHANGED
,
870 mozilla::widget::InputContextAction::FocusChange::WIDGET_CREATED
> {};
873 struct ParamTraits
<mozilla::widget::InputContextAction
> {
874 using paramType
= mozilla::widget::InputContextAction
;
876 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
877 WriteParam(aWriter
, aParam
.mCause
);
878 WriteParam(aWriter
, aParam
.mFocusChange
);
881 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
882 return ReadParam(aReader
, &aResult
->mCause
) &&
883 ReadParam(aReader
, &aResult
->mFocusChange
);
888 struct ParamTraits
<mozilla::WritingMode
> {
889 using paramType
= mozilla::WritingMode
;
891 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
892 WriteParam(aWriter
, aParam
.mWritingMode
._0
);
895 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
896 return ReadParam(aReader
, &aResult
->mWritingMode
._0
);
901 struct ParamTraits
<mozilla::ContentCache::Selection
> {
902 using paramType
= mozilla::ContentCache::Selection
;
904 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
905 WriteParam(aWriter
, aParam
.mAnchor
);
906 WriteParam(aWriter
, aParam
.mFocus
);
907 WriteParam(aWriter
, aParam
.mWritingMode
);
908 WriteParam(aWriter
, aParam
.mHasRange
);
909 WriteParam(aWriter
, aParam
.mAnchorCharRects
[0]);
910 WriteParam(aWriter
, aParam
.mAnchorCharRects
[1]);
911 WriteParam(aWriter
, aParam
.mFocusCharRects
[0]);
912 WriteParam(aWriter
, aParam
.mFocusCharRects
[1]);
913 WriteParam(aWriter
, aParam
.mRect
);
916 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
917 return ReadParam(aReader
, &aResult
->mAnchor
) &&
918 ReadParam(aReader
, &aResult
->mFocus
) &&
919 ReadParam(aReader
, &aResult
->mWritingMode
) &&
920 ReadParam(aReader
, &aResult
->mHasRange
) &&
921 ReadParam(aReader
, &aResult
->mAnchorCharRects
[0]) &&
922 ReadParam(aReader
, &aResult
->mAnchorCharRects
[1]) &&
923 ReadParam(aReader
, &aResult
->mFocusCharRects
[0]) &&
924 ReadParam(aReader
, &aResult
->mFocusCharRects
[1]) &&
925 ReadParam(aReader
, &aResult
->mRect
);
930 struct ParamTraits
<mozilla::ContentCache::Caret
> {
931 using paramType
= mozilla::ContentCache::Caret
;
933 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
934 WriteParam(aWriter
, aParam
.mOffset
);
935 WriteParam(aWriter
, aParam
.mRect
);
938 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
939 return ReadParam(aReader
, &aResult
->mOffset
) &&
940 ReadParam(aReader
, &aResult
->mRect
);
945 struct ParamTraits
<mozilla::ContentCache::TextRectArray
> {
946 using paramType
= mozilla::ContentCache::TextRectArray
;
948 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
949 WriteParam(aWriter
, aParam
.mStart
);
950 WriteParam(aWriter
, aParam
.mRects
);
953 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
954 return ReadParam(aReader
, &aResult
->mStart
) &&
955 ReadParam(aReader
, &aResult
->mRects
);
960 struct ParamTraits
<mozilla::ContentCache
> {
961 using paramType
= mozilla::ContentCache
;
963 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
964 WriteParam(aWriter
, aParam
.mCompositionStart
);
965 WriteParam(aWriter
, aParam
.mText
);
966 WriteParam(aWriter
, aParam
.mSelection
);
967 WriteParam(aWriter
, aParam
.mFirstCharRect
);
968 WriteParam(aWriter
, aParam
.mCaret
);
969 WriteParam(aWriter
, aParam
.mTextRectArray
);
970 WriteParam(aWriter
, aParam
.mLastCommitStringTextRectArray
);
971 WriteParam(aWriter
, aParam
.mEditorRect
);
974 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
975 return ReadParam(aReader
, &aResult
->mCompositionStart
) &&
976 ReadParam(aReader
, &aResult
->mText
) &&
977 ReadParam(aReader
, &aResult
->mSelection
) &&
978 ReadParam(aReader
, &aResult
->mFirstCharRect
) &&
979 ReadParam(aReader
, &aResult
->mCaret
) &&
980 ReadParam(aReader
, &aResult
->mTextRectArray
) &&
981 ReadParam(aReader
, &aResult
->mLastCommitStringTextRectArray
) &&
982 ReadParam(aReader
, &aResult
->mEditorRect
);
987 struct ParamTraits
<mozilla::widget::CandidateWindowPosition
> {
988 using paramType
= mozilla::widget::CandidateWindowPosition
;
990 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
991 WriteParam(aWriter
, aParam
.mPoint
);
992 WriteParam(aWriter
, aParam
.mRect
);
993 WriteParam(aWriter
, aParam
.mExcludeRect
);
996 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
997 return ReadParam(aReader
, &aResult
->mPoint
) &&
998 ReadParam(aReader
, &aResult
->mRect
) &&
999 ReadParam(aReader
, &aResult
->mExcludeRect
);
1006 struct ParamTraits
<mozilla::InputType
>
1007 : public ContiguousEnumSerializerInclusive
<
1008 mozilla::InputType
, mozilla::InputType::MULTITOUCH_INPUT
,
1009 mozilla::kHighestInputType
> {};
1012 struct ParamTraits
<mozilla::InputData
> {
1013 using paramType
= mozilla::InputData
;
1015 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1016 WriteParam(aWriter
, aParam
.mInputType
);
1017 WriteParam(aWriter
, aParam
.mTimeStamp
);
1018 WriteParam(aWriter
, aParam
.modifiers
);
1019 WriteParam(aWriter
, aParam
.mFocusSequenceNumber
);
1020 WriteParam(aWriter
, aParam
.mLayersId
);
1023 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1024 return ReadParam(aReader
, &aResult
->mInputType
) &&
1025 ReadParam(aReader
, &aResult
->mTimeStamp
) &&
1026 ReadParam(aReader
, &aResult
->modifiers
) &&
1027 ReadParam(aReader
, &aResult
->mFocusSequenceNumber
) &&
1028 ReadParam(aReader
, &aResult
->mLayersId
);
1033 struct ParamTraits
<mozilla::SingleTouchData::HistoricalTouchData
> {
1034 using paramType
= mozilla::SingleTouchData::HistoricalTouchData
;
1036 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1037 WriteParam(aWriter
, aParam
.mTimeStamp
);
1038 WriteParam(aWriter
, aParam
.mScreenPoint
);
1039 WriteParam(aWriter
, aParam
.mLocalScreenPoint
);
1040 WriteParam(aWriter
, aParam
.mRadius
);
1041 WriteParam(aWriter
, aParam
.mRotationAngle
);
1042 WriteParam(aWriter
, aParam
.mForce
);
1045 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1046 return (ReadParam(aReader
, &aResult
->mTimeStamp
) &&
1047 ReadParam(aReader
, &aResult
->mScreenPoint
) &&
1048 ReadParam(aReader
, &aResult
->mLocalScreenPoint
) &&
1049 ReadParam(aReader
, &aResult
->mRadius
) &&
1050 ReadParam(aReader
, &aResult
->mRotationAngle
) &&
1051 ReadParam(aReader
, &aResult
->mForce
));
1056 struct ParamTraits
<mozilla::SingleTouchData
> {
1057 using paramType
= mozilla::SingleTouchData
;
1059 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1060 WriteParam(aWriter
, aParam
.mHistoricalData
);
1061 WriteParam(aWriter
, aParam
.mIdentifier
);
1062 WriteParam(aWriter
, aParam
.mScreenPoint
);
1063 WriteParam(aWriter
, aParam
.mLocalScreenPoint
);
1064 WriteParam(aWriter
, aParam
.mRadius
);
1065 WriteParam(aWriter
, aParam
.mRotationAngle
);
1066 WriteParam(aWriter
, aParam
.mForce
);
1067 WriteParam(aWriter
, aParam
.mTiltX
);
1068 WriteParam(aWriter
, aParam
.mTiltY
);
1069 WriteParam(aWriter
, aParam
.mTwist
);
1072 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1073 return (ReadParam(aReader
, &aResult
->mHistoricalData
) &&
1074 ReadParam(aReader
, &aResult
->mIdentifier
) &&
1075 ReadParam(aReader
, &aResult
->mScreenPoint
) &&
1076 ReadParam(aReader
, &aResult
->mLocalScreenPoint
) &&
1077 ReadParam(aReader
, &aResult
->mRadius
) &&
1078 ReadParam(aReader
, &aResult
->mRotationAngle
) &&
1079 ReadParam(aReader
, &aResult
->mForce
) &&
1080 ReadParam(aReader
, &aResult
->mTiltX
) &&
1081 ReadParam(aReader
, &aResult
->mTiltY
) &&
1082 ReadParam(aReader
, &aResult
->mTwist
));
1087 struct ParamTraits
<mozilla::MultiTouchInput::MultiTouchType
>
1088 : public ContiguousEnumSerializerInclusive
<
1089 mozilla::MultiTouchInput::MultiTouchType
,
1090 mozilla::MultiTouchInput::MultiTouchType::MULTITOUCH_START
,
1091 mozilla::MultiTouchInput::sHighestMultiTouchType
> {};
1094 struct ParamTraits
<mozilla::MultiTouchInput
> {
1095 using paramType
= mozilla::MultiTouchInput
;
1097 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1098 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1099 WriteParam(aWriter
, aParam
.mType
);
1100 WriteParam(aWriter
, aParam
.mTouches
);
1101 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1102 WriteParam(aWriter
, aParam
.mScreenOffset
);
1103 WriteParam(aWriter
, aParam
.mButton
);
1104 WriteParam(aWriter
, aParam
.mButtons
);
1107 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1108 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1109 ReadParam(aReader
, &aResult
->mType
) &&
1110 ReadParam(aReader
, &aResult
->mTouches
) &&
1111 ReadParam(aReader
, &aResult
->mHandledByAPZ
) &&
1112 ReadParam(aReader
, &aResult
->mScreenOffset
) &&
1113 ReadParam(aReader
, &aResult
->mButton
) &&
1114 ReadParam(aReader
, &aResult
->mButtons
);
1119 struct ParamTraits
<mozilla::MouseInput::MouseType
>
1120 : public ContiguousEnumSerializerInclusive
<
1121 mozilla::MouseInput::MouseType
,
1122 mozilla::MouseInput::MouseType::MOUSE_NONE
,
1123 mozilla::MouseInput::sHighestMouseType
> {};
1126 struct ParamTraits
<mozilla::MouseInput::ButtonType
>
1127 : public ContiguousEnumSerializerInclusive
<
1128 mozilla::MouseInput::ButtonType
,
1129 mozilla::MouseInput::ButtonType::PRIMARY_BUTTON
,
1130 mozilla::MouseInput::sHighestButtonType
> {};
1133 struct ParamTraits
<mozilla::MouseInput
> {
1134 using paramType
= mozilla::MouseInput
;
1136 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1137 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1138 WriteParam(aWriter
, aParam
.mButtonType
);
1139 WriteParam(aWriter
, aParam
.mType
);
1140 WriteParam(aWriter
, aParam
.mInputSource
);
1141 WriteParam(aWriter
, aParam
.mButtons
);
1142 WriteParam(aWriter
, aParam
.mOrigin
);
1143 WriteParam(aWriter
, aParam
.mLocalOrigin
);
1144 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1145 WriteParam(aWriter
, aParam
.mPreventClickEvent
);
1148 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1149 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1150 ReadParam(aReader
, &aResult
->mButtonType
) &&
1151 ReadParam(aReader
, &aResult
->mType
) &&
1152 ReadParam(aReader
, &aResult
->mInputSource
) &&
1153 ReadParam(aReader
, &aResult
->mButtons
) &&
1154 ReadParam(aReader
, &aResult
->mOrigin
) &&
1155 ReadParam(aReader
, &aResult
->mLocalOrigin
) &&
1156 ReadParam(aReader
, &aResult
->mHandledByAPZ
) &&
1157 ReadParam(aReader
, &aResult
->mPreventClickEvent
);
1162 struct ParamTraits
<mozilla::PanGestureInput::PanGestureType
>
1163 : public ContiguousEnumSerializerInclusive
<
1164 mozilla::PanGestureInput::PanGestureType
,
1165 mozilla::PanGestureInput::PanGestureType::PANGESTURE_MAYSTART
,
1166 mozilla::PanGestureInput::sHighestPanGestureType
> {};
1169 struct ParamTraits
<mozilla::PanGestureInput::PanDeltaType
>
1170 : public ContiguousEnumSerializerInclusive
<
1171 mozilla::PanGestureInput::PanDeltaType
,
1172 mozilla::PanGestureInput::PanDeltaType::PANDELTA_PAGE
,
1173 mozilla::PanGestureInput::sHighestPanDeltaType
> {};
1176 struct ParamTraits
<mozilla::PanGestureInput
>
1177 : BitfieldHelper
<mozilla::PanGestureInput
> {
1178 using paramType
= mozilla::PanGestureInput
;
1180 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1181 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1182 WriteParam(aWriter
, aParam
.mType
);
1183 WriteParam(aWriter
, aParam
.mPanStartPoint
);
1184 WriteParam(aWriter
, aParam
.mPanDisplacement
);
1185 WriteParam(aWriter
, aParam
.mLocalPanStartPoint
);
1186 WriteParam(aWriter
, aParam
.mLocalPanDisplacement
);
1187 WriteParam(aWriter
, aParam
.mLineOrPageDeltaX
);
1188 WriteParam(aWriter
, aParam
.mLineOrPageDeltaY
);
1189 WriteParam(aWriter
, aParam
.mUserDeltaMultiplierX
);
1190 WriteParam(aWriter
, aParam
.mUserDeltaMultiplierY
);
1191 WriteParam(aWriter
, aParam
.mDeltaType
);
1192 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1193 WriteParam(aWriter
, aParam
.mMayTriggerSwipe
);
1194 WriteParam(aWriter
, aParam
.mOverscrollBehaviorAllowsSwipe
);
1195 WriteParam(aWriter
, aParam
.mSimulateMomentum
);
1196 WriteParam(aWriter
, aParam
.mIsNoLineOrPageDelta
);
1199 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1200 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1201 ReadParam(aReader
, &aResult
->mType
) &&
1202 ReadParam(aReader
, &aResult
->mPanStartPoint
) &&
1203 ReadParam(aReader
, &aResult
->mPanDisplacement
) &&
1204 ReadParam(aReader
, &aResult
->mLocalPanStartPoint
) &&
1205 ReadParam(aReader
, &aResult
->mLocalPanDisplacement
) &&
1206 ReadParam(aReader
, &aResult
->mLineOrPageDeltaX
) &&
1207 ReadParam(aReader
, &aResult
->mLineOrPageDeltaY
) &&
1208 ReadParam(aReader
, &aResult
->mUserDeltaMultiplierX
) &&
1209 ReadParam(aReader
, &aResult
->mUserDeltaMultiplierY
) &&
1210 ReadParam(aReader
, &aResult
->mDeltaType
) &&
1211 ReadBoolForBitfield(aReader
, aResult
, ¶mType::SetHandledByAPZ
) &&
1212 ReadBoolForBitfield(aReader
, aResult
,
1213 ¶mType::SetMayTriggerSwipe
) &&
1214 ReadBoolForBitfield(aReader
, aResult
,
1215 ¶mType::SetOverscrollBehaviorAllowsSwipe
) &&
1216 ReadBoolForBitfield(aReader
, aResult
,
1217 ¶mType::SetSimulateMomentum
) &&
1218 ReadBoolForBitfield(aReader
, aResult
,
1219 ¶mType::SetIsNoLineOrPageDelta
);
1224 struct ParamTraits
<mozilla::PinchGestureInput::PinchGestureType
>
1225 : public ContiguousEnumSerializerInclusive
<
1226 mozilla::PinchGestureInput::PinchGestureType
,
1227 mozilla::PinchGestureInput::PinchGestureType::PINCHGESTURE_START
,
1228 mozilla::PinchGestureInput::sHighestPinchGestureType
> {};
1231 struct ParamTraits
<mozilla::PinchGestureInput::PinchGestureSource
>
1232 : public ContiguousEnumSerializerInclusive
<
1233 mozilla::PinchGestureInput::PinchGestureSource
,
1234 // Set the min to TOUCH, to ensure UNKNOWN is never sent over IPC
1235 mozilla::PinchGestureInput::PinchGestureSource::TOUCH
,
1236 mozilla::PinchGestureInput::sHighestPinchGestureSource
> {};
1239 struct ParamTraits
<mozilla::PinchGestureInput
> {
1240 using paramType
= mozilla::PinchGestureInput
;
1242 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1243 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1244 WriteParam(aWriter
, aParam
.mType
);
1245 WriteParam(aWriter
, aParam
.mSource
);
1246 WriteParam(aWriter
, aParam
.mScreenOffset
);
1247 WriteParam(aWriter
, aParam
.mFocusPoint
);
1248 WriteParam(aWriter
, aParam
.mLocalFocusPoint
);
1249 WriteParam(aWriter
, aParam
.mCurrentSpan
);
1250 WriteParam(aWriter
, aParam
.mPreviousSpan
);
1251 WriteParam(aWriter
, aParam
.mLineOrPageDeltaY
);
1252 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1255 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1256 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1257 ReadParam(aReader
, &aResult
->mType
) &&
1258 ReadParam(aReader
, &aResult
->mSource
) &&
1259 ReadParam(aReader
, &aResult
->mScreenOffset
) &&
1260 ReadParam(aReader
, &aResult
->mFocusPoint
) &&
1261 ReadParam(aReader
, &aResult
->mLocalFocusPoint
) &&
1262 ReadParam(aReader
, &aResult
->mCurrentSpan
) &&
1263 ReadParam(aReader
, &aResult
->mPreviousSpan
) &&
1264 ReadParam(aReader
, &aResult
->mLineOrPageDeltaY
) &&
1265 ReadParam(aReader
, &aResult
->mHandledByAPZ
);
1270 struct ParamTraits
<mozilla::TapGestureInput::TapGestureType
>
1271 : public ContiguousEnumSerializerInclusive
<
1272 mozilla::TapGestureInput::TapGestureType
,
1273 mozilla::TapGestureInput::TapGestureType::TAPGESTURE_LONG
,
1274 mozilla::TapGestureInput::sHighestTapGestureType
> {};
1277 struct ParamTraits
<mozilla::TapGestureInput
> {
1278 using paramType
= mozilla::TapGestureInput
;
1280 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1281 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1282 WriteParam(aWriter
, aParam
.mType
);
1283 WriteParam(aWriter
, aParam
.mPoint
);
1284 WriteParam(aWriter
, aParam
.mLocalPoint
);
1287 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1288 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1289 ReadParam(aReader
, &aResult
->mType
) &&
1290 ReadParam(aReader
, &aResult
->mPoint
) &&
1291 ReadParam(aReader
, &aResult
->mLocalPoint
);
1296 struct ParamTraits
<mozilla::ScrollWheelInput::ScrollDeltaType
>
1297 : public ContiguousEnumSerializerInclusive
<
1298 mozilla::ScrollWheelInput::ScrollDeltaType
,
1299 mozilla::ScrollWheelInput::ScrollDeltaType::SCROLLDELTA_LINE
,
1300 mozilla::ScrollWheelInput::sHighestScrollDeltaType
> {};
1303 struct ParamTraits
<mozilla::ScrollWheelInput::ScrollMode
>
1304 : public ContiguousEnumSerializerInclusive
<
1305 mozilla::ScrollWheelInput::ScrollMode
,
1306 mozilla::ScrollWheelInput::ScrollMode::SCROLLMODE_INSTANT
,
1307 mozilla::ScrollWheelInput::sHighestScrollMode
> {};
1310 struct ParamTraits
<mozilla::WheelDeltaAdjustmentStrategy
>
1311 : public ContiguousEnumSerializer
<
1312 mozilla::WheelDeltaAdjustmentStrategy
,
1313 mozilla::WheelDeltaAdjustmentStrategy(0),
1314 mozilla::WheelDeltaAdjustmentStrategy::eSentinel
> {};
1317 struct ParamTraits
<mozilla::layers::APZWheelAction
>
1318 : public ContiguousEnumSerializerInclusive
<
1319 mozilla::layers::APZWheelAction
,
1320 mozilla::layers::APZWheelAction::Scroll
,
1321 mozilla::layers::kHighestAPZWheelAction
> {};
1324 struct ParamTraits
<mozilla::ScrollWheelInput
> {
1325 using paramType
= mozilla::ScrollWheelInput
;
1327 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1328 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1329 WriteParam(aWriter
, aParam
.mDeltaType
);
1330 WriteParam(aWriter
, aParam
.mScrollMode
);
1331 WriteParam(aWriter
, aParam
.mOrigin
);
1332 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1333 WriteParam(aWriter
, aParam
.mDeltaX
);
1334 WriteParam(aWriter
, aParam
.mDeltaY
);
1335 WriteParam(aWriter
, aParam
.mWheelTicksX
);
1336 WriteParam(aWriter
, aParam
.mWheelTicksY
);
1337 WriteParam(aWriter
, aParam
.mLocalOrigin
);
1338 WriteParam(aWriter
, aParam
.mLineOrPageDeltaX
);
1339 WriteParam(aWriter
, aParam
.mLineOrPageDeltaY
);
1340 WriteParam(aWriter
, aParam
.mScrollSeriesNumber
);
1341 WriteParam(aWriter
, aParam
.mUserDeltaMultiplierX
);
1342 WriteParam(aWriter
, aParam
.mUserDeltaMultiplierY
);
1343 WriteParam(aWriter
, aParam
.mMayHaveMomentum
);
1344 WriteParam(aWriter
, aParam
.mIsMomentum
);
1345 WriteParam(aWriter
, aParam
.mAllowToOverrideSystemScrollSpeed
);
1346 WriteParam(aWriter
, aParam
.mWheelDeltaAdjustmentStrategy
);
1347 WriteParam(aWriter
, aParam
.mAPZAction
);
1350 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1351 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1352 ReadParam(aReader
, &aResult
->mDeltaType
) &&
1353 ReadParam(aReader
, &aResult
->mScrollMode
) &&
1354 ReadParam(aReader
, &aResult
->mOrigin
) &&
1355 ReadParam(aReader
, &aResult
->mHandledByAPZ
) &&
1356 ReadParam(aReader
, &aResult
->mDeltaX
) &&
1357 ReadParam(aReader
, &aResult
->mDeltaY
) &&
1358 ReadParam(aReader
, &aResult
->mWheelTicksX
) &&
1359 ReadParam(aReader
, &aResult
->mWheelTicksY
) &&
1360 ReadParam(aReader
, &aResult
->mLocalOrigin
) &&
1361 ReadParam(aReader
, &aResult
->mLineOrPageDeltaX
) &&
1362 ReadParam(aReader
, &aResult
->mLineOrPageDeltaY
) &&
1363 ReadParam(aReader
, &aResult
->mScrollSeriesNumber
) &&
1364 ReadParam(aReader
, &aResult
->mUserDeltaMultiplierX
) &&
1365 ReadParam(aReader
, &aResult
->mUserDeltaMultiplierY
) &&
1366 ReadParam(aReader
, &aResult
->mMayHaveMomentum
) &&
1367 ReadParam(aReader
, &aResult
->mIsMomentum
) &&
1368 ReadParam(aReader
, &aResult
->mAllowToOverrideSystemScrollSpeed
) &&
1369 ReadParam(aReader
, &aResult
->mWheelDeltaAdjustmentStrategy
) &&
1370 ReadParam(aReader
, &aResult
->mAPZAction
);
1375 struct ParamTraits
<mozilla::KeyboardInput::KeyboardEventType
>
1376 : public ContiguousEnumSerializer
<
1377 mozilla::KeyboardInput::KeyboardEventType
,
1378 mozilla::KeyboardInput::KeyboardEventType::KEY_DOWN
,
1379 mozilla::KeyboardInput::KeyboardEventType::KEY_SENTINEL
> {};
1382 struct ParamTraits
<mozilla::KeyboardInput
> {
1383 using paramType
= mozilla::KeyboardInput
;
1385 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1386 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1387 WriteParam(aWriter
, aParam
.mType
);
1388 WriteParam(aWriter
, aParam
.mKeyCode
);
1389 WriteParam(aWriter
, aParam
.mCharCode
);
1390 WriteParam(aWriter
, aParam
.mShortcutCandidates
);
1391 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1394 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1395 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1396 ReadParam(aReader
, &aResult
->mType
) &&
1397 ReadParam(aReader
, &aResult
->mKeyCode
) &&
1398 ReadParam(aReader
, &aResult
->mCharCode
) &&
1399 ReadParam(aReader
, &aResult
->mShortcutCandidates
) &&
1400 ReadParam(aReader
, &aResult
->mHandledByAPZ
);
1406 #endif // nsGUIEventIPC_h__