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
> {
383 using paramType
= mozilla::ShortcutKeyCandidate
;
385 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
386 WriteParam(aWriter
, aParam
.mCharCode
);
387 WriteParam(aWriter
, aParam
.mIgnoreShift
);
390 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
391 return ReadParam(aReader
, &aResult
->mCharCode
) &&
392 ReadParam(aReader
, &aResult
->mIgnoreShift
);
397 struct ParamTraits
<mozilla::WidgetKeyboardEvent
> {
398 using paramType
= mozilla::WidgetKeyboardEvent
;
400 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
401 WriteParam(aWriter
, static_cast<const mozilla::WidgetInputEvent
&>(aParam
));
403 static_cast<mozilla::KeyNameIndexType
>(aParam
.mKeyNameIndex
));
405 static_cast<mozilla::CodeNameIndexType
>(aParam
.mCodeNameIndex
));
406 WriteParam(aWriter
, aParam
.mKeyValue
);
407 WriteParam(aWriter
, aParam
.mCodeValue
);
408 WriteParam(aWriter
, aParam
.mKeyCode
);
409 WriteParam(aWriter
, aParam
.mCharCode
);
410 WriteParam(aWriter
, aParam
.mPseudoCharCode
);
411 WriteParam(aWriter
, aParam
.mAlternativeCharCodes
);
412 WriteParam(aWriter
, aParam
.mIsRepeat
);
413 WriteParam(aWriter
, aParam
.mLocation
);
414 WriteParam(aWriter
, aParam
.mUniqueId
);
415 WriteParam(aWriter
, aParam
.mIsSynthesizedByTIP
);
416 WriteParam(aWriter
, aParam
.mMaybeSkippableInRemoteProcess
);
418 // An OS-specific native event might be attached in |mNativeKeyEvent|, but
419 // that cannot be copied across process boundaries.
421 WriteParam(aWriter
, aParam
.mEditCommandsForSingleLineEditor
);
422 WriteParam(aWriter
, aParam
.mEditCommandsForMultiLineEditor
);
423 WriteParam(aWriter
, aParam
.mEditCommandsForRichTextEditor
);
424 WriteParam(aWriter
, aParam
.mEditCommandsForSingleLineEditorInitialized
);
425 WriteParam(aWriter
, aParam
.mEditCommandsForMultiLineEditorInitialized
);
426 WriteParam(aWriter
, aParam
.mEditCommandsForRichTextEditorInitialized
);
429 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
430 mozilla::KeyNameIndexType keyNameIndex
= 0;
431 mozilla::CodeNameIndexType codeNameIndex
= 0;
432 if (ReadParam(aReader
, static_cast<mozilla::WidgetInputEvent
*>(aResult
)) &&
433 ReadParam(aReader
, &keyNameIndex
) &&
434 ReadParam(aReader
, &codeNameIndex
) &&
435 ReadParam(aReader
, &aResult
->mKeyValue
) &&
436 ReadParam(aReader
, &aResult
->mCodeValue
) &&
437 ReadParam(aReader
, &aResult
->mKeyCode
) &&
438 ReadParam(aReader
, &aResult
->mCharCode
) &&
439 ReadParam(aReader
, &aResult
->mPseudoCharCode
) &&
440 ReadParam(aReader
, &aResult
->mAlternativeCharCodes
) &&
441 ReadParam(aReader
, &aResult
->mIsRepeat
) &&
442 ReadParam(aReader
, &aResult
->mLocation
) &&
443 ReadParam(aReader
, &aResult
->mUniqueId
) &&
444 ReadParam(aReader
, &aResult
->mIsSynthesizedByTIP
) &&
445 ReadParam(aReader
, &aResult
->mMaybeSkippableInRemoteProcess
) &&
446 ReadParam(aReader
, &aResult
->mEditCommandsForSingleLineEditor
) &&
447 ReadParam(aReader
, &aResult
->mEditCommandsForMultiLineEditor
) &&
448 ReadParam(aReader
, &aResult
->mEditCommandsForRichTextEditor
) &&
450 &aResult
->mEditCommandsForSingleLineEditorInitialized
) &&
452 &aResult
->mEditCommandsForMultiLineEditorInitialized
) &&
454 &aResult
->mEditCommandsForRichTextEditorInitialized
)) {
455 aResult
->mKeyNameIndex
= static_cast<mozilla::KeyNameIndex
>(keyNameIndex
);
456 aResult
->mCodeNameIndex
=
457 static_cast<mozilla::CodeNameIndex
>(codeNameIndex
);
458 aResult
->mNativeKeyEvent
= nullptr;
466 struct ParamTraits
<mozilla::TextRangeStyle
> {
467 using paramType
= mozilla::TextRangeStyle
;
469 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
470 WriteParam(aWriter
, aParam
.mDefinedStyles
);
471 WriteParam(aWriter
, static_cast<mozilla::TextRangeStyle::LineStyleType
>(
473 WriteParam(aWriter
, aParam
.mIsBoldLine
);
474 WriteParam(aWriter
, aParam
.mForegroundColor
);
475 WriteParam(aWriter
, aParam
.mBackgroundColor
);
476 WriteParam(aWriter
, aParam
.mUnderlineColor
);
479 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
480 mozilla::TextRangeStyle::LineStyleType lineStyle
;
481 if (!ReadParam(aReader
, &aResult
->mDefinedStyles
) ||
482 !ReadParam(aReader
, &lineStyle
) ||
483 !ReadParam(aReader
, &aResult
->mIsBoldLine
) ||
484 !ReadParam(aReader
, &aResult
->mForegroundColor
) ||
485 !ReadParam(aReader
, &aResult
->mBackgroundColor
) ||
486 !ReadParam(aReader
, &aResult
->mUnderlineColor
)) {
489 aResult
->mLineStyle
= mozilla::TextRangeStyle::ToLineStyle(lineStyle
);
495 struct ParamTraits
<mozilla::TextRange
> {
496 using paramType
= mozilla::TextRange
;
498 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
499 WriteParam(aWriter
, aParam
.mStartOffset
);
500 WriteParam(aWriter
, aParam
.mEndOffset
);
501 WriteParam(aWriter
, mozilla::ToRawTextRangeType(aParam
.mRangeType
));
502 WriteParam(aWriter
, aParam
.mRangeStyle
);
505 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
506 mozilla::RawTextRangeType rawTextRangeType
;
507 if (ReadParam(aReader
, &aResult
->mStartOffset
) &&
508 ReadParam(aReader
, &aResult
->mEndOffset
) &&
509 ReadParam(aReader
, &rawTextRangeType
) &&
510 ReadParam(aReader
, &aResult
->mRangeStyle
)) {
511 aResult
->mRangeType
= mozilla::ToTextRangeType(rawTextRangeType
);
519 struct ParamTraits
<mozilla::TextRangeArray
> {
520 using paramType
= mozilla::TextRangeArray
;
522 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
523 WriteParam(aWriter
, aParam
.Length());
524 for (uint32_t index
= 0; index
< aParam
.Length(); index
++) {
525 WriteParam(aWriter
, aParam
[index
]);
529 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
530 paramType::size_type length
;
531 if (!ReadParam(aReader
, &length
)) {
534 for (uint32_t index
= 0; index
< length
; index
++) {
535 mozilla::TextRange textRange
;
536 if (!ReadParam(aReader
, &textRange
)) {
540 aResult
->AppendElement(textRange
);
547 struct ParamTraits
<mozilla::WidgetCompositionEvent
> {
548 using paramType
= mozilla::WidgetCompositionEvent
;
550 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
551 WriteParam(aWriter
, static_cast<const mozilla::WidgetGUIEvent
&>(aParam
));
552 WriteParam(aWriter
, aParam
.mData
);
553 WriteParam(aWriter
, aParam
.mNativeIMEContext
);
554 WriteParam(aWriter
, aParam
.mCompositionId
);
555 bool hasRanges
= !!aParam
.mRanges
;
556 WriteParam(aWriter
, hasRanges
);
558 WriteParam(aWriter
, *aParam
.mRanges
.get());
562 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
564 if (!ReadParam(aReader
, static_cast<mozilla::WidgetGUIEvent
*>(aResult
)) ||
565 !ReadParam(aReader
, &aResult
->mData
) ||
566 !ReadParam(aReader
, &aResult
->mNativeIMEContext
) ||
567 !ReadParam(aReader
, &aResult
->mCompositionId
) ||
568 !ReadParam(aReader
, &hasRanges
)) {
573 aResult
->mRanges
= nullptr;
575 aResult
->mRanges
= new mozilla::TextRangeArray();
576 if (!ReadParam(aReader
, aResult
->mRanges
.get())) {
585 struct ParamTraits
<mozilla::FontRange
> {
586 using paramType
= mozilla::FontRange
;
588 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
589 WriteParam(aWriter
, aParam
.mStartOffset
);
590 WriteParam(aWriter
, aParam
.mFontName
);
591 WriteParam(aWriter
, aParam
.mFontSize
);
594 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
595 return ReadParam(aReader
, &aResult
->mStartOffset
) &&
596 ReadParam(aReader
, &aResult
->mFontName
) &&
597 ReadParam(aReader
, &aResult
->mFontSize
);
602 struct ParamTraits
<mozilla::WidgetSelectionEvent
> {
603 using paramType
= mozilla::WidgetSelectionEvent
;
605 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
606 WriteParam(aWriter
, static_cast<const mozilla::WidgetGUIEvent
&>(aParam
));
607 WriteParam(aWriter
, aParam
.mOffset
);
608 WriteParam(aWriter
, aParam
.mLength
);
609 WriteParam(aWriter
, aParam
.mReversed
);
610 WriteParam(aWriter
, aParam
.mExpandToClusterBoundary
);
611 WriteParam(aWriter
, aParam
.mSucceeded
);
612 WriteParam(aWriter
, aParam
.mUseNativeLineBreak
);
615 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
616 return ReadParam(aReader
, static_cast<mozilla::WidgetGUIEvent
*>(aResult
)) &&
617 ReadParam(aReader
, &aResult
->mOffset
) &&
618 ReadParam(aReader
, &aResult
->mLength
) &&
619 ReadParam(aReader
, &aResult
->mReversed
) &&
620 ReadParam(aReader
, &aResult
->mExpandToClusterBoundary
) &&
621 ReadParam(aReader
, &aResult
->mSucceeded
) &&
622 ReadParam(aReader
, &aResult
->mUseNativeLineBreak
);
627 struct ParamTraits
<mozilla::widget::IMENotificationRequests
> {
628 using paramType
= mozilla::widget::IMENotificationRequests
;
630 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
631 WriteParam(aWriter
, aParam
.mWantUpdates
);
634 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
635 return ReadParam(aReader
, &aResult
->mWantUpdates
);
640 struct ParamTraits
<mozilla::widget::NativeIMEContext
> {
641 using paramType
= mozilla::widget::NativeIMEContext
;
643 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
644 WriteParam(aWriter
, aParam
.mRawNativeIMEContext
);
645 WriteParam(aWriter
, aParam
.mOriginProcessID
);
648 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
649 return ReadParam(aReader
, &aResult
->mRawNativeIMEContext
) &&
650 ReadParam(aReader
, &aResult
->mOriginProcessID
);
655 struct ParamTraits
<mozilla::widget::IMENotification::SelectionChangeDataBase
> {
656 using paramType
= mozilla::widget::IMENotification::SelectionChangeDataBase
;
658 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
659 MOZ_RELEASE_ASSERT(aParam
.mString
);
660 WriteParam(aWriter
, aParam
.mOffset
);
661 WriteParam(aWriter
, *aParam
.mString
);
662 WriteParam(aWriter
, aParam
.mWritingModeBits
);
663 WriteParam(aWriter
, aParam
.mIsInitialized
);
664 WriteParam(aWriter
, aParam
.mHasRange
);
665 WriteParam(aWriter
, aParam
.mReversed
);
666 WriteParam(aWriter
, aParam
.mCausedByComposition
);
667 WriteParam(aWriter
, aParam
.mCausedBySelectionEvent
);
668 WriteParam(aWriter
, aParam
.mOccurredDuringComposition
);
671 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
672 aResult
->mString
= new nsString();
673 return ReadParam(aReader
, &aResult
->mOffset
) &&
674 ReadParam(aReader
, aResult
->mString
) &&
675 ReadParam(aReader
, &aResult
->mWritingModeBits
) &&
676 ReadParam(aReader
, &aResult
->mIsInitialized
) &&
677 ReadParam(aReader
, &aResult
->mHasRange
) &&
678 ReadParam(aReader
, &aResult
->mReversed
) &&
679 ReadParam(aReader
, &aResult
->mCausedByComposition
) &&
680 ReadParam(aReader
, &aResult
->mCausedBySelectionEvent
) &&
681 ReadParam(aReader
, &aResult
->mOccurredDuringComposition
);
686 struct ParamTraits
<mozilla::widget::IMENotification::TextChangeDataBase
> {
687 using paramType
= mozilla::widget::IMENotification::TextChangeDataBase
;
689 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
690 WriteParam(aWriter
, aParam
.mStartOffset
);
691 WriteParam(aWriter
, aParam
.mRemovedEndOffset
);
692 WriteParam(aWriter
, aParam
.mAddedEndOffset
);
693 WriteParam(aWriter
, aParam
.mCausedOnlyByComposition
);
694 WriteParam(aWriter
, aParam
.mIncludingChangesDuringComposition
);
695 WriteParam(aWriter
, aParam
.mIncludingChangesWithoutComposition
);
698 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
699 return ReadParam(aReader
, &aResult
->mStartOffset
) &&
700 ReadParam(aReader
, &aResult
->mRemovedEndOffset
) &&
701 ReadParam(aReader
, &aResult
->mAddedEndOffset
) &&
702 ReadParam(aReader
, &aResult
->mCausedOnlyByComposition
) &&
703 ReadParam(aReader
, &aResult
->mIncludingChangesDuringComposition
) &&
704 ReadParam(aReader
, &aResult
->mIncludingChangesWithoutComposition
);
709 struct ParamTraits
<mozilla::widget::IMENotification::MouseButtonEventData
> {
710 using paramType
= mozilla::widget::IMENotification::MouseButtonEventData
;
712 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
713 WriteParam(aWriter
, aParam
.mEventMessage
);
714 WriteParam(aWriter
, aParam
.mOffset
);
715 WriteParam(aWriter
, aParam
.mCursorPos
);
716 WriteParam(aWriter
, aParam
.mCharRect
);
717 WriteParam(aWriter
, aParam
.mButton
);
718 WriteParam(aWriter
, aParam
.mButtons
);
719 WriteParam(aWriter
, aParam
.mModifiers
);
722 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
723 return ReadParam(aReader
, &aResult
->mEventMessage
) &&
724 ReadParam(aReader
, &aResult
->mOffset
) &&
725 ReadParam(aReader
, &aResult
->mCursorPos
) &&
726 ReadParam(aReader
, &aResult
->mCharRect
) &&
727 ReadParam(aReader
, &aResult
->mButton
) &&
728 ReadParam(aReader
, &aResult
->mButtons
) &&
729 ReadParam(aReader
, &aResult
->mModifiers
);
734 struct ParamTraits
<mozilla::widget::IMENotification
> {
735 using paramType
= mozilla::widget::IMENotification
;
737 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
739 static_cast<mozilla::widget::IMEMessageType
>(aParam
.mMessage
));
740 switch (aParam
.mMessage
) {
741 case mozilla::widget::NOTIFY_IME_OF_SELECTION_CHANGE
:
742 WriteParam(aWriter
, aParam
.mSelectionChangeData
);
744 case mozilla::widget::NOTIFY_IME_OF_TEXT_CHANGE
:
745 WriteParam(aWriter
, aParam
.mTextChangeData
);
747 case mozilla::widget::NOTIFY_IME_OF_MOUSE_BUTTON_EVENT
:
748 WriteParam(aWriter
, aParam
.mMouseButtonEventData
);
755 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
756 mozilla::widget::IMEMessageType IMEMessage
= 0;
757 if (!ReadParam(aReader
, &IMEMessage
)) {
760 aResult
->mMessage
= static_cast<mozilla::widget::IMEMessage
>(IMEMessage
);
761 switch (aResult
->mMessage
) {
762 case mozilla::widget::NOTIFY_IME_OF_SELECTION_CHANGE
:
763 return ReadParam(aReader
, &aResult
->mSelectionChangeData
);
764 case mozilla::widget::NOTIFY_IME_OF_TEXT_CHANGE
:
765 return ReadParam(aReader
, &aResult
->mTextChangeData
);
766 case mozilla::widget::NOTIFY_IME_OF_MOUSE_BUTTON_EVENT
:
767 return ReadParam(aReader
, &aResult
->mMouseButtonEventData
);
775 struct ParamTraits
<mozilla::widget::IMEEnabled
>
776 : ContiguousEnumSerializer
<mozilla::widget::IMEEnabled
,
777 mozilla::widget::IMEEnabled::Disabled
,
778 mozilla::widget::IMEEnabled::Unknown
> {};
781 struct ParamTraits
<mozilla::widget::IMEState::Open
>
782 : ContiguousEnumSerializerInclusive
<
783 mozilla::widget::IMEState::Open
,
784 mozilla::widget::IMEState::Open::OPEN_STATE_NOT_SUPPORTED
,
785 mozilla::widget::IMEState::Open::CLOSED
> {};
788 struct ParamTraits
<mozilla::widget::IMEState
> {
789 using paramType
= mozilla::widget::IMEState
;
791 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
792 WriteParam(aWriter
, aParam
.mEnabled
);
793 WriteParam(aWriter
, aParam
.mOpen
);
796 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
797 return ReadParam(aReader
, &aResult
->mEnabled
) &&
798 ReadParam(aReader
, &aResult
->mOpen
);
803 struct ParamTraits
<mozilla::widget::InputContext::Origin
>
804 : ContiguousEnumSerializerInclusive
<
805 mozilla::widget::InputContext::Origin
,
806 mozilla::widget::InputContext::Origin::ORIGIN_MAIN
,
807 mozilla::widget::InputContext::Origin::ORIGIN_CONTENT
> {};
810 struct ParamTraits
<mozilla::widget::InputContext
> {
811 using paramType
= mozilla::widget::InputContext
;
813 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
814 WriteParam(aWriter
, aParam
.mIMEState
);
815 WriteParam(aWriter
, aParam
.mHTMLInputType
);
816 WriteParam(aWriter
, aParam
.mHTMLInputMode
);
817 WriteParam(aWriter
, aParam
.mActionHint
);
818 WriteParam(aWriter
, aParam
.mAutocapitalize
);
819 WriteParam(aWriter
, aParam
.mOrigin
);
820 WriteParam(aWriter
, aParam
.mHasHandledUserInput
);
821 WriteParam(aWriter
, aParam
.mInPrivateBrowsing
);
822 mozilla::ipc::WriteIPDLParam(aWriter
, aWriter
->GetActor(), aParam
.mURI
);
825 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
826 return ReadParam(aReader
, &aResult
->mIMEState
) &&
827 ReadParam(aReader
, &aResult
->mHTMLInputType
) &&
828 ReadParam(aReader
, &aResult
->mHTMLInputMode
) &&
829 ReadParam(aReader
, &aResult
->mActionHint
) &&
830 ReadParam(aReader
, &aResult
->mAutocapitalize
) &&
831 ReadParam(aReader
, &aResult
->mOrigin
) &&
832 ReadParam(aReader
, &aResult
->mHasHandledUserInput
) &&
833 ReadParam(aReader
, &aResult
->mInPrivateBrowsing
) &&
834 mozilla::ipc::ReadIPDLParam(aReader
, aReader
->GetActor(),
835 address_of(aResult
->mURI
));
840 struct ParamTraits
<mozilla::widget::InputContextAction::Cause
>
841 : ContiguousEnumSerializerInclusive
<
842 mozilla::widget::InputContextAction::Cause
,
843 mozilla::widget::InputContextAction::Cause::CAUSE_UNKNOWN
,
844 mozilla::widget::InputContextAction::Cause::
845 CAUSE_UNKNOWN_DURING_KEYBOARD_INPUT
> {};
848 struct ParamTraits
<mozilla::widget::InputContextAction::FocusChange
>
849 : ContiguousEnumSerializerInclusive
<
850 mozilla::widget::InputContextAction::FocusChange
,
851 mozilla::widget::InputContextAction::FocusChange::FOCUS_NOT_CHANGED
,
852 mozilla::widget::InputContextAction::FocusChange::WIDGET_CREATED
> {};
855 struct ParamTraits
<mozilla::widget::InputContextAction
> {
856 using paramType
= mozilla::widget::InputContextAction
;
858 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
859 WriteParam(aWriter
, aParam
.mCause
);
860 WriteParam(aWriter
, aParam
.mFocusChange
);
863 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
864 return ReadParam(aReader
, &aResult
->mCause
) &&
865 ReadParam(aReader
, &aResult
->mFocusChange
);
870 struct ParamTraits
<mozilla::WritingMode
> {
871 using paramType
= mozilla::WritingMode
;
873 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
874 WriteParam(aWriter
, aParam
.mWritingMode
.bits
);
877 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
878 return ReadParam(aReader
, &aResult
->mWritingMode
.bits
);
883 struct ParamTraits
<mozilla::ContentCache::Selection
> {
884 using paramType
= mozilla::ContentCache::Selection
;
886 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
887 WriteParam(aWriter
, aParam
.mAnchor
);
888 WriteParam(aWriter
, aParam
.mFocus
);
889 WriteParam(aWriter
, aParam
.mWritingMode
);
890 WriteParam(aWriter
, aParam
.mHasRange
);
891 WriteParam(aWriter
, aParam
.mAnchorCharRects
[0]);
892 WriteParam(aWriter
, aParam
.mAnchorCharRects
[1]);
893 WriteParam(aWriter
, aParam
.mFocusCharRects
[0]);
894 WriteParam(aWriter
, aParam
.mFocusCharRects
[1]);
895 WriteParam(aWriter
, aParam
.mRect
);
898 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
899 return ReadParam(aReader
, &aResult
->mAnchor
) &&
900 ReadParam(aReader
, &aResult
->mFocus
) &&
901 ReadParam(aReader
, &aResult
->mWritingMode
) &&
902 ReadParam(aReader
, &aResult
->mHasRange
) &&
903 ReadParam(aReader
, &aResult
->mAnchorCharRects
[0]) &&
904 ReadParam(aReader
, &aResult
->mAnchorCharRects
[1]) &&
905 ReadParam(aReader
, &aResult
->mFocusCharRects
[0]) &&
906 ReadParam(aReader
, &aResult
->mFocusCharRects
[1]) &&
907 ReadParam(aReader
, &aResult
->mRect
);
912 struct ParamTraits
<mozilla::ContentCache::Caret
> {
913 using paramType
= mozilla::ContentCache::Caret
;
915 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
916 WriteParam(aWriter
, aParam
.mOffset
);
917 WriteParam(aWriter
, aParam
.mRect
);
920 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
921 return ReadParam(aReader
, &aResult
->mOffset
) &&
922 ReadParam(aReader
, &aResult
->mRect
);
927 struct ParamTraits
<mozilla::ContentCache::TextRectArray
> {
928 using paramType
= mozilla::ContentCache::TextRectArray
;
930 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
931 WriteParam(aWriter
, aParam
.mStart
);
932 WriteParam(aWriter
, aParam
.mRects
);
935 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
936 return ReadParam(aReader
, &aResult
->mStart
) &&
937 ReadParam(aReader
, &aResult
->mRects
);
942 struct ParamTraits
<mozilla::ContentCache
> {
943 using paramType
= mozilla::ContentCache
;
945 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
946 WriteParam(aWriter
, aParam
.mCompositionStart
);
947 WriteParam(aWriter
, aParam
.mText
);
948 WriteParam(aWriter
, aParam
.mSelection
);
949 WriteParam(aWriter
, aParam
.mFirstCharRect
);
950 WriteParam(aWriter
, aParam
.mCaret
);
951 WriteParam(aWriter
, aParam
.mTextRectArray
);
952 WriteParam(aWriter
, aParam
.mLastCommitStringTextRectArray
);
953 WriteParam(aWriter
, aParam
.mEditorRect
);
956 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
957 return ReadParam(aReader
, &aResult
->mCompositionStart
) &&
958 ReadParam(aReader
, &aResult
->mText
) &&
959 ReadParam(aReader
, &aResult
->mSelection
) &&
960 ReadParam(aReader
, &aResult
->mFirstCharRect
) &&
961 ReadParam(aReader
, &aResult
->mCaret
) &&
962 ReadParam(aReader
, &aResult
->mTextRectArray
) &&
963 ReadParam(aReader
, &aResult
->mLastCommitStringTextRectArray
) &&
964 ReadParam(aReader
, &aResult
->mEditorRect
);
969 struct ParamTraits
<mozilla::widget::CandidateWindowPosition
> {
970 using paramType
= mozilla::widget::CandidateWindowPosition
;
972 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
973 WriteParam(aWriter
, aParam
.mPoint
);
974 WriteParam(aWriter
, aParam
.mRect
);
975 WriteParam(aWriter
, aParam
.mExcludeRect
);
978 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
979 return ReadParam(aReader
, &aResult
->mPoint
) &&
980 ReadParam(aReader
, &aResult
->mRect
) &&
981 ReadParam(aReader
, &aResult
->mExcludeRect
);
988 struct ParamTraits
<mozilla::InputType
>
989 : public ContiguousEnumSerializerInclusive
<
990 mozilla::InputType
, mozilla::InputType::MULTITOUCH_INPUT
,
991 mozilla::kHighestInputType
> {};
994 struct ParamTraits
<mozilla::InputData
> {
995 using paramType
= mozilla::InputData
;
997 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
998 WriteParam(aWriter
, aParam
.mInputType
);
999 WriteParam(aWriter
, aParam
.mTimeStamp
);
1000 WriteParam(aWriter
, aParam
.modifiers
);
1001 WriteParam(aWriter
, aParam
.mFocusSequenceNumber
);
1002 WriteParam(aWriter
, aParam
.mLayersId
);
1005 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1006 return ReadParam(aReader
, &aResult
->mInputType
) &&
1007 ReadParam(aReader
, &aResult
->mTimeStamp
) &&
1008 ReadParam(aReader
, &aResult
->modifiers
) &&
1009 ReadParam(aReader
, &aResult
->mFocusSequenceNumber
) &&
1010 ReadParam(aReader
, &aResult
->mLayersId
);
1015 struct ParamTraits
<mozilla::SingleTouchData::HistoricalTouchData
> {
1016 using paramType
= mozilla::SingleTouchData::HistoricalTouchData
;
1018 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1019 WriteParam(aWriter
, aParam
.mTimeStamp
);
1020 WriteParam(aWriter
, aParam
.mScreenPoint
);
1021 WriteParam(aWriter
, aParam
.mLocalScreenPoint
);
1022 WriteParam(aWriter
, aParam
.mRadius
);
1023 WriteParam(aWriter
, aParam
.mRotationAngle
);
1024 WriteParam(aWriter
, aParam
.mForce
);
1027 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1028 return (ReadParam(aReader
, &aResult
->mTimeStamp
) &&
1029 ReadParam(aReader
, &aResult
->mScreenPoint
) &&
1030 ReadParam(aReader
, &aResult
->mLocalScreenPoint
) &&
1031 ReadParam(aReader
, &aResult
->mRadius
) &&
1032 ReadParam(aReader
, &aResult
->mRotationAngle
) &&
1033 ReadParam(aReader
, &aResult
->mForce
));
1038 struct ParamTraits
<mozilla::SingleTouchData
> {
1039 using paramType
= mozilla::SingleTouchData
;
1041 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1042 WriteParam(aWriter
, aParam
.mHistoricalData
);
1043 WriteParam(aWriter
, aParam
.mIdentifier
);
1044 WriteParam(aWriter
, aParam
.mScreenPoint
);
1045 WriteParam(aWriter
, aParam
.mLocalScreenPoint
);
1046 WriteParam(aWriter
, aParam
.mRadius
);
1047 WriteParam(aWriter
, aParam
.mRotationAngle
);
1048 WriteParam(aWriter
, aParam
.mForce
);
1049 WriteParam(aWriter
, aParam
.mTiltX
);
1050 WriteParam(aWriter
, aParam
.mTiltY
);
1051 WriteParam(aWriter
, aParam
.mTwist
);
1054 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1055 return (ReadParam(aReader
, &aResult
->mHistoricalData
) &&
1056 ReadParam(aReader
, &aResult
->mIdentifier
) &&
1057 ReadParam(aReader
, &aResult
->mScreenPoint
) &&
1058 ReadParam(aReader
, &aResult
->mLocalScreenPoint
) &&
1059 ReadParam(aReader
, &aResult
->mRadius
) &&
1060 ReadParam(aReader
, &aResult
->mRotationAngle
) &&
1061 ReadParam(aReader
, &aResult
->mForce
) &&
1062 ReadParam(aReader
, &aResult
->mTiltX
) &&
1063 ReadParam(aReader
, &aResult
->mTiltY
) &&
1064 ReadParam(aReader
, &aResult
->mTwist
));
1069 struct ParamTraits
<mozilla::MultiTouchInput::MultiTouchType
>
1070 : public ContiguousEnumSerializerInclusive
<
1071 mozilla::MultiTouchInput::MultiTouchType
,
1072 mozilla::MultiTouchInput::MultiTouchType::MULTITOUCH_START
,
1073 mozilla::MultiTouchInput::sHighestMultiTouchType
> {};
1076 struct ParamTraits
<mozilla::MultiTouchInput
> {
1077 using paramType
= mozilla::MultiTouchInput
;
1079 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1080 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1081 WriteParam(aWriter
, aParam
.mType
);
1082 WriteParam(aWriter
, aParam
.mTouches
);
1083 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1084 WriteParam(aWriter
, aParam
.mScreenOffset
);
1085 WriteParam(aWriter
, aParam
.mButton
);
1086 WriteParam(aWriter
, aParam
.mButtons
);
1089 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1090 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1091 ReadParam(aReader
, &aResult
->mType
) &&
1092 ReadParam(aReader
, &aResult
->mTouches
) &&
1093 ReadParam(aReader
, &aResult
->mHandledByAPZ
) &&
1094 ReadParam(aReader
, &aResult
->mScreenOffset
) &&
1095 ReadParam(aReader
, &aResult
->mButton
) &&
1096 ReadParam(aReader
, &aResult
->mButtons
);
1101 struct ParamTraits
<mozilla::MouseInput::MouseType
>
1102 : public ContiguousEnumSerializerInclusive
<
1103 mozilla::MouseInput::MouseType
,
1104 mozilla::MouseInput::MouseType::MOUSE_NONE
,
1105 mozilla::MouseInput::sHighestMouseType
> {};
1108 struct ParamTraits
<mozilla::MouseInput::ButtonType
>
1109 : public ContiguousEnumSerializerInclusive
<
1110 mozilla::MouseInput::ButtonType
,
1111 mozilla::MouseInput::ButtonType::PRIMARY_BUTTON
,
1112 mozilla::MouseInput::sHighestButtonType
> {};
1115 struct ParamTraits
<mozilla::MouseInput
> {
1116 using paramType
= mozilla::MouseInput
;
1118 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1119 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1120 WriteParam(aWriter
, aParam
.mButtonType
);
1121 WriteParam(aWriter
, aParam
.mType
);
1122 WriteParam(aWriter
, aParam
.mInputSource
);
1123 WriteParam(aWriter
, aParam
.mButtons
);
1124 WriteParam(aWriter
, aParam
.mOrigin
);
1125 WriteParam(aWriter
, aParam
.mLocalOrigin
);
1126 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1127 WriteParam(aWriter
, aParam
.mPreventClickEvent
);
1130 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1131 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1132 ReadParam(aReader
, &aResult
->mButtonType
) &&
1133 ReadParam(aReader
, &aResult
->mType
) &&
1134 ReadParam(aReader
, &aResult
->mInputSource
) &&
1135 ReadParam(aReader
, &aResult
->mButtons
) &&
1136 ReadParam(aReader
, &aResult
->mOrigin
) &&
1137 ReadParam(aReader
, &aResult
->mLocalOrigin
) &&
1138 ReadParam(aReader
, &aResult
->mHandledByAPZ
) &&
1139 ReadParam(aReader
, &aResult
->mPreventClickEvent
);
1144 struct ParamTraits
<mozilla::PanGestureInput::PanGestureType
>
1145 : public ContiguousEnumSerializerInclusive
<
1146 mozilla::PanGestureInput::PanGestureType
,
1147 mozilla::PanGestureInput::PanGestureType::PANGESTURE_MAYSTART
,
1148 mozilla::PanGestureInput::sHighestPanGestureType
> {};
1151 struct ParamTraits
<mozilla::PanGestureInput::PanDeltaType
>
1152 : public ContiguousEnumSerializerInclusive
<
1153 mozilla::PanGestureInput::PanDeltaType
,
1154 mozilla::PanGestureInput::PanDeltaType::PANDELTA_PAGE
,
1155 mozilla::PanGestureInput::sHighestPanDeltaType
> {};
1158 struct ParamTraits
<mozilla::PanGestureInput
>
1159 : BitfieldHelper
<mozilla::PanGestureInput
> {
1160 using paramType
= mozilla::PanGestureInput
;
1162 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1163 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1164 WriteParam(aWriter
, aParam
.mType
);
1165 WriteParam(aWriter
, aParam
.mPanStartPoint
);
1166 WriteParam(aWriter
, aParam
.mPanDisplacement
);
1167 WriteParam(aWriter
, aParam
.mLocalPanStartPoint
);
1168 WriteParam(aWriter
, aParam
.mLocalPanDisplacement
);
1169 WriteParam(aWriter
, aParam
.mLineOrPageDeltaX
);
1170 WriteParam(aWriter
, aParam
.mLineOrPageDeltaY
);
1171 WriteParam(aWriter
, aParam
.mUserDeltaMultiplierX
);
1172 WriteParam(aWriter
, aParam
.mUserDeltaMultiplierY
);
1173 WriteParam(aWriter
, aParam
.mDeltaType
);
1174 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1175 WriteParam(aWriter
, aParam
.mMayTriggerSwipe
);
1176 WriteParam(aWriter
, aParam
.mOverscrollBehaviorAllowsSwipe
);
1177 WriteParam(aWriter
, aParam
.mSimulateMomentum
);
1178 WriteParam(aWriter
, aParam
.mIsNoLineOrPageDelta
);
1181 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1182 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1183 ReadParam(aReader
, &aResult
->mType
) &&
1184 ReadParam(aReader
, &aResult
->mPanStartPoint
) &&
1185 ReadParam(aReader
, &aResult
->mPanDisplacement
) &&
1186 ReadParam(aReader
, &aResult
->mLocalPanStartPoint
) &&
1187 ReadParam(aReader
, &aResult
->mLocalPanDisplacement
) &&
1188 ReadParam(aReader
, &aResult
->mLineOrPageDeltaX
) &&
1189 ReadParam(aReader
, &aResult
->mLineOrPageDeltaY
) &&
1190 ReadParam(aReader
, &aResult
->mUserDeltaMultiplierX
) &&
1191 ReadParam(aReader
, &aResult
->mUserDeltaMultiplierY
) &&
1192 ReadParam(aReader
, &aResult
->mDeltaType
) &&
1193 ReadBoolForBitfield(aReader
, aResult
, ¶mType::SetHandledByAPZ
) &&
1194 ReadBoolForBitfield(aReader
, aResult
,
1195 ¶mType::SetMayTriggerSwipe
) &&
1196 ReadBoolForBitfield(aReader
, aResult
,
1197 ¶mType::SetOverscrollBehaviorAllowsSwipe
) &&
1198 ReadBoolForBitfield(aReader
, aResult
,
1199 ¶mType::SetSimulateMomentum
) &&
1200 ReadBoolForBitfield(aReader
, aResult
,
1201 ¶mType::SetIsNoLineOrPageDelta
);
1206 struct ParamTraits
<mozilla::PinchGestureInput::PinchGestureType
>
1207 : public ContiguousEnumSerializerInclusive
<
1208 mozilla::PinchGestureInput::PinchGestureType
,
1209 mozilla::PinchGestureInput::PinchGestureType::PINCHGESTURE_START
,
1210 mozilla::PinchGestureInput::sHighestPinchGestureType
> {};
1213 struct ParamTraits
<mozilla::PinchGestureInput::PinchGestureSource
>
1214 : public ContiguousEnumSerializerInclusive
<
1215 mozilla::PinchGestureInput::PinchGestureSource
,
1216 // Set the min to TOUCH, to ensure UNKNOWN is never sent over IPC
1217 mozilla::PinchGestureInput::PinchGestureSource::TOUCH
,
1218 mozilla::PinchGestureInput::sHighestPinchGestureSource
> {};
1221 struct ParamTraits
<mozilla::PinchGestureInput
> {
1222 using paramType
= mozilla::PinchGestureInput
;
1224 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1225 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1226 WriteParam(aWriter
, aParam
.mType
);
1227 WriteParam(aWriter
, aParam
.mSource
);
1228 WriteParam(aWriter
, aParam
.mScreenOffset
);
1229 WriteParam(aWriter
, aParam
.mFocusPoint
);
1230 WriteParam(aWriter
, aParam
.mLocalFocusPoint
);
1231 WriteParam(aWriter
, aParam
.mCurrentSpan
);
1232 WriteParam(aWriter
, aParam
.mPreviousSpan
);
1233 WriteParam(aWriter
, aParam
.mLineOrPageDeltaY
);
1234 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1237 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1238 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1239 ReadParam(aReader
, &aResult
->mType
) &&
1240 ReadParam(aReader
, &aResult
->mSource
) &&
1241 ReadParam(aReader
, &aResult
->mScreenOffset
) &&
1242 ReadParam(aReader
, &aResult
->mFocusPoint
) &&
1243 ReadParam(aReader
, &aResult
->mLocalFocusPoint
) &&
1244 ReadParam(aReader
, &aResult
->mCurrentSpan
) &&
1245 ReadParam(aReader
, &aResult
->mPreviousSpan
) &&
1246 ReadParam(aReader
, &aResult
->mLineOrPageDeltaY
) &&
1247 ReadParam(aReader
, &aResult
->mHandledByAPZ
);
1252 struct ParamTraits
<mozilla::TapGestureInput::TapGestureType
>
1253 : public ContiguousEnumSerializerInclusive
<
1254 mozilla::TapGestureInput::TapGestureType
,
1255 mozilla::TapGestureInput::TapGestureType::TAPGESTURE_LONG
,
1256 mozilla::TapGestureInput::sHighestTapGestureType
> {};
1259 struct ParamTraits
<mozilla::TapGestureInput
> {
1260 using paramType
= mozilla::TapGestureInput
;
1262 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1263 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1264 WriteParam(aWriter
, aParam
.mType
);
1265 WriteParam(aWriter
, aParam
.mPoint
);
1266 WriteParam(aWriter
, aParam
.mLocalPoint
);
1269 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1270 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1271 ReadParam(aReader
, &aResult
->mType
) &&
1272 ReadParam(aReader
, &aResult
->mPoint
) &&
1273 ReadParam(aReader
, &aResult
->mLocalPoint
);
1278 struct ParamTraits
<mozilla::ScrollWheelInput::ScrollDeltaType
>
1279 : public ContiguousEnumSerializerInclusive
<
1280 mozilla::ScrollWheelInput::ScrollDeltaType
,
1281 mozilla::ScrollWheelInput::ScrollDeltaType::SCROLLDELTA_LINE
,
1282 mozilla::ScrollWheelInput::sHighestScrollDeltaType
> {};
1285 struct ParamTraits
<mozilla::ScrollWheelInput::ScrollMode
>
1286 : public ContiguousEnumSerializerInclusive
<
1287 mozilla::ScrollWheelInput::ScrollMode
,
1288 mozilla::ScrollWheelInput::ScrollMode::SCROLLMODE_INSTANT
,
1289 mozilla::ScrollWheelInput::sHighestScrollMode
> {};
1292 struct ParamTraits
<mozilla::WheelDeltaAdjustmentStrategy
>
1293 : public ContiguousEnumSerializer
<
1294 mozilla::WheelDeltaAdjustmentStrategy
,
1295 mozilla::WheelDeltaAdjustmentStrategy(0),
1296 mozilla::WheelDeltaAdjustmentStrategy::eSentinel
> {};
1299 struct ParamTraits
<mozilla::layers::APZWheelAction
>
1300 : public ContiguousEnumSerializerInclusive
<
1301 mozilla::layers::APZWheelAction
,
1302 mozilla::layers::APZWheelAction::Scroll
,
1303 mozilla::layers::kHighestAPZWheelAction
> {};
1306 struct ParamTraits
<mozilla::ScrollWheelInput
> {
1307 using paramType
= mozilla::ScrollWheelInput
;
1309 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1310 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1311 WriteParam(aWriter
, aParam
.mDeltaType
);
1312 WriteParam(aWriter
, aParam
.mScrollMode
);
1313 WriteParam(aWriter
, aParam
.mOrigin
);
1314 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1315 WriteParam(aWriter
, aParam
.mDeltaX
);
1316 WriteParam(aWriter
, aParam
.mDeltaY
);
1317 WriteParam(aWriter
, aParam
.mWheelTicksX
);
1318 WriteParam(aWriter
, aParam
.mWheelTicksY
);
1319 WriteParam(aWriter
, aParam
.mLocalOrigin
);
1320 WriteParam(aWriter
, aParam
.mLineOrPageDeltaX
);
1321 WriteParam(aWriter
, aParam
.mLineOrPageDeltaY
);
1322 WriteParam(aWriter
, aParam
.mScrollSeriesNumber
);
1323 WriteParam(aWriter
, aParam
.mUserDeltaMultiplierX
);
1324 WriteParam(aWriter
, aParam
.mUserDeltaMultiplierY
);
1325 WriteParam(aWriter
, aParam
.mMayHaveMomentum
);
1326 WriteParam(aWriter
, aParam
.mIsMomentum
);
1327 WriteParam(aWriter
, aParam
.mAllowToOverrideSystemScrollSpeed
);
1328 WriteParam(aWriter
, aParam
.mWheelDeltaAdjustmentStrategy
);
1329 WriteParam(aWriter
, aParam
.mAPZAction
);
1332 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1333 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1334 ReadParam(aReader
, &aResult
->mDeltaType
) &&
1335 ReadParam(aReader
, &aResult
->mScrollMode
) &&
1336 ReadParam(aReader
, &aResult
->mOrigin
) &&
1337 ReadParam(aReader
, &aResult
->mHandledByAPZ
) &&
1338 ReadParam(aReader
, &aResult
->mDeltaX
) &&
1339 ReadParam(aReader
, &aResult
->mDeltaY
) &&
1340 ReadParam(aReader
, &aResult
->mWheelTicksX
) &&
1341 ReadParam(aReader
, &aResult
->mWheelTicksY
) &&
1342 ReadParam(aReader
, &aResult
->mLocalOrigin
) &&
1343 ReadParam(aReader
, &aResult
->mLineOrPageDeltaX
) &&
1344 ReadParam(aReader
, &aResult
->mLineOrPageDeltaY
) &&
1345 ReadParam(aReader
, &aResult
->mScrollSeriesNumber
) &&
1346 ReadParam(aReader
, &aResult
->mUserDeltaMultiplierX
) &&
1347 ReadParam(aReader
, &aResult
->mUserDeltaMultiplierY
) &&
1348 ReadParam(aReader
, &aResult
->mMayHaveMomentum
) &&
1349 ReadParam(aReader
, &aResult
->mIsMomentum
) &&
1350 ReadParam(aReader
, &aResult
->mAllowToOverrideSystemScrollSpeed
) &&
1351 ReadParam(aReader
, &aResult
->mWheelDeltaAdjustmentStrategy
) &&
1352 ReadParam(aReader
, &aResult
->mAPZAction
);
1357 struct ParamTraits
<mozilla::KeyboardInput::KeyboardEventType
>
1358 : public ContiguousEnumSerializer
<
1359 mozilla::KeyboardInput::KeyboardEventType
,
1360 mozilla::KeyboardInput::KeyboardEventType::KEY_DOWN
,
1361 mozilla::KeyboardInput::KeyboardEventType::KEY_SENTINEL
> {};
1364 struct ParamTraits
<mozilla::KeyboardInput
> {
1365 using paramType
= mozilla::KeyboardInput
;
1367 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
1368 WriteParam(aWriter
, static_cast<const mozilla::InputData
&>(aParam
));
1369 WriteParam(aWriter
, aParam
.mType
);
1370 WriteParam(aWriter
, aParam
.mKeyCode
);
1371 WriteParam(aWriter
, aParam
.mCharCode
);
1372 WriteParam(aWriter
, aParam
.mShortcutCandidates
);
1373 WriteParam(aWriter
, aParam
.mHandledByAPZ
);
1376 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
1377 return ReadParam(aReader
, static_cast<mozilla::InputData
*>(aResult
)) &&
1378 ReadParam(aReader
, &aResult
->mType
) &&
1379 ReadParam(aReader
, &aResult
->mKeyCode
) &&
1380 ReadParam(aReader
, &aResult
->mCharCode
) &&
1381 ReadParam(aReader
, &aResult
->mShortcutCandidates
) &&
1382 ReadParam(aReader
, &aResult
->mHandledByAPZ
);
1388 #endif // nsGUIEventIPC_h__