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
);
295 WriteParam(aWriter
, aParam
.mFromTouchEvent
);
298 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
300 ReadParam(aReader
, static_cast<mozilla::WidgetMouseEvent
*>(aResult
)) &&
301 ReadParam(aReader
, &aResult
->mWidth
) &&
302 ReadParam(aReader
, &aResult
->mHeight
) &&
303 ReadParam(aReader
, &aResult
->mIsPrimary
) &&
304 ReadParam(aReader
, &aResult
->mFromTouchEvent
);
310 struct ParamTraits
<mozilla::WidgetTouchEvent
> {
311 using paramType
= mozilla::WidgetTouchEvent
;
313 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
314 WriteParam(aWriter
, static_cast<const mozilla::WidgetInputEvent
&>(aParam
));
315 WriteParam(aWriter
, aParam
.mInputSource
);
316 WriteParam(aWriter
, aParam
.mButton
);
317 WriteParam(aWriter
, aParam
.mButtons
);
318 // Sigh, Touch bites us again! We want to be able to do
319 // WriteParam(aWriter, aParam.mTouches);
320 const paramType::TouchArray
& touches
= aParam
.mTouches
;
321 WriteParam(aWriter
, touches
.Length());
322 for (uint32_t i
= 0; i
< touches
.Length(); ++i
) {
323 mozilla::dom::Touch
* touch
= touches
[i
];
324 WriteParam(aWriter
, touch
->mIdentifier
);
325 WriteParam(aWriter
, touch
->mRefPoint
);
326 WriteParam(aWriter
, touch
->mRadius
);
327 WriteParam(aWriter
, touch
->mRotationAngle
);
328 WriteParam(aWriter
, touch
->mForce
);
329 WriteParam(aWriter
, touch
->tiltX
);
330 WriteParam(aWriter
, touch
->tiltY
);
331 WriteParam(aWriter
, touch
->twist
);
335 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
336 paramType::TouchArray::size_type numTouches
;
337 if (!ReadParam(aReader
, static_cast<mozilla::WidgetInputEvent
*>(aResult
)) ||
338 !ReadParam(aReader
, &aResult
->mInputSource
) ||
339 !ReadParam(aReader
, &aResult
->mButton
) ||
340 !ReadParam(aReader
, &aResult
->mButtons
) ||
341 !ReadParam(aReader
, &numTouches
)) {
344 for (uint32_t i
= 0; i
< numTouches
; ++i
) {
346 mozilla::LayoutDeviceIntPoint refPoint
;
347 mozilla::LayoutDeviceIntPoint radius
;
353 if (!ReadParam(aReader
, &identifier
) || !ReadParam(aReader
, &refPoint
) ||
354 !ReadParam(aReader
, &radius
) || !ReadParam(aReader
, &rotationAngle
) ||
355 !ReadParam(aReader
, &force
) || !ReadParam(aReader
, &tiltX
) ||
356 !ReadParam(aReader
, &tiltY
) || !ReadParam(aReader
, &twist
)) {
359 auto* touch
= new mozilla::dom::Touch(identifier
, refPoint
, radius
,
360 rotationAngle
, force
);
361 touch
->tiltX
= tiltX
;
362 touch
->tiltY
= tiltY
;
363 touch
->twist
= twist
;
364 aResult
->mTouches
.AppendElement(touch
);
371 struct ParamTraits
<mozilla::AlternativeCharCode
> {
372 using paramType
= mozilla::AlternativeCharCode
;
374 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
375 WriteParam(aWriter
, aParam
.mUnshiftedCharCode
);
376 WriteParam(aWriter
, aParam
.mShiftedCharCode
);
379 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
380 return ReadParam(aReader
, &aResult
->mUnshiftedCharCode
) &&
381 ReadParam(aReader
, &aResult
->mShiftedCharCode
);
386 struct ParamTraits
<mozilla::ShortcutKeyCandidate::ShiftState
>
387 : public ContiguousEnumSerializerInclusive
<
388 mozilla::ShortcutKeyCandidate::ShiftState
,
389 mozilla::ShortcutKeyCandidate::ShiftState::Ignorable
,
390 mozilla::ShortcutKeyCandidate::ShiftState::MatchExactly
> {};
393 struct ParamTraits
<mozilla::ShortcutKeyCandidate::SkipIfEarlierHandlerDisabled
>
394 : public ContiguousEnumSerializerInclusive
<
395 mozilla::ShortcutKeyCandidate::SkipIfEarlierHandlerDisabled
,
396 mozilla::ShortcutKeyCandidate::SkipIfEarlierHandlerDisabled::No
,
397 mozilla::ShortcutKeyCandidate::SkipIfEarlierHandlerDisabled::Yes
> {};
400 struct ParamTraits
<mozilla::ShortcutKeyCandidate
> {
401 using paramType
= mozilla::ShortcutKeyCandidate
;
403 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
404 WriteParam(aWriter
, aParam
.mCharCode
);
405 WriteParam(aWriter
, aParam
.mShiftState
);
406 WriteParam(aWriter
, aParam
.mSkipIfEarlierHandlerDisabled
);
409 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
410 return ReadParam(aReader
, &aResult
->mCharCode
) &&
411 ReadParam(aReader
, &aResult
->mShiftState
) &&
412 ReadParam(aReader
, &aResult
->mSkipIfEarlierHandlerDisabled
);
417 struct ParamTraits
<mozilla::WidgetKeyboardEvent
> {
418 using paramType
= mozilla::WidgetKeyboardEvent
;
420 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
421 WriteParam(aWriter
, static_cast<const mozilla::WidgetInputEvent
&>(aParam
));
423 static_cast<mozilla::KeyNameIndexType
>(aParam
.mKeyNameIndex
));
425 static_cast<mozilla::CodeNameIndexType
>(aParam
.mCodeNameIndex
));
426 WriteParam(aWriter
, aParam
.mKeyValue
);
427 WriteParam(aWriter
, aParam
.mCodeValue
);
428 WriteParam(aWriter
, aParam
.mKeyCode
);
429 WriteParam(aWriter
, aParam
.mCharCode
);
430 WriteParam(aWriter
, aParam
.mPseudoCharCode
);
431 WriteParam(aWriter
, aParam
.mAlternativeCharCodes
);
432 WriteParam(aWriter
, aParam
.mIsRepeat
);
433 WriteParam(aWriter
, aParam
.mLocation
);
434 WriteParam(aWriter
, aParam
.mUniqueId
);
435 WriteParam(aWriter
, aParam
.mIsSynthesizedByTIP
);
436 WriteParam(aWriter
, aParam
.mMaybeSkippableInRemoteProcess
);
438 // An OS-specific native event might be attached in |mNativeKeyEvent|, but
439 // that cannot be copied across process boundaries.
441 WriteParam(aWriter
, aParam
.mEditCommandsForSingleLineEditor
);
442 WriteParam(aWriter
, aParam
.mEditCommandsForMultiLineEditor
);
443 WriteParam(aWriter
, aParam
.mEditCommandsForRichTextEditor
);
444 WriteParam(aWriter
, aParam
.mEditCommandsForSingleLineEditorInitialized
);
445 WriteParam(aWriter
, aParam
.mEditCommandsForMultiLineEditorInitialized
);
446 WriteParam(aWriter
, aParam
.mEditCommandsForRichTextEditorInitialized
);
449 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
450 mozilla::KeyNameIndexType keyNameIndex
= 0;
451 mozilla::CodeNameIndexType codeNameIndex
= 0;
452 if (ReadParam(aReader
, static_cast<mozilla::WidgetInputEvent
*>(aResult
)) &&
453 ReadParam(aReader
, &keyNameIndex
) &&
454 ReadParam(aReader
, &codeNameIndex
) &&
455 ReadParam(aReader
, &aResult
->mKeyValue
) &&
456 ReadParam(aReader
, &aResult
->mCodeValue
) &&
457 ReadParam(aReader
, &aResult
->mKeyCode
) &&
458 ReadParam(aReader
, &aResult
->mCharCode
) &&
459 ReadParam(aReader
, &aResult
->mPseudoCharCode
) &&
460 ReadParam(aReader
, &aResult
->mAlternativeCharCodes
) &&
461 ReadParam(aReader
, &aResult
->mIsRepeat
) &&
462 ReadParam(aReader
, &aResult
->mLocation
) &&
463 ReadParam(aReader
, &aResult
->mUniqueId
) &&
464 ReadParam(aReader
, &aResult
->mIsSynthesizedByTIP
) &&
465 ReadParam(aReader
, &aResult
->mMaybeSkippableInRemoteProcess
) &&
466 ReadParam(aReader
, &aResult
->mEditCommandsForSingleLineEditor
) &&
467 ReadParam(aReader
, &aResult
->mEditCommandsForMultiLineEditor
) &&
468 ReadParam(aReader
, &aResult
->mEditCommandsForRichTextEditor
) &&
470 &aResult
->mEditCommandsForSingleLineEditorInitialized
) &&
472 &aResult
->mEditCommandsForMultiLineEditorInitialized
) &&
474 &aResult
->mEditCommandsForRichTextEditorInitialized
)) {
475 aResult
->mKeyNameIndex
= static_cast<mozilla::KeyNameIndex
>(keyNameIndex
);
476 aResult
->mCodeNameIndex
=
477 static_cast<mozilla::CodeNameIndex
>(codeNameIndex
);
478 aResult
->mNativeKeyEvent
= nullptr;
486 struct ParamTraits
<mozilla::TextRangeStyle
> {
487 using paramType
= mozilla::TextRangeStyle
;
489 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
490 WriteParam(aWriter
, aParam
.mDefinedStyles
);
491 WriteParam(aWriter
, static_cast<mozilla::TextRangeStyle::LineStyleType
>(
493 WriteParam(aWriter
, aParam
.mIsBoldLine
);
494 WriteParam(aWriter
, aParam
.mForegroundColor
);
495 WriteParam(aWriter
, aParam
.mBackgroundColor
);
496 WriteParam(aWriter
, aParam
.mUnderlineColor
);
499 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
500 mozilla::TextRangeStyle::LineStyleType lineStyle
;
501 if (!ReadParam(aReader
, &aResult
->mDefinedStyles
) ||
502 !ReadParam(aReader
, &lineStyle
) ||
503 !ReadParam(aReader
, &aResult
->mIsBoldLine
) ||
504 !ReadParam(aReader
, &aResult
->mForegroundColor
) ||
505 !ReadParam(aReader
, &aResult
->mBackgroundColor
) ||
506 !ReadParam(aReader
, &aResult
->mUnderlineColor
)) {
509 aResult
->mLineStyle
= mozilla::TextRangeStyle::ToLineStyle(lineStyle
);
515 struct ParamTraits
<mozilla::TextRange
> {
516 using paramType
= mozilla::TextRange
;
518 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
519 WriteParam(aWriter
, aParam
.mStartOffset
);
520 WriteParam(aWriter
, aParam
.mEndOffset
);
521 WriteParam(aWriter
, mozilla::ToRawTextRangeType(aParam
.mRangeType
));
522 WriteParam(aWriter
, aParam
.mRangeStyle
);
525 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
526 mozilla::RawTextRangeType rawTextRangeType
;
527 if (ReadParam(aReader
, &aResult
->mStartOffset
) &&
528 ReadParam(aReader
, &aResult
->mEndOffset
) &&
529 ReadParam(aReader
, &rawTextRangeType
) &&
530 ReadParam(aReader
, &aResult
->mRangeStyle
)) {
531 aResult
->mRangeType
= mozilla::ToTextRangeType(rawTextRangeType
);
539 struct ParamTraits
<mozilla::TextRangeArray
> {
540 using paramType
= mozilla::TextRangeArray
;
542 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
543 WriteParam(aWriter
, aParam
.Length());
544 for (uint32_t index
= 0; index
< aParam
.Length(); index
++) {
545 WriteParam(aWriter
, aParam
[index
]);
549 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
550 paramType::size_type length
;
551 if (!ReadParam(aReader
, &length
)) {
554 for (uint32_t index
= 0; index
< length
; index
++) {
555 mozilla::TextRange textRange
;
556 if (!ReadParam(aReader
, &textRange
)) {
560 aResult
->AppendElement(textRange
);
567 struct ParamTraits
<mozilla::WidgetCompositionEvent
> {
568 using paramType
= mozilla::WidgetCompositionEvent
;
570 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
571 WriteParam(aWriter
, static_cast<const mozilla::WidgetGUIEvent
&>(aParam
));
572 WriteParam(aWriter
, aParam
.mData
);
573 WriteParam(aWriter
, aParam
.mNativeIMEContext
);
574 WriteParam(aWriter
, aParam
.mCompositionId
);
575 bool hasRanges
= !!aParam
.mRanges
;
576 WriteParam(aWriter
, hasRanges
);
578 WriteParam(aWriter
, *aParam
.mRanges
.get());
582 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
584 if (!ReadParam(aReader
, static_cast<mozilla::WidgetGUIEvent
*>(aResult
)) ||
585 !ReadParam(aReader
, &aResult
->mData
) ||
586 !ReadParam(aReader
, &aResult
->mNativeIMEContext
) ||
587 !ReadParam(aReader
, &aResult
->mCompositionId
) ||
588 !ReadParam(aReader
, &hasRanges
)) {
593 aResult
->mRanges
= nullptr;
595 aResult
->mRanges
= new mozilla::TextRangeArray();
596 if (!ReadParam(aReader
, aResult
->mRanges
.get())) {
605 struct ParamTraits
<mozilla::FontRange
> {
606 using paramType
= mozilla::FontRange
;
608 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
609 WriteParam(aWriter
, aParam
.mStartOffset
);
610 WriteParam(aWriter
, aParam
.mFontName
);
611 WriteParam(aWriter
, aParam
.mFontSize
);
614 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
615 return ReadParam(aReader
, &aResult
->mStartOffset
) &&
616 ReadParam(aReader
, &aResult
->mFontName
) &&
617 ReadParam(aReader
, &aResult
->mFontSize
);
622 struct ParamTraits
<mozilla::WidgetSelectionEvent
> {
623 using paramType
= mozilla::WidgetSelectionEvent
;
625 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
626 WriteParam(aWriter
, static_cast<const mozilla::WidgetGUIEvent
&>(aParam
));
627 WriteParam(aWriter
, aParam
.mOffset
);
628 WriteParam(aWriter
, aParam
.mLength
);
629 WriteParam(aWriter
, aParam
.mReversed
);
630 WriteParam(aWriter
, aParam
.mExpandToClusterBoundary
);
631 WriteParam(aWriter
, aParam
.mSucceeded
);
632 WriteParam(aWriter
, aParam
.mUseNativeLineBreak
);
635 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
636 return ReadParam(aReader
, static_cast<mozilla::WidgetGUIEvent
*>(aResult
)) &&
637 ReadParam(aReader
, &aResult
->mOffset
) &&
638 ReadParam(aReader
, &aResult
->mLength
) &&
639 ReadParam(aReader
, &aResult
->mReversed
) &&
640 ReadParam(aReader
, &aResult
->mExpandToClusterBoundary
) &&
641 ReadParam(aReader
, &aResult
->mSucceeded
) &&
642 ReadParam(aReader
, &aResult
->mUseNativeLineBreak
);
647 struct ParamTraits
<mozilla::widget::IMENotificationRequests
> {
648 using paramType
= mozilla::widget::IMENotificationRequests
;
650 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
651 WriteParam(aWriter
, aParam
.mWantUpdates
);
654 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
655 return ReadParam(aReader
, &aResult
->mWantUpdates
);
660 struct ParamTraits
<mozilla::widget::NativeIMEContext
> {
661 using paramType
= mozilla::widget::NativeIMEContext
;
663 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
664 WriteParam(aWriter
, aParam
.mRawNativeIMEContext
);
665 WriteParam(aWriter
, aParam
.mOriginProcessID
);
668 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
669 return ReadParam(aReader
, &aResult
->mRawNativeIMEContext
) &&
670 ReadParam(aReader
, &aResult
->mOriginProcessID
);
675 struct ParamTraits
<mozilla::widget::IMENotification::SelectionChangeDataBase
> {
676 using paramType
= mozilla::widget::IMENotification::SelectionChangeDataBase
;
678 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
679 MOZ_RELEASE_ASSERT(aParam
.mString
);
680 WriteParam(aWriter
, aParam
.mOffset
);
681 WriteParam(aWriter
, *aParam
.mString
);
682 WriteParam(aWriter
, aParam
.mWritingModeBits
);
683 WriteParam(aWriter
, aParam
.mIsInitialized
);
684 WriteParam(aWriter
, aParam
.mHasRange
);
685 WriteParam(aWriter
, aParam
.mReversed
);
686 WriteParam(aWriter
, aParam
.mCausedByComposition
);
687 WriteParam(aWriter
, aParam
.mCausedBySelectionEvent
);
688 WriteParam(aWriter
, aParam
.mOccurredDuringComposition
);
691 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
692 aResult
->mString
= new nsString();
693 return ReadParam(aReader
, &aResult
->mOffset
) &&
694 ReadParam(aReader
, aResult
->mString
) &&
695 ReadParam(aReader
, &aResult
->mWritingModeBits
) &&
696 ReadParam(aReader
, &aResult
->mIsInitialized
) &&
697 ReadParam(aReader
, &aResult
->mHasRange
) &&
698 ReadParam(aReader
, &aResult
->mReversed
) &&
699 ReadParam(aReader
, &aResult
->mCausedByComposition
) &&
700 ReadParam(aReader
, &aResult
->mCausedBySelectionEvent
) &&
701 ReadParam(aReader
, &aResult
->mOccurredDuringComposition
);
706 struct ParamTraits
<mozilla::widget::IMENotification::TextChangeDataBase
> {
707 using paramType
= mozilla::widget::IMENotification::TextChangeDataBase
;
709 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
710 WriteParam(aWriter
, aParam
.mStartOffset
);
711 WriteParam(aWriter
, aParam
.mRemovedEndOffset
);
712 WriteParam(aWriter
, aParam
.mAddedEndOffset
);
713 WriteParam(aWriter
, aParam
.mCausedOnlyByComposition
);
714 WriteParam(aWriter
, aParam
.mIncludingChangesDuringComposition
);
715 WriteParam(aWriter
, aParam
.mIncludingChangesWithoutComposition
);
718 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
719 return ReadParam(aReader
, &aResult
->mStartOffset
) &&
720 ReadParam(aReader
, &aResult
->mRemovedEndOffset
) &&
721 ReadParam(aReader
, &aResult
->mAddedEndOffset
) &&
722 ReadParam(aReader
, &aResult
->mCausedOnlyByComposition
) &&
723 ReadParam(aReader
, &aResult
->mIncludingChangesDuringComposition
) &&
724 ReadParam(aReader
, &aResult
->mIncludingChangesWithoutComposition
);
729 struct ParamTraits
<mozilla::widget::IMENotification::MouseButtonEventData
> {
730 using paramType
= mozilla::widget::IMENotification::MouseButtonEventData
;
732 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
733 WriteParam(aWriter
, aParam
.mEventMessage
);
734 WriteParam(aWriter
, aParam
.mOffset
);
735 WriteParam(aWriter
, aParam
.mCursorPos
);
736 WriteParam(aWriter
, aParam
.mCharRect
);
737 WriteParam(aWriter
, aParam
.mButton
);
738 WriteParam(aWriter
, aParam
.mButtons
);
739 WriteParam(aWriter
, aParam
.mModifiers
);
742 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
743 return ReadParam(aReader
, &aResult
->mEventMessage
) &&
744 ReadParam(aReader
, &aResult
->mOffset
) &&
745 ReadParam(aReader
, &aResult
->mCursorPos
) &&
746 ReadParam(aReader
, &aResult
->mCharRect
) &&
747 ReadParam(aReader
, &aResult
->mButton
) &&
748 ReadParam(aReader
, &aResult
->mButtons
) &&
749 ReadParam(aReader
, &aResult
->mModifiers
);
754 struct ParamTraits
<mozilla::widget::IMENotification
> {
755 using paramType
= mozilla::widget::IMENotification
;
757 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
759 static_cast<mozilla::widget::IMEMessageType
>(aParam
.mMessage
));
760 switch (aParam
.mMessage
) {
761 case mozilla::widget::NOTIFY_IME_OF_SELECTION_CHANGE
:
762 WriteParam(aWriter
, aParam
.mSelectionChangeData
);
764 case mozilla::widget::NOTIFY_IME_OF_TEXT_CHANGE
:
765 WriteParam(aWriter
, aParam
.mTextChangeData
);
767 case mozilla::widget::NOTIFY_IME_OF_MOUSE_BUTTON_EVENT
:
768 WriteParam(aWriter
, aParam
.mMouseButtonEventData
);
775 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
776 mozilla::widget::IMEMessageType IMEMessage
= 0;
777 if (!ReadParam(aReader
, &IMEMessage
)) {
780 aResult
->mMessage
= static_cast<mozilla::widget::IMEMessage
>(IMEMessage
);
781 switch (aResult
->mMessage
) {
782 case mozilla::widget::NOTIFY_IME_OF_SELECTION_CHANGE
:
783 return ReadParam(aReader
, &aResult
->mSelectionChangeData
);
784 case mozilla::widget::NOTIFY_IME_OF_TEXT_CHANGE
:
785 return ReadParam(aReader
, &aResult
->mTextChangeData
);
786 case mozilla::widget::NOTIFY_IME_OF_MOUSE_BUTTON_EVENT
:
787 return ReadParam(aReader
, &aResult
->mMouseButtonEventData
);
795 struct ParamTraits
<mozilla::widget::IMEEnabled
>
796 : ContiguousEnumSerializer
<mozilla::widget::IMEEnabled
,
797 mozilla::widget::IMEEnabled::Disabled
,
798 mozilla::widget::IMEEnabled::Unknown
> {};
801 struct ParamTraits
<mozilla::widget::IMEState::Open
>
802 : ContiguousEnumSerializerInclusive
<
803 mozilla::widget::IMEState::Open
,
804 mozilla::widget::IMEState::Open::OPEN_STATE_NOT_SUPPORTED
,
805 mozilla::widget::IMEState::Open::CLOSED
> {};
808 struct ParamTraits
<mozilla::widget::IMEState
> {
809 using paramType
= mozilla::widget::IMEState
;
811 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
812 WriteParam(aWriter
, aParam
.mEnabled
);
813 WriteParam(aWriter
, aParam
.mOpen
);
816 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
817 return ReadParam(aReader
, &aResult
->mEnabled
) &&
818 ReadParam(aReader
, &aResult
->mOpen
);
823 struct ParamTraits
<mozilla::widget::InputContext::Origin
>
824 : ContiguousEnumSerializerInclusive
<
825 mozilla::widget::InputContext::Origin
,
826 mozilla::widget::InputContext::Origin::ORIGIN_MAIN
,
827 mozilla::widget::InputContext::Origin::ORIGIN_CONTENT
> {};
830 struct ParamTraits
<mozilla::widget::InputContext
> {
831 using paramType
= mozilla::widget::InputContext
;
833 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
834 WriteParam(aWriter
, aParam
.mIMEState
);
835 WriteParam(aWriter
, aParam
.mHTMLInputType
);
836 WriteParam(aWriter
, aParam
.mHTMLInputMode
);
837 WriteParam(aWriter
, aParam
.mActionHint
);
838 WriteParam(aWriter
, aParam
.mAutocapitalize
);
839 WriteParam(aWriter
, aParam
.mOrigin
);
840 WriteParam(aWriter
, aParam
.mHasHandledUserInput
);
841 WriteParam(aWriter
, aParam
.mInPrivateBrowsing
);
842 mozilla::ipc::WriteIPDLParam(aWriter
, aWriter
->GetActor(), aParam
.mURI
);
845 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
846 return ReadParam(aReader
, &aResult
->mIMEState
) &&
847 ReadParam(aReader
, &aResult
->mHTMLInputType
) &&
848 ReadParam(aReader
, &aResult
->mHTMLInputMode
) &&
849 ReadParam(aReader
, &aResult
->mActionHint
) &&
850 ReadParam(aReader
, &aResult
->mAutocapitalize
) &&
851 ReadParam(aReader
, &aResult
->mOrigin
) &&
852 ReadParam(aReader
, &aResult
->mHasHandledUserInput
) &&
853 ReadParam(aReader
, &aResult
->mInPrivateBrowsing
) &&
854 mozilla::ipc::ReadIPDLParam(aReader
, aReader
->GetActor(),
855 address_of(aResult
->mURI
));
860 struct ParamTraits
<mozilla::widget::InputContextAction::Cause
>
861 : ContiguousEnumSerializerInclusive
<
862 mozilla::widget::InputContextAction::Cause
,
863 mozilla::widget::InputContextAction::Cause::CAUSE_UNKNOWN
,
864 mozilla::widget::InputContextAction::Cause::
865 CAUSE_UNKNOWN_DURING_KEYBOARD_INPUT
> {};
868 struct ParamTraits
<mozilla::widget::InputContextAction::FocusChange
>
869 : ContiguousEnumSerializerInclusive
<
870 mozilla::widget::InputContextAction::FocusChange
,
871 mozilla::widget::InputContextAction::FocusChange::FOCUS_NOT_CHANGED
,
872 mozilla::widget::InputContextAction::FocusChange::WIDGET_CREATED
> {};
875 struct ParamTraits
<mozilla::widget::InputContextAction
> {
876 using paramType
= mozilla::widget::InputContextAction
;
878 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
879 WriteParam(aWriter
, aParam
.mCause
);
880 WriteParam(aWriter
, aParam
.mFocusChange
);
883 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
884 return ReadParam(aReader
, &aResult
->mCause
) &&
885 ReadParam(aReader
, &aResult
->mFocusChange
);
890 struct ParamTraits
<mozilla::WritingMode
> {
891 using paramType
= mozilla::WritingMode
;
893 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
894 WriteParam(aWriter
, aParam
.mWritingMode
._0
);
897 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
898 return ReadParam(aReader
, &aResult
->mWritingMode
._0
);
903 struct ParamTraits
<mozilla::ContentCache::Selection
> {
904 using paramType
= mozilla::ContentCache::Selection
;
906 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
907 WriteParam(aWriter
, aParam
.mAnchor
);
908 WriteParam(aWriter
, aParam
.mFocus
);
909 WriteParam(aWriter
, aParam
.mWritingMode
);
910 WriteParam(aWriter
, aParam
.mHasRange
);
911 WriteParam(aWriter
, aParam
.mAnchorCharRects
[0]);
912 WriteParam(aWriter
, aParam
.mAnchorCharRects
[1]);
913 WriteParam(aWriter
, aParam
.mFocusCharRects
[0]);
914 WriteParam(aWriter
, aParam
.mFocusCharRects
[1]);
915 WriteParam(aWriter
, aParam
.mRect
);
918 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
919 return ReadParam(aReader
, &aResult
->mAnchor
) &&
920 ReadParam(aReader
, &aResult
->mFocus
) &&
921 ReadParam(aReader
, &aResult
->mWritingMode
) &&
922 ReadParam(aReader
, &aResult
->mHasRange
) &&
923 ReadParam(aReader
, &aResult
->mAnchorCharRects
[0]) &&
924 ReadParam(aReader
, &aResult
->mAnchorCharRects
[1]) &&
925 ReadParam(aReader
, &aResult
->mFocusCharRects
[0]) &&
926 ReadParam(aReader
, &aResult
->mFocusCharRects
[1]) &&
927 ReadParam(aReader
, &aResult
->mRect
);
932 struct ParamTraits
<mozilla::ContentCache::Caret
> {
933 using paramType
= mozilla::ContentCache::Caret
;
935 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
936 WriteParam(aWriter
, aParam
.mOffset
);
937 WriteParam(aWriter
, aParam
.mRect
);
940 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
941 return ReadParam(aReader
, &aResult
->mOffset
) &&
942 ReadParam(aReader
, &aResult
->mRect
);
947 struct ParamTraits
<mozilla::ContentCache::TextRectArray
> {
948 using paramType
= mozilla::ContentCache::TextRectArray
;
950 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
951 WriteParam(aWriter
, aParam
.mStart
);
952 WriteParam(aWriter
, aParam
.mRects
);
955 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
956 return ReadParam(aReader
, &aResult
->mStart
) &&
957 ReadParam(aReader
, &aResult
->mRects
);
962 struct ParamTraits
<mozilla::ContentCache
> {
963 using paramType
= mozilla::ContentCache
;
965 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
966 WriteParam(aWriter
, aParam
.mCompositionStart
);
967 WriteParam(aWriter
, aParam
.mText
);
968 WriteParam(aWriter
, aParam
.mSelection
);
969 WriteParam(aWriter
, aParam
.mFirstCharRect
);
970 WriteParam(aWriter
, aParam
.mCaret
);
971 WriteParam(aWriter
, aParam
.mTextRectArray
);
972 WriteParam(aWriter
, aParam
.mLastCommitStringTextRectArray
);
973 WriteParam(aWriter
, aParam
.mEditorRect
);
976 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
977 return ReadParam(aReader
, &aResult
->mCompositionStart
) &&
978 ReadParam(aReader
, &aResult
->mText
) &&
979 ReadParam(aReader
, &aResult
->mSelection
) &&
980 ReadParam(aReader
, &aResult
->mFirstCharRect
) &&
981 ReadParam(aReader
, &aResult
->mCaret
) &&
982 ReadParam(aReader
, &aResult
->mTextRectArray
) &&
983 ReadParam(aReader
, &aResult
->mLastCommitStringTextRectArray
) &&
984 ReadParam(aReader
, &aResult
->mEditorRect
);
989 struct ParamTraits
<mozilla::widget::CandidateWindowPosition
> {
990 using paramType
= mozilla::widget::CandidateWindowPosition
;
992 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
993 WriteParam(aWriter
, aParam
.mPoint
);
994 WriteParam(aWriter
, aParam
.mRect
);
995 WriteParam(aWriter
, aParam
.mExcludeRect
);
998 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
999 return ReadParam(aReader
, &aResult
->mPoint
) &&
1000 ReadParam(aReader
, &aResult
->mRect
) &&
1001 ReadParam(aReader
, &aResult
->mExcludeRect
);
1008 struct ParamTraits
<mozilla::InputType
>
1009 : public ContiguousEnumSerializerInclusive
<
1010 mozilla::InputType
, mozilla::InputType::MULTITOUCH_INPUT
,
1011 mozilla::kHighestInputType
> {};
1014 struct ParamTraits
<mozilla::InputData
> {
1015 using paramType
= mozilla::InputData
;
1017 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1018 WriteParam(aWriter
, aParam
.mInputType
);
1019 WriteParam(aWriter
, aParam
.mTimeStamp
);
1020 WriteParam(aWriter
, aParam
.modifiers
);
1021 WriteParam(aWriter
, aParam
.mFocusSequenceNumber
);
1022 WriteParam(aWriter
, aParam
.mLayersId
);
1025 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1026 return ReadParam(aReader
, &aResult
->mInputType
) &&
1027 ReadParam(aReader
, &aResult
->mTimeStamp
) &&
1028 ReadParam(aReader
, &aResult
->modifiers
) &&
1029 ReadParam(aReader
, &aResult
->mFocusSequenceNumber
) &&
1030 ReadParam(aReader
, &aResult
->mLayersId
);
1035 struct ParamTraits
<mozilla::SingleTouchData::HistoricalTouchData
> {
1036 using paramType
= mozilla::SingleTouchData::HistoricalTouchData
;
1038 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1039 WriteParam(aWriter
, aParam
.mTimeStamp
);
1040 WriteParam(aWriter
, aParam
.mScreenPoint
);
1041 WriteParam(aWriter
, aParam
.mLocalScreenPoint
);
1042 WriteParam(aWriter
, aParam
.mRadius
);
1043 WriteParam(aWriter
, aParam
.mRotationAngle
);
1044 WriteParam(aWriter
, aParam
.mForce
);
1047 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1048 return (ReadParam(aReader
, &aResult
->mTimeStamp
) &&
1049 ReadParam(aReader
, &aResult
->mScreenPoint
) &&
1050 ReadParam(aReader
, &aResult
->mLocalScreenPoint
) &&
1051 ReadParam(aReader
, &aResult
->mRadius
) &&
1052 ReadParam(aReader
, &aResult
->mRotationAngle
) &&
1053 ReadParam(aReader
, &aResult
->mForce
));
1058 struct ParamTraits
<mozilla::SingleTouchData
> {
1059 using paramType
= mozilla::SingleTouchData
;
1061 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1062 WriteParam(aWriter
, aParam
.mHistoricalData
);
1063 WriteParam(aWriter
, aParam
.mIdentifier
);
1064 WriteParam(aWriter
, aParam
.mScreenPoint
);
1065 WriteParam(aWriter
, aParam
.mLocalScreenPoint
);
1066 WriteParam(aWriter
, aParam
.mRadius
);
1067 WriteParam(aWriter
, aParam
.mRotationAngle
);
1068 WriteParam(aWriter
, aParam
.mForce
);
1069 WriteParam(aWriter
, aParam
.mTiltX
);
1070 WriteParam(aWriter
, aParam
.mTiltY
);
1071 WriteParam(aWriter
, aParam
.mTwist
);
1074 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1075 return (ReadParam(aReader
, &aResult
->mHistoricalData
) &&
1076 ReadParam(aReader
, &aResult
->mIdentifier
) &&
1077 ReadParam(aReader
, &aResult
->mScreenPoint
) &&
1078 ReadParam(aReader
, &aResult
->mLocalScreenPoint
) &&
1079 ReadParam(aReader
, &aResult
->mRadius
) &&
1080 ReadParam(aReader
, &aResult
->mRotationAngle
) &&
1081 ReadParam(aReader
, &aResult
->mForce
) &&
1082 ReadParam(aReader
, &aResult
->mTiltX
) &&
1083 ReadParam(aReader
, &aResult
->mTiltY
) &&
1084 ReadParam(aReader
, &aResult
->mTwist
));
1089 struct ParamTraits
<mozilla::MultiTouchInput::MultiTouchType
>
1090 : public ContiguousEnumSerializerInclusive
<
1091 mozilla::MultiTouchInput::MultiTouchType
,
1092 mozilla::MultiTouchInput::MultiTouchType::MULTITOUCH_START
,
1093 mozilla::MultiTouchInput::sHighestMultiTouchType
> {};
1096 struct ParamTraits
<mozilla::MultiTouchInput
> {
1097 using paramType
= mozilla::MultiTouchInput
;
1099 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1100 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1101 WriteParam(aWriter
, aParam
.mType
);
1102 WriteParam(aWriter
, aParam
.mTouches
);
1103 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1104 WriteParam(aWriter
, aParam
.mScreenOffset
);
1105 WriteParam(aWriter
, aParam
.mButton
);
1106 WriteParam(aWriter
, aParam
.mButtons
);
1109 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1110 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1111 ReadParam(aReader
, &aResult
->mType
) &&
1112 ReadParam(aReader
, &aResult
->mTouches
) &&
1113 ReadParam(aReader
, &aResult
->mHandledByAPZ
) &&
1114 ReadParam(aReader
, &aResult
->mScreenOffset
) &&
1115 ReadParam(aReader
, &aResult
->mButton
) &&
1116 ReadParam(aReader
, &aResult
->mButtons
);
1121 struct ParamTraits
<mozilla::MouseInput::MouseType
>
1122 : public ContiguousEnumSerializerInclusive
<
1123 mozilla::MouseInput::MouseType
,
1124 mozilla::MouseInput::MouseType::MOUSE_NONE
,
1125 mozilla::MouseInput::sHighestMouseType
> {};
1128 struct ParamTraits
<mozilla::MouseInput::ButtonType
>
1129 : public ContiguousEnumSerializerInclusive
<
1130 mozilla::MouseInput::ButtonType
,
1131 mozilla::MouseInput::ButtonType::PRIMARY_BUTTON
,
1132 mozilla::MouseInput::sHighestButtonType
> {};
1135 struct ParamTraits
<mozilla::MouseInput
> {
1136 using paramType
= mozilla::MouseInput
;
1138 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1139 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1140 WriteParam(aWriter
, aParam
.mButtonType
);
1141 WriteParam(aWriter
, aParam
.mType
);
1142 WriteParam(aWriter
, aParam
.mInputSource
);
1143 WriteParam(aWriter
, aParam
.mButtons
);
1144 WriteParam(aWriter
, aParam
.mOrigin
);
1145 WriteParam(aWriter
, aParam
.mLocalOrigin
);
1146 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1147 WriteParam(aWriter
, aParam
.mPreventClickEvent
);
1150 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1151 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1152 ReadParam(aReader
, &aResult
->mButtonType
) &&
1153 ReadParam(aReader
, &aResult
->mType
) &&
1154 ReadParam(aReader
, &aResult
->mInputSource
) &&
1155 ReadParam(aReader
, &aResult
->mButtons
) &&
1156 ReadParam(aReader
, &aResult
->mOrigin
) &&
1157 ReadParam(aReader
, &aResult
->mLocalOrigin
) &&
1158 ReadParam(aReader
, &aResult
->mHandledByAPZ
) &&
1159 ReadParam(aReader
, &aResult
->mPreventClickEvent
);
1164 struct ParamTraits
<mozilla::PanGestureInput::PanGestureType
>
1165 : public ContiguousEnumSerializerInclusive
<
1166 mozilla::PanGestureInput::PanGestureType
,
1167 mozilla::PanGestureInput::PanGestureType::PANGESTURE_MAYSTART
,
1168 mozilla::PanGestureInput::sHighestPanGestureType
> {};
1171 struct ParamTraits
<mozilla::PanGestureInput::PanDeltaType
>
1172 : public ContiguousEnumSerializerInclusive
<
1173 mozilla::PanGestureInput::PanDeltaType
,
1174 mozilla::PanGestureInput::PanDeltaType::PANDELTA_PAGE
,
1175 mozilla::PanGestureInput::sHighestPanDeltaType
> {};
1178 struct ParamTraits
<mozilla::PanGestureInput
>
1179 : BitfieldHelper
<mozilla::PanGestureInput
> {
1180 using paramType
= mozilla::PanGestureInput
;
1182 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1183 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1184 WriteParam(aWriter
, aParam
.mType
);
1185 WriteParam(aWriter
, aParam
.mPanStartPoint
);
1186 WriteParam(aWriter
, aParam
.mPanDisplacement
);
1187 WriteParam(aWriter
, aParam
.mLocalPanStartPoint
);
1188 WriteParam(aWriter
, aParam
.mLocalPanDisplacement
);
1189 WriteParam(aWriter
, aParam
.mLineOrPageDeltaX
);
1190 WriteParam(aWriter
, aParam
.mLineOrPageDeltaY
);
1191 WriteParam(aWriter
, aParam
.mUserDeltaMultiplierX
);
1192 WriteParam(aWriter
, aParam
.mUserDeltaMultiplierY
);
1193 WriteParam(aWriter
, aParam
.mDeltaType
);
1194 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1195 WriteParam(aWriter
, aParam
.mMayTriggerSwipe
);
1196 WriteParam(aWriter
, aParam
.mOverscrollBehaviorAllowsSwipe
);
1197 WriteParam(aWriter
, aParam
.mSimulateMomentum
);
1198 WriteParam(aWriter
, aParam
.mIsNoLineOrPageDelta
);
1201 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1202 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1203 ReadParam(aReader
, &aResult
->mType
) &&
1204 ReadParam(aReader
, &aResult
->mPanStartPoint
) &&
1205 ReadParam(aReader
, &aResult
->mPanDisplacement
) &&
1206 ReadParam(aReader
, &aResult
->mLocalPanStartPoint
) &&
1207 ReadParam(aReader
, &aResult
->mLocalPanDisplacement
) &&
1208 ReadParam(aReader
, &aResult
->mLineOrPageDeltaX
) &&
1209 ReadParam(aReader
, &aResult
->mLineOrPageDeltaY
) &&
1210 ReadParam(aReader
, &aResult
->mUserDeltaMultiplierX
) &&
1211 ReadParam(aReader
, &aResult
->mUserDeltaMultiplierY
) &&
1212 ReadParam(aReader
, &aResult
->mDeltaType
) &&
1213 ReadBoolForBitfield(aReader
, aResult
, ¶mType::SetHandledByAPZ
) &&
1214 ReadBoolForBitfield(aReader
, aResult
,
1215 ¶mType::SetMayTriggerSwipe
) &&
1216 ReadBoolForBitfield(aReader
, aResult
,
1217 ¶mType::SetOverscrollBehaviorAllowsSwipe
) &&
1218 ReadBoolForBitfield(aReader
, aResult
,
1219 ¶mType::SetSimulateMomentum
) &&
1220 ReadBoolForBitfield(aReader
, aResult
,
1221 ¶mType::SetIsNoLineOrPageDelta
);
1226 struct ParamTraits
<mozilla::PinchGestureInput::PinchGestureType
>
1227 : public ContiguousEnumSerializerInclusive
<
1228 mozilla::PinchGestureInput::PinchGestureType
,
1229 mozilla::PinchGestureInput::PinchGestureType::PINCHGESTURE_START
,
1230 mozilla::PinchGestureInput::sHighestPinchGestureType
> {};
1233 struct ParamTraits
<mozilla::PinchGestureInput::PinchGestureSource
>
1234 : public ContiguousEnumSerializerInclusive
<
1235 mozilla::PinchGestureInput::PinchGestureSource
,
1236 // Set the min to TOUCH, to ensure UNKNOWN is never sent over IPC
1237 mozilla::PinchGestureInput::PinchGestureSource::TOUCH
,
1238 mozilla::PinchGestureInput::sHighestPinchGestureSource
> {};
1241 struct ParamTraits
<mozilla::PinchGestureInput
> {
1242 using paramType
= mozilla::PinchGestureInput
;
1244 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1245 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1246 WriteParam(aWriter
, aParam
.mType
);
1247 WriteParam(aWriter
, aParam
.mSource
);
1248 WriteParam(aWriter
, aParam
.mScreenOffset
);
1249 WriteParam(aWriter
, aParam
.mFocusPoint
);
1250 WriteParam(aWriter
, aParam
.mLocalFocusPoint
);
1251 WriteParam(aWriter
, aParam
.mCurrentSpan
);
1252 WriteParam(aWriter
, aParam
.mPreviousSpan
);
1253 WriteParam(aWriter
, aParam
.mLineOrPageDeltaY
);
1254 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1257 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1258 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1259 ReadParam(aReader
, &aResult
->mType
) &&
1260 ReadParam(aReader
, &aResult
->mSource
) &&
1261 ReadParam(aReader
, &aResult
->mScreenOffset
) &&
1262 ReadParam(aReader
, &aResult
->mFocusPoint
) &&
1263 ReadParam(aReader
, &aResult
->mLocalFocusPoint
) &&
1264 ReadParam(aReader
, &aResult
->mCurrentSpan
) &&
1265 ReadParam(aReader
, &aResult
->mPreviousSpan
) &&
1266 ReadParam(aReader
, &aResult
->mLineOrPageDeltaY
) &&
1267 ReadParam(aReader
, &aResult
->mHandledByAPZ
);
1272 struct ParamTraits
<mozilla::TapGestureInput::TapGestureType
>
1273 : public ContiguousEnumSerializerInclusive
<
1274 mozilla::TapGestureInput::TapGestureType
,
1275 mozilla::TapGestureInput::TapGestureType::TAPGESTURE_LONG
,
1276 mozilla::TapGestureInput::sHighestTapGestureType
> {};
1279 struct ParamTraits
<mozilla::TapGestureInput
> {
1280 using paramType
= mozilla::TapGestureInput
;
1282 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1283 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1284 WriteParam(aWriter
, aParam
.mType
);
1285 WriteParam(aWriter
, aParam
.mPoint
);
1286 WriteParam(aWriter
, aParam
.mLocalPoint
);
1289 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1290 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1291 ReadParam(aReader
, &aResult
->mType
) &&
1292 ReadParam(aReader
, &aResult
->mPoint
) &&
1293 ReadParam(aReader
, &aResult
->mLocalPoint
);
1298 struct ParamTraits
<mozilla::ScrollWheelInput::ScrollDeltaType
>
1299 : public ContiguousEnumSerializerInclusive
<
1300 mozilla::ScrollWheelInput::ScrollDeltaType
,
1301 mozilla::ScrollWheelInput::ScrollDeltaType::SCROLLDELTA_LINE
,
1302 mozilla::ScrollWheelInput::sHighestScrollDeltaType
> {};
1305 struct ParamTraits
<mozilla::ScrollWheelInput::ScrollMode
>
1306 : public ContiguousEnumSerializerInclusive
<
1307 mozilla::ScrollWheelInput::ScrollMode
,
1308 mozilla::ScrollWheelInput::ScrollMode::SCROLLMODE_INSTANT
,
1309 mozilla::ScrollWheelInput::sHighestScrollMode
> {};
1312 struct ParamTraits
<mozilla::WheelDeltaAdjustmentStrategy
>
1313 : public ContiguousEnumSerializer
<
1314 mozilla::WheelDeltaAdjustmentStrategy
,
1315 mozilla::WheelDeltaAdjustmentStrategy(0),
1316 mozilla::WheelDeltaAdjustmentStrategy::eSentinel
> {};
1319 struct ParamTraits
<mozilla::layers::APZWheelAction
>
1320 : public ContiguousEnumSerializerInclusive
<
1321 mozilla::layers::APZWheelAction
,
1322 mozilla::layers::APZWheelAction::Scroll
,
1323 mozilla::layers::kHighestAPZWheelAction
> {};
1326 struct ParamTraits
<mozilla::ScrollWheelInput
> {
1327 using paramType
= mozilla::ScrollWheelInput
;
1329 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1330 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1331 WriteParam(aWriter
, aParam
.mDeltaType
);
1332 WriteParam(aWriter
, aParam
.mScrollMode
);
1333 WriteParam(aWriter
, aParam
.mOrigin
);
1334 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1335 WriteParam(aWriter
, aParam
.mDeltaX
);
1336 WriteParam(aWriter
, aParam
.mDeltaY
);
1337 WriteParam(aWriter
, aParam
.mWheelTicksX
);
1338 WriteParam(aWriter
, aParam
.mWheelTicksY
);
1339 WriteParam(aWriter
, aParam
.mLocalOrigin
);
1340 WriteParam(aWriter
, aParam
.mLineOrPageDeltaX
);
1341 WriteParam(aWriter
, aParam
.mLineOrPageDeltaY
);
1342 WriteParam(aWriter
, aParam
.mScrollSeriesNumber
);
1343 WriteParam(aWriter
, aParam
.mUserDeltaMultiplierX
);
1344 WriteParam(aWriter
, aParam
.mUserDeltaMultiplierY
);
1345 WriteParam(aWriter
, aParam
.mMayHaveMomentum
);
1346 WriteParam(aWriter
, aParam
.mIsMomentum
);
1347 WriteParam(aWriter
, aParam
.mAllowToOverrideSystemScrollSpeed
);
1348 WriteParam(aWriter
, aParam
.mWheelDeltaAdjustmentStrategy
);
1349 WriteParam(aWriter
, aParam
.mAPZAction
);
1352 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1353 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1354 ReadParam(aReader
, &aResult
->mDeltaType
) &&
1355 ReadParam(aReader
, &aResult
->mScrollMode
) &&
1356 ReadParam(aReader
, &aResult
->mOrigin
) &&
1357 ReadParam(aReader
, &aResult
->mHandledByAPZ
) &&
1358 ReadParam(aReader
, &aResult
->mDeltaX
) &&
1359 ReadParam(aReader
, &aResult
->mDeltaY
) &&
1360 ReadParam(aReader
, &aResult
->mWheelTicksX
) &&
1361 ReadParam(aReader
, &aResult
->mWheelTicksY
) &&
1362 ReadParam(aReader
, &aResult
->mLocalOrigin
) &&
1363 ReadParam(aReader
, &aResult
->mLineOrPageDeltaX
) &&
1364 ReadParam(aReader
, &aResult
->mLineOrPageDeltaY
) &&
1365 ReadParam(aReader
, &aResult
->mScrollSeriesNumber
) &&
1366 ReadParam(aReader
, &aResult
->mUserDeltaMultiplierX
) &&
1367 ReadParam(aReader
, &aResult
->mUserDeltaMultiplierY
) &&
1368 ReadParam(aReader
, &aResult
->mMayHaveMomentum
) &&
1369 ReadParam(aReader
, &aResult
->mIsMomentum
) &&
1370 ReadParam(aReader
, &aResult
->mAllowToOverrideSystemScrollSpeed
) &&
1371 ReadParam(aReader
, &aResult
->mWheelDeltaAdjustmentStrategy
) &&
1372 ReadParam(aReader
, &aResult
->mAPZAction
);
1377 struct ParamTraits
<mozilla::KeyboardInput::KeyboardEventType
>
1378 : public ContiguousEnumSerializer
<
1379 mozilla::KeyboardInput::KeyboardEventType
,
1380 mozilla::KeyboardInput::KeyboardEventType::KEY_DOWN
,
1381 mozilla::KeyboardInput::KeyboardEventType::KEY_SENTINEL
> {};
1384 struct ParamTraits
<mozilla::KeyboardInput
> {
1385 using paramType
= mozilla::KeyboardInput
;
1387 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1388 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1389 WriteParam(aWriter
, aParam
.mType
);
1390 WriteParam(aWriter
, aParam
.mKeyCode
);
1391 WriteParam(aWriter
, aParam
.mCharCode
);
1392 WriteParam(aWriter
, aParam
.mShortcutCandidates
);
1393 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1396 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1397 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1398 ReadParam(aReader
, &aResult
->mType
) &&
1399 ReadParam(aReader
, &aResult
->mKeyCode
) &&
1400 ReadParam(aReader
, &aResult
->mCharCode
) &&
1401 ReadParam(aReader
, &aResult
->mShortcutCandidates
) &&
1402 ReadParam(aReader
, &aResult
->mHandledByAPZ
);
1408 #endif // nsGUIEventIPC_h__