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
);
275 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
277 ReadParam(aReader
, static_cast<mozilla::WidgetMouseEvent
*>(aResult
)) &&
278 ReadParam(aReader
, &aResult
->mUserCancelled
) &&
279 ReadParam(aReader
, &aResult
->mDefaultPreventedOnContent
);
285 struct ParamTraits
<mozilla::WidgetPointerEvent
> {
286 using paramType
= mozilla::WidgetPointerEvent
;
288 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
289 WriteParam(aWriter
, static_cast<const mozilla::WidgetMouseEvent
&>(aParam
));
290 WriteParam(aWriter
, aParam
.mWidth
);
291 WriteParam(aWriter
, aParam
.mHeight
);
292 WriteParam(aWriter
, aParam
.mIsPrimary
);
295 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
297 ReadParam(aReader
, static_cast<mozilla::WidgetMouseEvent
*>(aResult
)) &&
298 ReadParam(aReader
, &aResult
->mWidth
) &&
299 ReadParam(aReader
, &aResult
->mHeight
) &&
300 ReadParam(aReader
, &aResult
->mIsPrimary
);
306 struct ParamTraits
<mozilla::WidgetTouchEvent
> {
307 using paramType
= mozilla::WidgetTouchEvent
;
309 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
310 WriteParam(aWriter
, static_cast<const mozilla::WidgetInputEvent
&>(aParam
));
311 WriteParam(aWriter
, aParam
.mInputSource
);
312 WriteParam(aWriter
, aParam
.mButton
);
313 WriteParam(aWriter
, aParam
.mButtons
);
314 // Sigh, Touch bites us again! We want to be able to do
315 // WriteParam(aWriter, aParam.mTouches);
316 const paramType::TouchArray
& touches
= aParam
.mTouches
;
317 WriteParam(aWriter
, touches
.Length());
318 for (uint32_t i
= 0; i
< touches
.Length(); ++i
) {
319 mozilla::dom::Touch
* touch
= touches
[i
];
320 WriteParam(aWriter
, touch
->mIdentifier
);
321 WriteParam(aWriter
, touch
->mRefPoint
);
322 WriteParam(aWriter
, touch
->mRadius
);
323 WriteParam(aWriter
, touch
->mRotationAngle
);
324 WriteParam(aWriter
, touch
->mForce
);
325 WriteParam(aWriter
, touch
->tiltX
);
326 WriteParam(aWriter
, touch
->tiltY
);
327 WriteParam(aWriter
, touch
->twist
);
331 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
332 paramType::TouchArray::size_type numTouches
;
333 if (!ReadParam(aReader
, static_cast<mozilla::WidgetInputEvent
*>(aResult
)) ||
334 !ReadParam(aReader
, &aResult
->mInputSource
) ||
335 !ReadParam(aReader
, &aResult
->mButton
) ||
336 !ReadParam(aReader
, &aResult
->mButtons
) ||
337 !ReadParam(aReader
, &numTouches
)) {
340 for (uint32_t i
= 0; i
< numTouches
; ++i
) {
342 mozilla::LayoutDeviceIntPoint refPoint
;
343 mozilla::LayoutDeviceIntPoint radius
;
349 if (!ReadParam(aReader
, &identifier
) || !ReadParam(aReader
, &refPoint
) ||
350 !ReadParam(aReader
, &radius
) || !ReadParam(aReader
, &rotationAngle
) ||
351 !ReadParam(aReader
, &force
) || !ReadParam(aReader
, &tiltX
) ||
352 !ReadParam(aReader
, &tiltY
) || !ReadParam(aReader
, &twist
)) {
355 auto* touch
= new mozilla::dom::Touch(identifier
, refPoint
, radius
,
356 rotationAngle
, force
);
357 touch
->tiltX
= tiltX
;
358 touch
->tiltY
= tiltY
;
359 touch
->twist
= twist
;
360 aResult
->mTouches
.AppendElement(touch
);
367 struct ParamTraits
<mozilla::AlternativeCharCode
> {
368 using paramType
= mozilla::AlternativeCharCode
;
370 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
371 WriteParam(aWriter
, aParam
.mUnshiftedCharCode
);
372 WriteParam(aWriter
, aParam
.mShiftedCharCode
);
375 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
376 return ReadParam(aReader
, &aResult
->mUnshiftedCharCode
) &&
377 ReadParam(aReader
, &aResult
->mShiftedCharCode
);
382 struct ParamTraits
<mozilla::ShortcutKeyCandidate::ShiftState
>
383 : public ContiguousEnumSerializerInclusive
<
384 mozilla::ShortcutKeyCandidate::ShiftState
,
385 mozilla::ShortcutKeyCandidate::ShiftState::Ignorable
,
386 mozilla::ShortcutKeyCandidate::ShiftState::MatchExactly
> {};
389 struct ParamTraits
<mozilla::ShortcutKeyCandidate::SkipIfEarlierHandlerDisabled
>
390 : public ContiguousEnumSerializerInclusive
<
391 mozilla::ShortcutKeyCandidate::SkipIfEarlierHandlerDisabled
,
392 mozilla::ShortcutKeyCandidate::SkipIfEarlierHandlerDisabled::No
,
393 mozilla::ShortcutKeyCandidate::SkipIfEarlierHandlerDisabled::Yes
> {};
396 struct ParamTraits
<mozilla::ShortcutKeyCandidate
> {
397 using paramType
= mozilla::ShortcutKeyCandidate
;
399 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
400 WriteParam(aWriter
, aParam
.mCharCode
);
401 WriteParam(aWriter
, aParam
.mShiftState
);
402 WriteParam(aWriter
, aParam
.mSkipIfEarlierHandlerDisabled
);
405 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
406 return ReadParam(aReader
, &aResult
->mCharCode
) &&
407 ReadParam(aReader
, &aResult
->mShiftState
) &&
408 ReadParam(aReader
, &aResult
->mSkipIfEarlierHandlerDisabled
);
413 struct ParamTraits
<mozilla::WidgetKeyboardEvent
> {
414 using paramType
= mozilla::WidgetKeyboardEvent
;
416 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
417 WriteParam(aWriter
, static_cast<const mozilla::WidgetInputEvent
&>(aParam
));
419 static_cast<mozilla::KeyNameIndexType
>(aParam
.mKeyNameIndex
));
421 static_cast<mozilla::CodeNameIndexType
>(aParam
.mCodeNameIndex
));
422 WriteParam(aWriter
, aParam
.mKeyValue
);
423 WriteParam(aWriter
, aParam
.mCodeValue
);
424 WriteParam(aWriter
, aParam
.mKeyCode
);
425 WriteParam(aWriter
, aParam
.mCharCode
);
426 WriteParam(aWriter
, aParam
.mPseudoCharCode
);
427 WriteParam(aWriter
, aParam
.mAlternativeCharCodes
);
428 WriteParam(aWriter
, aParam
.mIsRepeat
);
429 WriteParam(aWriter
, aParam
.mLocation
);
430 WriteParam(aWriter
, aParam
.mUniqueId
);
431 WriteParam(aWriter
, aParam
.mIsSynthesizedByTIP
);
432 WriteParam(aWriter
, aParam
.mMaybeSkippableInRemoteProcess
);
434 // An OS-specific native event might be attached in |mNativeKeyEvent|, but
435 // that cannot be copied across process boundaries.
437 WriteParam(aWriter
, aParam
.mEditCommandsForSingleLineEditor
);
438 WriteParam(aWriter
, aParam
.mEditCommandsForMultiLineEditor
);
439 WriteParam(aWriter
, aParam
.mEditCommandsForRichTextEditor
);
440 WriteParam(aWriter
, aParam
.mEditCommandsForSingleLineEditorInitialized
);
441 WriteParam(aWriter
, aParam
.mEditCommandsForMultiLineEditorInitialized
);
442 WriteParam(aWriter
, aParam
.mEditCommandsForRichTextEditorInitialized
);
445 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
446 mozilla::KeyNameIndexType keyNameIndex
= 0;
447 mozilla::CodeNameIndexType codeNameIndex
= 0;
448 if (ReadParam(aReader
, static_cast<mozilla::WidgetInputEvent
*>(aResult
)) &&
449 ReadParam(aReader
, &keyNameIndex
) &&
450 ReadParam(aReader
, &codeNameIndex
) &&
451 ReadParam(aReader
, &aResult
->mKeyValue
) &&
452 ReadParam(aReader
, &aResult
->mCodeValue
) &&
453 ReadParam(aReader
, &aResult
->mKeyCode
) &&
454 ReadParam(aReader
, &aResult
->mCharCode
) &&
455 ReadParam(aReader
, &aResult
->mPseudoCharCode
) &&
456 ReadParam(aReader
, &aResult
->mAlternativeCharCodes
) &&
457 ReadParam(aReader
, &aResult
->mIsRepeat
) &&
458 ReadParam(aReader
, &aResult
->mLocation
) &&
459 ReadParam(aReader
, &aResult
->mUniqueId
) &&
460 ReadParam(aReader
, &aResult
->mIsSynthesizedByTIP
) &&
461 ReadParam(aReader
, &aResult
->mMaybeSkippableInRemoteProcess
) &&
462 ReadParam(aReader
, &aResult
->mEditCommandsForSingleLineEditor
) &&
463 ReadParam(aReader
, &aResult
->mEditCommandsForMultiLineEditor
) &&
464 ReadParam(aReader
, &aResult
->mEditCommandsForRichTextEditor
) &&
466 &aResult
->mEditCommandsForSingleLineEditorInitialized
) &&
468 &aResult
->mEditCommandsForMultiLineEditorInitialized
) &&
470 &aResult
->mEditCommandsForRichTextEditorInitialized
)) {
471 aResult
->mKeyNameIndex
= static_cast<mozilla::KeyNameIndex
>(keyNameIndex
);
472 aResult
->mCodeNameIndex
=
473 static_cast<mozilla::CodeNameIndex
>(codeNameIndex
);
474 aResult
->mNativeKeyEvent
= nullptr;
482 struct ParamTraits
<mozilla::TextRangeStyle
> {
483 using paramType
= mozilla::TextRangeStyle
;
485 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
486 WriteParam(aWriter
, aParam
.mDefinedStyles
);
487 WriteParam(aWriter
, static_cast<mozilla::TextRangeStyle::LineStyleType
>(
489 WriteParam(aWriter
, aParam
.mIsBoldLine
);
490 WriteParam(aWriter
, aParam
.mForegroundColor
);
491 WriteParam(aWriter
, aParam
.mBackgroundColor
);
492 WriteParam(aWriter
, aParam
.mUnderlineColor
);
495 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
496 mozilla::TextRangeStyle::LineStyleType lineStyle
;
497 if (!ReadParam(aReader
, &aResult
->mDefinedStyles
) ||
498 !ReadParam(aReader
, &lineStyle
) ||
499 !ReadParam(aReader
, &aResult
->mIsBoldLine
) ||
500 !ReadParam(aReader
, &aResult
->mForegroundColor
) ||
501 !ReadParam(aReader
, &aResult
->mBackgroundColor
) ||
502 !ReadParam(aReader
, &aResult
->mUnderlineColor
)) {
505 aResult
->mLineStyle
= mozilla::TextRangeStyle::ToLineStyle(lineStyle
);
511 struct ParamTraits
<mozilla::TextRange
> {
512 using paramType
= mozilla::TextRange
;
514 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
515 WriteParam(aWriter
, aParam
.mStartOffset
);
516 WriteParam(aWriter
, aParam
.mEndOffset
);
517 WriteParam(aWriter
, mozilla::ToRawTextRangeType(aParam
.mRangeType
));
518 WriteParam(aWriter
, aParam
.mRangeStyle
);
521 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
522 mozilla::RawTextRangeType rawTextRangeType
;
523 if (ReadParam(aReader
, &aResult
->mStartOffset
) &&
524 ReadParam(aReader
, &aResult
->mEndOffset
) &&
525 ReadParam(aReader
, &rawTextRangeType
) &&
526 ReadParam(aReader
, &aResult
->mRangeStyle
)) {
527 aResult
->mRangeType
= mozilla::ToTextRangeType(rawTextRangeType
);
535 struct ParamTraits
<mozilla::TextRangeArray
> {
536 using paramType
= mozilla::TextRangeArray
;
538 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
539 WriteParam(aWriter
, aParam
.Length());
540 for (uint32_t index
= 0; index
< aParam
.Length(); index
++) {
541 WriteParam(aWriter
, aParam
[index
]);
545 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
546 paramType::size_type length
;
547 if (!ReadParam(aReader
, &length
)) {
550 for (uint32_t index
= 0; index
< length
; index
++) {
551 mozilla::TextRange textRange
;
552 if (!ReadParam(aReader
, &textRange
)) {
556 aResult
->AppendElement(textRange
);
563 struct ParamTraits
<mozilla::WidgetCompositionEvent
> {
564 using paramType
= mozilla::WidgetCompositionEvent
;
566 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
567 WriteParam(aWriter
, static_cast<const mozilla::WidgetGUIEvent
&>(aParam
));
568 WriteParam(aWriter
, aParam
.mData
);
569 WriteParam(aWriter
, aParam
.mNativeIMEContext
);
570 WriteParam(aWriter
, aParam
.mCompositionId
);
571 bool hasRanges
= !!aParam
.mRanges
;
572 WriteParam(aWriter
, hasRanges
);
574 WriteParam(aWriter
, *aParam
.mRanges
.get());
578 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
580 if (!ReadParam(aReader
, static_cast<mozilla::WidgetGUIEvent
*>(aResult
)) ||
581 !ReadParam(aReader
, &aResult
->mData
) ||
582 !ReadParam(aReader
, &aResult
->mNativeIMEContext
) ||
583 !ReadParam(aReader
, &aResult
->mCompositionId
) ||
584 !ReadParam(aReader
, &hasRanges
)) {
589 aResult
->mRanges
= nullptr;
591 aResult
->mRanges
= new mozilla::TextRangeArray();
592 if (!ReadParam(aReader
, aResult
->mRanges
.get())) {
601 struct ParamTraits
<mozilla::FontRange
> {
602 using paramType
= mozilla::FontRange
;
604 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
605 WriteParam(aWriter
, aParam
.mStartOffset
);
606 WriteParam(aWriter
, aParam
.mFontName
);
607 WriteParam(aWriter
, aParam
.mFontSize
);
610 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
611 return ReadParam(aReader
, &aResult
->mStartOffset
) &&
612 ReadParam(aReader
, &aResult
->mFontName
) &&
613 ReadParam(aReader
, &aResult
->mFontSize
);
618 struct ParamTraits
<mozilla::WidgetSelectionEvent
> {
619 using paramType
= mozilla::WidgetSelectionEvent
;
621 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
622 WriteParam(aWriter
, static_cast<const mozilla::WidgetGUIEvent
&>(aParam
));
623 WriteParam(aWriter
, aParam
.mOffset
);
624 WriteParam(aWriter
, aParam
.mLength
);
625 WriteParam(aWriter
, aParam
.mReversed
);
626 WriteParam(aWriter
, aParam
.mExpandToClusterBoundary
);
627 WriteParam(aWriter
, aParam
.mSucceeded
);
628 WriteParam(aWriter
, aParam
.mUseNativeLineBreak
);
631 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
632 return ReadParam(aReader
, static_cast<mozilla::WidgetGUIEvent
*>(aResult
)) &&
633 ReadParam(aReader
, &aResult
->mOffset
) &&
634 ReadParam(aReader
, &aResult
->mLength
) &&
635 ReadParam(aReader
, &aResult
->mReversed
) &&
636 ReadParam(aReader
, &aResult
->mExpandToClusterBoundary
) &&
637 ReadParam(aReader
, &aResult
->mSucceeded
) &&
638 ReadParam(aReader
, &aResult
->mUseNativeLineBreak
);
643 struct ParamTraits
<mozilla::widget::IMENotificationRequests
> {
644 using paramType
= mozilla::widget::IMENotificationRequests
;
646 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
647 WriteParam(aWriter
, aParam
.mWantUpdates
);
650 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
651 return ReadParam(aReader
, &aResult
->mWantUpdates
);
656 struct ParamTraits
<mozilla::widget::NativeIMEContext
> {
657 using paramType
= mozilla::widget::NativeIMEContext
;
659 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
660 WriteParam(aWriter
, aParam
.mRawNativeIMEContext
);
661 WriteParam(aWriter
, aParam
.mOriginProcessID
);
664 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
665 return ReadParam(aReader
, &aResult
->mRawNativeIMEContext
) &&
666 ReadParam(aReader
, &aResult
->mOriginProcessID
);
671 struct ParamTraits
<mozilla::widget::IMENotification::SelectionChangeDataBase
> {
672 using paramType
= mozilla::widget::IMENotification::SelectionChangeDataBase
;
674 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
675 MOZ_RELEASE_ASSERT(aParam
.mString
);
676 WriteParam(aWriter
, aParam
.mOffset
);
677 WriteParam(aWriter
, *aParam
.mString
);
678 WriteParam(aWriter
, aParam
.mWritingModeBits
);
679 WriteParam(aWriter
, aParam
.mIsInitialized
);
680 WriteParam(aWriter
, aParam
.mHasRange
);
681 WriteParam(aWriter
, aParam
.mReversed
);
682 WriteParam(aWriter
, aParam
.mCausedByComposition
);
683 WriteParam(aWriter
, aParam
.mCausedBySelectionEvent
);
684 WriteParam(aWriter
, aParam
.mOccurredDuringComposition
);
687 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
688 aResult
->mString
= new nsString();
689 return ReadParam(aReader
, &aResult
->mOffset
) &&
690 ReadParam(aReader
, aResult
->mString
) &&
691 ReadParam(aReader
, &aResult
->mWritingModeBits
) &&
692 ReadParam(aReader
, &aResult
->mIsInitialized
) &&
693 ReadParam(aReader
, &aResult
->mHasRange
) &&
694 ReadParam(aReader
, &aResult
->mReversed
) &&
695 ReadParam(aReader
, &aResult
->mCausedByComposition
) &&
696 ReadParam(aReader
, &aResult
->mCausedBySelectionEvent
) &&
697 ReadParam(aReader
, &aResult
->mOccurredDuringComposition
);
702 struct ParamTraits
<mozilla::widget::IMENotification::TextChangeDataBase
> {
703 using paramType
= mozilla::widget::IMENotification::TextChangeDataBase
;
705 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
706 WriteParam(aWriter
, aParam
.mStartOffset
);
707 WriteParam(aWriter
, aParam
.mRemovedEndOffset
);
708 WriteParam(aWriter
, aParam
.mAddedEndOffset
);
709 WriteParam(aWriter
, aParam
.mCausedOnlyByComposition
);
710 WriteParam(aWriter
, aParam
.mIncludingChangesDuringComposition
);
711 WriteParam(aWriter
, aParam
.mIncludingChangesWithoutComposition
);
714 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
715 return ReadParam(aReader
, &aResult
->mStartOffset
) &&
716 ReadParam(aReader
, &aResult
->mRemovedEndOffset
) &&
717 ReadParam(aReader
, &aResult
->mAddedEndOffset
) &&
718 ReadParam(aReader
, &aResult
->mCausedOnlyByComposition
) &&
719 ReadParam(aReader
, &aResult
->mIncludingChangesDuringComposition
) &&
720 ReadParam(aReader
, &aResult
->mIncludingChangesWithoutComposition
);
725 struct ParamTraits
<mozilla::widget::IMENotification::MouseButtonEventData
> {
726 using paramType
= mozilla::widget::IMENotification::MouseButtonEventData
;
728 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
729 WriteParam(aWriter
, aParam
.mEventMessage
);
730 WriteParam(aWriter
, aParam
.mOffset
);
731 WriteParam(aWriter
, aParam
.mCursorPos
);
732 WriteParam(aWriter
, aParam
.mCharRect
);
733 WriteParam(aWriter
, aParam
.mButton
);
734 WriteParam(aWriter
, aParam
.mButtons
);
735 WriteParam(aWriter
, aParam
.mModifiers
);
738 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
739 return ReadParam(aReader
, &aResult
->mEventMessage
) &&
740 ReadParam(aReader
, &aResult
->mOffset
) &&
741 ReadParam(aReader
, &aResult
->mCursorPos
) &&
742 ReadParam(aReader
, &aResult
->mCharRect
) &&
743 ReadParam(aReader
, &aResult
->mButton
) &&
744 ReadParam(aReader
, &aResult
->mButtons
) &&
745 ReadParam(aReader
, &aResult
->mModifiers
);
750 struct ParamTraits
<mozilla::widget::IMENotification
> {
751 using paramType
= mozilla::widget::IMENotification
;
753 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
755 static_cast<mozilla::widget::IMEMessageType
>(aParam
.mMessage
));
756 switch (aParam
.mMessage
) {
757 case mozilla::widget::NOTIFY_IME_OF_SELECTION_CHANGE
:
758 WriteParam(aWriter
, aParam
.mSelectionChangeData
);
760 case mozilla::widget::NOTIFY_IME_OF_TEXT_CHANGE
:
761 WriteParam(aWriter
, aParam
.mTextChangeData
);
763 case mozilla::widget::NOTIFY_IME_OF_MOUSE_BUTTON_EVENT
:
764 WriteParam(aWriter
, aParam
.mMouseButtonEventData
);
771 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
772 mozilla::widget::IMEMessageType IMEMessage
= 0;
773 if (!ReadParam(aReader
, &IMEMessage
)) {
776 aResult
->mMessage
= static_cast<mozilla::widget::IMEMessage
>(IMEMessage
);
777 switch (aResult
->mMessage
) {
778 case mozilla::widget::NOTIFY_IME_OF_SELECTION_CHANGE
:
779 return ReadParam(aReader
, &aResult
->mSelectionChangeData
);
780 case mozilla::widget::NOTIFY_IME_OF_TEXT_CHANGE
:
781 return ReadParam(aReader
, &aResult
->mTextChangeData
);
782 case mozilla::widget::NOTIFY_IME_OF_MOUSE_BUTTON_EVENT
:
783 return ReadParam(aReader
, &aResult
->mMouseButtonEventData
);
791 struct ParamTraits
<mozilla::widget::IMEEnabled
>
792 : ContiguousEnumSerializer
<mozilla::widget::IMEEnabled
,
793 mozilla::widget::IMEEnabled::Disabled
,
794 mozilla::widget::IMEEnabled::Unknown
> {};
797 struct ParamTraits
<mozilla::widget::IMEState::Open
>
798 : ContiguousEnumSerializerInclusive
<
799 mozilla::widget::IMEState::Open
,
800 mozilla::widget::IMEState::Open::OPEN_STATE_NOT_SUPPORTED
,
801 mozilla::widget::IMEState::Open::CLOSED
> {};
804 struct ParamTraits
<mozilla::widget::IMEState
> {
805 using paramType
= mozilla::widget::IMEState
;
807 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
808 WriteParam(aWriter
, aParam
.mEnabled
);
809 WriteParam(aWriter
, aParam
.mOpen
);
812 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
813 return ReadParam(aReader
, &aResult
->mEnabled
) &&
814 ReadParam(aReader
, &aResult
->mOpen
);
819 struct ParamTraits
<mozilla::widget::InputContext::Origin
>
820 : ContiguousEnumSerializerInclusive
<
821 mozilla::widget::InputContext::Origin
,
822 mozilla::widget::InputContext::Origin::ORIGIN_MAIN
,
823 mozilla::widget::InputContext::Origin::ORIGIN_CONTENT
> {};
826 struct ParamTraits
<mozilla::widget::InputContext
> {
827 using paramType
= mozilla::widget::InputContext
;
829 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
830 WriteParam(aWriter
, aParam
.mIMEState
);
831 WriteParam(aWriter
, aParam
.mHTMLInputType
);
832 WriteParam(aWriter
, aParam
.mHTMLInputMode
);
833 WriteParam(aWriter
, aParam
.mActionHint
);
834 WriteParam(aWriter
, aParam
.mAutocapitalize
);
835 WriteParam(aWriter
, aParam
.mOrigin
);
836 WriteParam(aWriter
, aParam
.mHasHandledUserInput
);
837 WriteParam(aWriter
, aParam
.mInPrivateBrowsing
);
838 mozilla::ipc::WriteIPDLParam(aWriter
, aWriter
->GetActor(), aParam
.mURI
);
841 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
842 return ReadParam(aReader
, &aResult
->mIMEState
) &&
843 ReadParam(aReader
, &aResult
->mHTMLInputType
) &&
844 ReadParam(aReader
, &aResult
->mHTMLInputMode
) &&
845 ReadParam(aReader
, &aResult
->mActionHint
) &&
846 ReadParam(aReader
, &aResult
->mAutocapitalize
) &&
847 ReadParam(aReader
, &aResult
->mOrigin
) &&
848 ReadParam(aReader
, &aResult
->mHasHandledUserInput
) &&
849 ReadParam(aReader
, &aResult
->mInPrivateBrowsing
) &&
850 mozilla::ipc::ReadIPDLParam(aReader
, aReader
->GetActor(),
851 address_of(aResult
->mURI
));
856 struct ParamTraits
<mozilla::widget::InputContextAction::Cause
>
857 : ContiguousEnumSerializerInclusive
<
858 mozilla::widget::InputContextAction::Cause
,
859 mozilla::widget::InputContextAction::Cause::CAUSE_UNKNOWN
,
860 mozilla::widget::InputContextAction::Cause::
861 CAUSE_UNKNOWN_DURING_KEYBOARD_INPUT
> {};
864 struct ParamTraits
<mozilla::widget::InputContextAction::FocusChange
>
865 : ContiguousEnumSerializerInclusive
<
866 mozilla::widget::InputContextAction::FocusChange
,
867 mozilla::widget::InputContextAction::FocusChange::FOCUS_NOT_CHANGED
,
868 mozilla::widget::InputContextAction::FocusChange::WIDGET_CREATED
> {};
871 struct ParamTraits
<mozilla::widget::InputContextAction
> {
872 using paramType
= mozilla::widget::InputContextAction
;
874 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
875 WriteParam(aWriter
, aParam
.mCause
);
876 WriteParam(aWriter
, aParam
.mFocusChange
);
879 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
880 return ReadParam(aReader
, &aResult
->mCause
) &&
881 ReadParam(aReader
, &aResult
->mFocusChange
);
886 struct ParamTraits
<mozilla::WritingMode
> {
887 using paramType
= mozilla::WritingMode
;
889 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
890 WriteParam(aWriter
, aParam
.mWritingMode
.bits
);
893 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
894 return ReadParam(aReader
, &aResult
->mWritingMode
.bits
);
899 struct ParamTraits
<mozilla::ContentCache::Selection
> {
900 using paramType
= mozilla::ContentCache::Selection
;
902 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
903 WriteParam(aWriter
, aParam
.mAnchor
);
904 WriteParam(aWriter
, aParam
.mFocus
);
905 WriteParam(aWriter
, aParam
.mWritingMode
);
906 WriteParam(aWriter
, aParam
.mHasRange
);
907 WriteParam(aWriter
, aParam
.mAnchorCharRects
[0]);
908 WriteParam(aWriter
, aParam
.mAnchorCharRects
[1]);
909 WriteParam(aWriter
, aParam
.mFocusCharRects
[0]);
910 WriteParam(aWriter
, aParam
.mFocusCharRects
[1]);
911 WriteParam(aWriter
, aParam
.mRect
);
914 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
915 return ReadParam(aReader
, &aResult
->mAnchor
) &&
916 ReadParam(aReader
, &aResult
->mFocus
) &&
917 ReadParam(aReader
, &aResult
->mWritingMode
) &&
918 ReadParam(aReader
, &aResult
->mHasRange
) &&
919 ReadParam(aReader
, &aResult
->mAnchorCharRects
[0]) &&
920 ReadParam(aReader
, &aResult
->mAnchorCharRects
[1]) &&
921 ReadParam(aReader
, &aResult
->mFocusCharRects
[0]) &&
922 ReadParam(aReader
, &aResult
->mFocusCharRects
[1]) &&
923 ReadParam(aReader
, &aResult
->mRect
);
928 struct ParamTraits
<mozilla::ContentCache::Caret
> {
929 using paramType
= mozilla::ContentCache::Caret
;
931 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
932 WriteParam(aWriter
, aParam
.mOffset
);
933 WriteParam(aWriter
, aParam
.mRect
);
936 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
937 return ReadParam(aReader
, &aResult
->mOffset
) &&
938 ReadParam(aReader
, &aResult
->mRect
);
943 struct ParamTraits
<mozilla::ContentCache::TextRectArray
> {
944 using paramType
= mozilla::ContentCache::TextRectArray
;
946 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
947 WriteParam(aWriter
, aParam
.mStart
);
948 WriteParam(aWriter
, aParam
.mRects
);
951 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
952 return ReadParam(aReader
, &aResult
->mStart
) &&
953 ReadParam(aReader
, &aResult
->mRects
);
958 struct ParamTraits
<mozilla::ContentCache
> {
959 using paramType
= mozilla::ContentCache
;
961 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
962 WriteParam(aWriter
, aParam
.mCompositionStart
);
963 WriteParam(aWriter
, aParam
.mText
);
964 WriteParam(aWriter
, aParam
.mSelection
);
965 WriteParam(aWriter
, aParam
.mFirstCharRect
);
966 WriteParam(aWriter
, aParam
.mCaret
);
967 WriteParam(aWriter
, aParam
.mTextRectArray
);
968 WriteParam(aWriter
, aParam
.mLastCommitStringTextRectArray
);
969 WriteParam(aWriter
, aParam
.mEditorRect
);
972 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
973 return ReadParam(aReader
, &aResult
->mCompositionStart
) &&
974 ReadParam(aReader
, &aResult
->mText
) &&
975 ReadParam(aReader
, &aResult
->mSelection
) &&
976 ReadParam(aReader
, &aResult
->mFirstCharRect
) &&
977 ReadParam(aReader
, &aResult
->mCaret
) &&
978 ReadParam(aReader
, &aResult
->mTextRectArray
) &&
979 ReadParam(aReader
, &aResult
->mLastCommitStringTextRectArray
) &&
980 ReadParam(aReader
, &aResult
->mEditorRect
);
985 struct ParamTraits
<mozilla::widget::CandidateWindowPosition
> {
986 using paramType
= mozilla::widget::CandidateWindowPosition
;
988 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
989 WriteParam(aWriter
, aParam
.mPoint
);
990 WriteParam(aWriter
, aParam
.mRect
);
991 WriteParam(aWriter
, aParam
.mExcludeRect
);
994 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
995 return ReadParam(aReader
, &aResult
->mPoint
) &&
996 ReadParam(aReader
, &aResult
->mRect
) &&
997 ReadParam(aReader
, &aResult
->mExcludeRect
);
1004 struct ParamTraits
<mozilla::InputType
>
1005 : public ContiguousEnumSerializerInclusive
<
1006 mozilla::InputType
, mozilla::InputType::MULTITOUCH_INPUT
,
1007 mozilla::kHighestInputType
> {};
1010 struct ParamTraits
<mozilla::InputData
> {
1011 using paramType
= mozilla::InputData
;
1013 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1014 WriteParam(aWriter
, aParam
.mInputType
);
1015 WriteParam(aWriter
, aParam
.mTimeStamp
);
1016 WriteParam(aWriter
, aParam
.modifiers
);
1017 WriteParam(aWriter
, aParam
.mFocusSequenceNumber
);
1018 WriteParam(aWriter
, aParam
.mLayersId
);
1021 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1022 return ReadParam(aReader
, &aResult
->mInputType
) &&
1023 ReadParam(aReader
, &aResult
->mTimeStamp
) &&
1024 ReadParam(aReader
, &aResult
->modifiers
) &&
1025 ReadParam(aReader
, &aResult
->mFocusSequenceNumber
) &&
1026 ReadParam(aReader
, &aResult
->mLayersId
);
1031 struct ParamTraits
<mozilla::SingleTouchData::HistoricalTouchData
> {
1032 using paramType
= mozilla::SingleTouchData::HistoricalTouchData
;
1034 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1035 WriteParam(aWriter
, aParam
.mTimeStamp
);
1036 WriteParam(aWriter
, aParam
.mScreenPoint
);
1037 WriteParam(aWriter
, aParam
.mLocalScreenPoint
);
1038 WriteParam(aWriter
, aParam
.mRadius
);
1039 WriteParam(aWriter
, aParam
.mRotationAngle
);
1040 WriteParam(aWriter
, aParam
.mForce
);
1043 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1044 return (ReadParam(aReader
, &aResult
->mTimeStamp
) &&
1045 ReadParam(aReader
, &aResult
->mScreenPoint
) &&
1046 ReadParam(aReader
, &aResult
->mLocalScreenPoint
) &&
1047 ReadParam(aReader
, &aResult
->mRadius
) &&
1048 ReadParam(aReader
, &aResult
->mRotationAngle
) &&
1049 ReadParam(aReader
, &aResult
->mForce
));
1054 struct ParamTraits
<mozilla::SingleTouchData
> {
1055 using paramType
= mozilla::SingleTouchData
;
1057 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1058 WriteParam(aWriter
, aParam
.mHistoricalData
);
1059 WriteParam(aWriter
, aParam
.mIdentifier
);
1060 WriteParam(aWriter
, aParam
.mScreenPoint
);
1061 WriteParam(aWriter
, aParam
.mLocalScreenPoint
);
1062 WriteParam(aWriter
, aParam
.mRadius
);
1063 WriteParam(aWriter
, aParam
.mRotationAngle
);
1064 WriteParam(aWriter
, aParam
.mForce
);
1065 WriteParam(aWriter
, aParam
.mTiltX
);
1066 WriteParam(aWriter
, aParam
.mTiltY
);
1067 WriteParam(aWriter
, aParam
.mTwist
);
1070 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1071 return (ReadParam(aReader
, &aResult
->mHistoricalData
) &&
1072 ReadParam(aReader
, &aResult
->mIdentifier
) &&
1073 ReadParam(aReader
, &aResult
->mScreenPoint
) &&
1074 ReadParam(aReader
, &aResult
->mLocalScreenPoint
) &&
1075 ReadParam(aReader
, &aResult
->mRadius
) &&
1076 ReadParam(aReader
, &aResult
->mRotationAngle
) &&
1077 ReadParam(aReader
, &aResult
->mForce
) &&
1078 ReadParam(aReader
, &aResult
->mTiltX
) &&
1079 ReadParam(aReader
, &aResult
->mTiltY
) &&
1080 ReadParam(aReader
, &aResult
->mTwist
));
1085 struct ParamTraits
<mozilla::MultiTouchInput::MultiTouchType
>
1086 : public ContiguousEnumSerializerInclusive
<
1087 mozilla::MultiTouchInput::MultiTouchType
,
1088 mozilla::MultiTouchInput::MultiTouchType::MULTITOUCH_START
,
1089 mozilla::MultiTouchInput::sHighestMultiTouchType
> {};
1092 struct ParamTraits
<mozilla::MultiTouchInput
> {
1093 using paramType
= mozilla::MultiTouchInput
;
1095 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1096 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1097 WriteParam(aWriter
, aParam
.mType
);
1098 WriteParam(aWriter
, aParam
.mTouches
);
1099 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1100 WriteParam(aWriter
, aParam
.mScreenOffset
);
1101 WriteParam(aWriter
, aParam
.mButton
);
1102 WriteParam(aWriter
, aParam
.mButtons
);
1105 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1106 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1107 ReadParam(aReader
, &aResult
->mType
) &&
1108 ReadParam(aReader
, &aResult
->mTouches
) &&
1109 ReadParam(aReader
, &aResult
->mHandledByAPZ
) &&
1110 ReadParam(aReader
, &aResult
->mScreenOffset
) &&
1111 ReadParam(aReader
, &aResult
->mButton
) &&
1112 ReadParam(aReader
, &aResult
->mButtons
);
1117 struct ParamTraits
<mozilla::MouseInput::MouseType
>
1118 : public ContiguousEnumSerializerInclusive
<
1119 mozilla::MouseInput::MouseType
,
1120 mozilla::MouseInput::MouseType::MOUSE_NONE
,
1121 mozilla::MouseInput::sHighestMouseType
> {};
1124 struct ParamTraits
<mozilla::MouseInput::ButtonType
>
1125 : public ContiguousEnumSerializerInclusive
<
1126 mozilla::MouseInput::ButtonType
,
1127 mozilla::MouseInput::ButtonType::PRIMARY_BUTTON
,
1128 mozilla::MouseInput::sHighestButtonType
> {};
1131 struct ParamTraits
<mozilla::MouseInput
> {
1132 using paramType
= mozilla::MouseInput
;
1134 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1135 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1136 WriteParam(aWriter
, aParam
.mButtonType
);
1137 WriteParam(aWriter
, aParam
.mType
);
1138 WriteParam(aWriter
, aParam
.mInputSource
);
1139 WriteParam(aWriter
, aParam
.mButtons
);
1140 WriteParam(aWriter
, aParam
.mOrigin
);
1141 WriteParam(aWriter
, aParam
.mLocalOrigin
);
1142 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1143 WriteParam(aWriter
, aParam
.mPreventClickEvent
);
1146 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1147 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1148 ReadParam(aReader
, &aResult
->mButtonType
) &&
1149 ReadParam(aReader
, &aResult
->mType
) &&
1150 ReadParam(aReader
, &aResult
->mInputSource
) &&
1151 ReadParam(aReader
, &aResult
->mButtons
) &&
1152 ReadParam(aReader
, &aResult
->mOrigin
) &&
1153 ReadParam(aReader
, &aResult
->mLocalOrigin
) &&
1154 ReadParam(aReader
, &aResult
->mHandledByAPZ
) &&
1155 ReadParam(aReader
, &aResult
->mPreventClickEvent
);
1160 struct ParamTraits
<mozilla::PanGestureInput::PanGestureType
>
1161 : public ContiguousEnumSerializerInclusive
<
1162 mozilla::PanGestureInput::PanGestureType
,
1163 mozilla::PanGestureInput::PanGestureType::PANGESTURE_MAYSTART
,
1164 mozilla::PanGestureInput::sHighestPanGestureType
> {};
1167 struct ParamTraits
<mozilla::PanGestureInput::PanDeltaType
>
1168 : public ContiguousEnumSerializerInclusive
<
1169 mozilla::PanGestureInput::PanDeltaType
,
1170 mozilla::PanGestureInput::PanDeltaType::PANDELTA_PAGE
,
1171 mozilla::PanGestureInput::sHighestPanDeltaType
> {};
1174 struct ParamTraits
<mozilla::PanGestureInput
>
1175 : BitfieldHelper
<mozilla::PanGestureInput
> {
1176 using paramType
= mozilla::PanGestureInput
;
1178 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1179 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1180 WriteParam(aWriter
, aParam
.mType
);
1181 WriteParam(aWriter
, aParam
.mPanStartPoint
);
1182 WriteParam(aWriter
, aParam
.mPanDisplacement
);
1183 WriteParam(aWriter
, aParam
.mLocalPanStartPoint
);
1184 WriteParam(aWriter
, aParam
.mLocalPanDisplacement
);
1185 WriteParam(aWriter
, aParam
.mLineOrPageDeltaX
);
1186 WriteParam(aWriter
, aParam
.mLineOrPageDeltaY
);
1187 WriteParam(aWriter
, aParam
.mUserDeltaMultiplierX
);
1188 WriteParam(aWriter
, aParam
.mUserDeltaMultiplierY
);
1189 WriteParam(aWriter
, aParam
.mDeltaType
);
1190 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1191 WriteParam(aWriter
, aParam
.mMayTriggerSwipe
);
1192 WriteParam(aWriter
, aParam
.mOverscrollBehaviorAllowsSwipe
);
1193 WriteParam(aWriter
, aParam
.mSimulateMomentum
);
1194 WriteParam(aWriter
, aParam
.mIsNoLineOrPageDelta
);
1197 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1198 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1199 ReadParam(aReader
, &aResult
->mType
) &&
1200 ReadParam(aReader
, &aResult
->mPanStartPoint
) &&
1201 ReadParam(aReader
, &aResult
->mPanDisplacement
) &&
1202 ReadParam(aReader
, &aResult
->mLocalPanStartPoint
) &&
1203 ReadParam(aReader
, &aResult
->mLocalPanDisplacement
) &&
1204 ReadParam(aReader
, &aResult
->mLineOrPageDeltaX
) &&
1205 ReadParam(aReader
, &aResult
->mLineOrPageDeltaY
) &&
1206 ReadParam(aReader
, &aResult
->mUserDeltaMultiplierX
) &&
1207 ReadParam(aReader
, &aResult
->mUserDeltaMultiplierY
) &&
1208 ReadParam(aReader
, &aResult
->mDeltaType
) &&
1209 ReadBoolForBitfield(aReader
, aResult
, ¶mType::SetHandledByAPZ
) &&
1210 ReadBoolForBitfield(aReader
, aResult
,
1211 ¶mType::SetMayTriggerSwipe
) &&
1212 ReadBoolForBitfield(aReader
, aResult
,
1213 ¶mType::SetOverscrollBehaviorAllowsSwipe
) &&
1214 ReadBoolForBitfield(aReader
, aResult
,
1215 ¶mType::SetSimulateMomentum
) &&
1216 ReadBoolForBitfield(aReader
, aResult
,
1217 ¶mType::SetIsNoLineOrPageDelta
);
1222 struct ParamTraits
<mozilla::PinchGestureInput::PinchGestureType
>
1223 : public ContiguousEnumSerializerInclusive
<
1224 mozilla::PinchGestureInput::PinchGestureType
,
1225 mozilla::PinchGestureInput::PinchGestureType::PINCHGESTURE_START
,
1226 mozilla::PinchGestureInput::sHighestPinchGestureType
> {};
1229 struct ParamTraits
<mozilla::PinchGestureInput::PinchGestureSource
>
1230 : public ContiguousEnumSerializerInclusive
<
1231 mozilla::PinchGestureInput::PinchGestureSource
,
1232 // Set the min to TOUCH, to ensure UNKNOWN is never sent over IPC
1233 mozilla::PinchGestureInput::PinchGestureSource::TOUCH
,
1234 mozilla::PinchGestureInput::sHighestPinchGestureSource
> {};
1237 struct ParamTraits
<mozilla::PinchGestureInput
> {
1238 using paramType
= mozilla::PinchGestureInput
;
1240 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1241 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1242 WriteParam(aWriter
, aParam
.mType
);
1243 WriteParam(aWriter
, aParam
.mSource
);
1244 WriteParam(aWriter
, aParam
.mScreenOffset
);
1245 WriteParam(aWriter
, aParam
.mFocusPoint
);
1246 WriteParam(aWriter
, aParam
.mLocalFocusPoint
);
1247 WriteParam(aWriter
, aParam
.mCurrentSpan
);
1248 WriteParam(aWriter
, aParam
.mPreviousSpan
);
1249 WriteParam(aWriter
, aParam
.mLineOrPageDeltaY
);
1250 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1253 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1254 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1255 ReadParam(aReader
, &aResult
->mType
) &&
1256 ReadParam(aReader
, &aResult
->mSource
) &&
1257 ReadParam(aReader
, &aResult
->mScreenOffset
) &&
1258 ReadParam(aReader
, &aResult
->mFocusPoint
) &&
1259 ReadParam(aReader
, &aResult
->mLocalFocusPoint
) &&
1260 ReadParam(aReader
, &aResult
->mCurrentSpan
) &&
1261 ReadParam(aReader
, &aResult
->mPreviousSpan
) &&
1262 ReadParam(aReader
, &aResult
->mLineOrPageDeltaY
) &&
1263 ReadParam(aReader
, &aResult
->mHandledByAPZ
);
1268 struct ParamTraits
<mozilla::TapGestureInput::TapGestureType
>
1269 : public ContiguousEnumSerializerInclusive
<
1270 mozilla::TapGestureInput::TapGestureType
,
1271 mozilla::TapGestureInput::TapGestureType::TAPGESTURE_LONG
,
1272 mozilla::TapGestureInput::sHighestTapGestureType
> {};
1275 struct ParamTraits
<mozilla::TapGestureInput
> {
1276 using paramType
= mozilla::TapGestureInput
;
1278 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1279 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1280 WriteParam(aWriter
, aParam
.mType
);
1281 WriteParam(aWriter
, aParam
.mPoint
);
1282 WriteParam(aWriter
, aParam
.mLocalPoint
);
1285 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1286 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1287 ReadParam(aReader
, &aResult
->mType
) &&
1288 ReadParam(aReader
, &aResult
->mPoint
) &&
1289 ReadParam(aReader
, &aResult
->mLocalPoint
);
1294 struct ParamTraits
<mozilla::ScrollWheelInput::ScrollDeltaType
>
1295 : public ContiguousEnumSerializerInclusive
<
1296 mozilla::ScrollWheelInput::ScrollDeltaType
,
1297 mozilla::ScrollWheelInput::ScrollDeltaType::SCROLLDELTA_LINE
,
1298 mozilla::ScrollWheelInput::sHighestScrollDeltaType
> {};
1301 struct ParamTraits
<mozilla::ScrollWheelInput::ScrollMode
>
1302 : public ContiguousEnumSerializerInclusive
<
1303 mozilla::ScrollWheelInput::ScrollMode
,
1304 mozilla::ScrollWheelInput::ScrollMode::SCROLLMODE_INSTANT
,
1305 mozilla::ScrollWheelInput::sHighestScrollMode
> {};
1308 struct ParamTraits
<mozilla::WheelDeltaAdjustmentStrategy
>
1309 : public ContiguousEnumSerializer
<
1310 mozilla::WheelDeltaAdjustmentStrategy
,
1311 mozilla::WheelDeltaAdjustmentStrategy(0),
1312 mozilla::WheelDeltaAdjustmentStrategy::eSentinel
> {};
1315 struct ParamTraits
<mozilla::layers::APZWheelAction
>
1316 : public ContiguousEnumSerializerInclusive
<
1317 mozilla::layers::APZWheelAction
,
1318 mozilla::layers::APZWheelAction::Scroll
,
1319 mozilla::layers::kHighestAPZWheelAction
> {};
1322 struct ParamTraits
<mozilla::ScrollWheelInput
> {
1323 using paramType
= mozilla::ScrollWheelInput
;
1325 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1326 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1327 WriteParam(aWriter
, aParam
.mDeltaType
);
1328 WriteParam(aWriter
, aParam
.mScrollMode
);
1329 WriteParam(aWriter
, aParam
.mOrigin
);
1330 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1331 WriteParam(aWriter
, aParam
.mDeltaX
);
1332 WriteParam(aWriter
, aParam
.mDeltaY
);
1333 WriteParam(aWriter
, aParam
.mWheelTicksX
);
1334 WriteParam(aWriter
, aParam
.mWheelTicksY
);
1335 WriteParam(aWriter
, aParam
.mLocalOrigin
);
1336 WriteParam(aWriter
, aParam
.mLineOrPageDeltaX
);
1337 WriteParam(aWriter
, aParam
.mLineOrPageDeltaY
);
1338 WriteParam(aWriter
, aParam
.mScrollSeriesNumber
);
1339 WriteParam(aWriter
, aParam
.mUserDeltaMultiplierX
);
1340 WriteParam(aWriter
, aParam
.mUserDeltaMultiplierY
);
1341 WriteParam(aWriter
, aParam
.mMayHaveMomentum
);
1342 WriteParam(aWriter
, aParam
.mIsMomentum
);
1343 WriteParam(aWriter
, aParam
.mAllowToOverrideSystemScrollSpeed
);
1344 WriteParam(aWriter
, aParam
.mWheelDeltaAdjustmentStrategy
);
1345 WriteParam(aWriter
, aParam
.mAPZAction
);
1348 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1349 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1350 ReadParam(aReader
, &aResult
->mDeltaType
) &&
1351 ReadParam(aReader
, &aResult
->mScrollMode
) &&
1352 ReadParam(aReader
, &aResult
->mOrigin
) &&
1353 ReadParam(aReader
, &aResult
->mHandledByAPZ
) &&
1354 ReadParam(aReader
, &aResult
->mDeltaX
) &&
1355 ReadParam(aReader
, &aResult
->mDeltaY
) &&
1356 ReadParam(aReader
, &aResult
->mWheelTicksX
) &&
1357 ReadParam(aReader
, &aResult
->mWheelTicksY
) &&
1358 ReadParam(aReader
, &aResult
->mLocalOrigin
) &&
1359 ReadParam(aReader
, &aResult
->mLineOrPageDeltaX
) &&
1360 ReadParam(aReader
, &aResult
->mLineOrPageDeltaY
) &&
1361 ReadParam(aReader
, &aResult
->mScrollSeriesNumber
) &&
1362 ReadParam(aReader
, &aResult
->mUserDeltaMultiplierX
) &&
1363 ReadParam(aReader
, &aResult
->mUserDeltaMultiplierY
) &&
1364 ReadParam(aReader
, &aResult
->mMayHaveMomentum
) &&
1365 ReadParam(aReader
, &aResult
->mIsMomentum
) &&
1366 ReadParam(aReader
, &aResult
->mAllowToOverrideSystemScrollSpeed
) &&
1367 ReadParam(aReader
, &aResult
->mWheelDeltaAdjustmentStrategy
) &&
1368 ReadParam(aReader
, &aResult
->mAPZAction
);
1373 struct ParamTraits
<mozilla::KeyboardInput::KeyboardEventType
>
1374 : public ContiguousEnumSerializer
<
1375 mozilla::KeyboardInput::KeyboardEventType
,
1376 mozilla::KeyboardInput::KeyboardEventType::KEY_DOWN
,
1377 mozilla::KeyboardInput::KeyboardEventType::KEY_SENTINEL
> {};
1380 struct ParamTraits
<mozilla::KeyboardInput
> {
1381 using paramType
= mozilla::KeyboardInput
;
1383 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1384 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1385 WriteParam(aWriter
, aParam
.mType
);
1386 WriteParam(aWriter
, aParam
.mKeyCode
);
1387 WriteParam(aWriter
, aParam
.mCharCode
);
1388 WriteParam(aWriter
, aParam
.mShortcutCandidates
);
1389 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1392 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1393 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1394 ReadParam(aReader
, &aResult
->mType
) &&
1395 ReadParam(aReader
, &aResult
->mKeyCode
) &&
1396 ReadParam(aReader
, &aResult
->mCharCode
) &&
1397 ReadParam(aReader
, &aResult
->mShortcutCandidates
) &&
1398 ReadParam(aReader
, &aResult
->mHandledByAPZ
);
1404 #endif // nsGUIEventIPC_h__