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/IPCMessageUtils.h"
10 #include "mozilla/ContentCache.h"
11 #include "mozilla/GfxMessageUtils.h"
12 #include "mozilla/dom/Touch.h"
13 #include "mozilla/MiscEvents.h"
14 #include "mozilla/MouseEvents.h"
15 #include "mozilla/TextEvents.h"
16 #include "mozilla/TouchEvents.h"
17 #include "mozilla/WheelHandlingHelper.h" // for WheelDeltaAdjustmentStrategy
18 #include "mozilla/dom/Selection.h"
19 #include "InputData.h"
25 struct ParamTraits
<mozilla::EventMessage
> :
26 public ContiguousEnumSerializer
<mozilla::EventMessage
,
27 mozilla::EventMessage(0),
28 mozilla::EventMessage::eEventMessage_MaxValue
>
32 struct ParamTraits
<mozilla::BaseEventFlags
>
34 typedef mozilla::BaseEventFlags paramType
;
36 static void Write(Message
* aMsg
, const paramType
& aParam
)
38 aMsg
->WriteBytes(&aParam
, sizeof(aParam
));
41 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
43 return aMsg
->ReadBytesInto(aIter
, aResult
, sizeof(*aResult
));
48 struct ParamTraits
<mozilla::WidgetEvent
>
50 typedef mozilla::WidgetEvent paramType
;
52 static void Write(Message
* aMsg
, const paramType
& aParam
)
54 // Mark the event as posted to another process.
55 const_cast<mozilla::WidgetEvent
&>(aParam
).MarkAsPostedToRemoteProcess();
58 static_cast<mozilla::EventClassIDType
>(aParam
.mClass
));
59 WriteParam(aMsg
, aParam
.mMessage
);
60 WriteParam(aMsg
, aParam
.mRefPoint
);
61 WriteParam(aMsg
, aParam
.mFocusSequenceNumber
);
62 WriteParam(aMsg
, aParam
.mTime
);
63 WriteParam(aMsg
, aParam
.mTimeStamp
);
64 WriteParam(aMsg
, aParam
.mFlags
);
67 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
69 mozilla::EventClassIDType eventClassID
= 0;
70 bool ret
= ReadParam(aMsg
, aIter
, &eventClassID
) &&
71 ReadParam(aMsg
, aIter
, &aResult
->mMessage
) &&
72 ReadParam(aMsg
, aIter
, &aResult
->mRefPoint
) &&
73 ReadParam(aMsg
, aIter
, &aResult
->mFocusSequenceNumber
) &&
74 ReadParam(aMsg
, aIter
, &aResult
->mTime
) &&
75 ReadParam(aMsg
, aIter
, &aResult
->mTimeStamp
) &&
76 ReadParam(aMsg
, aIter
, &aResult
->mFlags
);
77 aResult
->mClass
= static_cast<mozilla::EventClassID
>(eventClassID
);
79 // Reset cross process dispatching state here because the event has not
80 // been dispatched to different process from current process.
81 aResult
->ResetCrossProcessDispatchingState();
88 struct ParamTraits
<mozilla::NativeEventData
>
90 typedef mozilla::NativeEventData paramType
;
92 static void Write(Message
* aMsg
, const paramType
& aParam
)
94 WriteParam(aMsg
, aParam
.mBuffer
);
97 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
99 return ReadParam(aMsg
, aIter
, &aResult
->mBuffer
);
104 struct ParamTraits
<mozilla::WidgetGUIEvent
>
106 typedef mozilla::WidgetGUIEvent paramType
;
108 static void Write(Message
* aMsg
, const paramType
& aParam
)
110 WriteParam(aMsg
, static_cast<const mozilla::WidgetEvent
&>(aParam
));
111 WriteParam(aMsg
, aParam
.mPluginEvent
);
114 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
116 return ReadParam(aMsg
, aIter
, static_cast<mozilla::WidgetEvent
*>(aResult
)) &&
117 ReadParam(aMsg
, aIter
, &aResult
->mPluginEvent
);
122 struct ParamTraits
<mozilla::WidgetInputEvent
>
124 typedef mozilla::WidgetInputEvent paramType
;
126 static void Write(Message
* aMsg
, const paramType
& aParam
)
128 WriteParam(aMsg
, static_cast<const mozilla::WidgetGUIEvent
&>(aParam
));
129 WriteParam(aMsg
, aParam
.mModifiers
);
132 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
134 return ReadParam(aMsg
, aIter
,
135 static_cast<mozilla::WidgetGUIEvent
*>(aResult
)) &&
136 ReadParam(aMsg
, aIter
, &aResult
->mModifiers
);
141 struct ParamTraits
<mozilla::WidgetMouseEventBase
>
143 typedef mozilla::WidgetMouseEventBase paramType
;
145 static void Write(Message
* aMsg
, const paramType
& aParam
)
147 WriteParam(aMsg
, static_cast<const mozilla::WidgetInputEvent
&>(aParam
));
148 WriteParam(aMsg
, aParam
.button
);
149 WriteParam(aMsg
, aParam
.buttons
);
150 WriteParam(aMsg
, aParam
.pressure
);
151 WriteParam(aMsg
, aParam
.hitCluster
);
152 WriteParam(aMsg
, aParam
.inputSource
);
155 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
157 return ReadParam(aMsg
, aIter
,
158 static_cast<mozilla::WidgetInputEvent
*>(aResult
)) &&
159 ReadParam(aMsg
, aIter
, &aResult
->button
) &&
160 ReadParam(aMsg
, aIter
, &aResult
->buttons
) &&
161 ReadParam(aMsg
, aIter
, &aResult
->pressure
) &&
162 ReadParam(aMsg
, aIter
, &aResult
->hitCluster
) &&
163 ReadParam(aMsg
, aIter
, &aResult
->inputSource
);
168 struct ParamTraits
<mozilla::WidgetWheelEvent
>
170 typedef mozilla::WidgetWheelEvent paramType
;
172 static void Write(Message
* aMsg
, const paramType
& aParam
)
174 WriteParam(aMsg
, static_cast<const mozilla::WidgetMouseEventBase
&>(aParam
));
175 WriteParam(aMsg
, aParam
.mDeltaX
);
176 WriteParam(aMsg
, aParam
.mDeltaY
);
177 WriteParam(aMsg
, aParam
.mDeltaZ
);
178 WriteParam(aMsg
, aParam
.mDeltaMode
);
179 WriteParam(aMsg
, aParam
.mCustomizedByUserPrefs
);
180 WriteParam(aMsg
, aParam
.mMayHaveMomentum
);
181 WriteParam(aMsg
, aParam
.mIsMomentum
);
182 WriteParam(aMsg
, aParam
.mIsNoLineOrPageDelta
);
183 WriteParam(aMsg
, aParam
.mLineOrPageDeltaX
);
184 WriteParam(aMsg
, aParam
.mLineOrPageDeltaY
);
185 WriteParam(aMsg
, static_cast<uint8_t>(aParam
.mScrollType
));
186 WriteParam(aMsg
, aParam
.mOverflowDeltaX
);
187 WriteParam(aMsg
, aParam
.mOverflowDeltaY
);
188 WriteParam(aMsg
, aParam
.mViewPortIsOverscrolled
);
189 WriteParam(aMsg
, aParam
.mCanTriggerSwipe
);
190 WriteParam(aMsg
, aParam
.mAllowToOverrideSystemScrollSpeed
);
191 WriteParam(aMsg
, aParam
.mDeltaValuesHorizontalizedForDefaultHandler
);
194 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
196 uint8_t scrollType
= 0;
198 ReadParam(aMsg
, aIter
,
199 static_cast<mozilla::WidgetMouseEventBase
*>(aResult
)) &&
200 ReadParam(aMsg
, aIter
, &aResult
->mDeltaX
) &&
201 ReadParam(aMsg
, aIter
, &aResult
->mDeltaY
) &&
202 ReadParam(aMsg
, aIter
, &aResult
->mDeltaZ
) &&
203 ReadParam(aMsg
, aIter
, &aResult
->mDeltaMode
) &&
204 ReadParam(aMsg
, aIter
, &aResult
->mCustomizedByUserPrefs
) &&
205 ReadParam(aMsg
, aIter
, &aResult
->mMayHaveMomentum
) &&
206 ReadParam(aMsg
, aIter
, &aResult
->mIsMomentum
) &&
207 ReadParam(aMsg
, aIter
, &aResult
->mIsNoLineOrPageDelta
) &&
208 ReadParam(aMsg
, aIter
, &aResult
->mLineOrPageDeltaX
) &&
209 ReadParam(aMsg
, aIter
, &aResult
->mLineOrPageDeltaY
) &&
210 ReadParam(aMsg
, aIter
, &scrollType
) &&
211 ReadParam(aMsg
, aIter
, &aResult
->mOverflowDeltaX
) &&
212 ReadParam(aMsg
, aIter
, &aResult
->mOverflowDeltaY
) &&
213 ReadParam(aMsg
, aIter
, &aResult
->mViewPortIsOverscrolled
) &&
214 ReadParam(aMsg
, aIter
, &aResult
->mCanTriggerSwipe
) &&
215 ReadParam(aMsg
, aIter
, &aResult
->mAllowToOverrideSystemScrollSpeed
) &&
216 ReadParam(aMsg
, aIter
,
217 &aResult
->mDeltaValuesHorizontalizedForDefaultHandler
);
218 aResult
->mScrollType
=
219 static_cast<mozilla::WidgetWheelEvent::ScrollType
>(scrollType
);
225 struct ParamTraits
<mozilla::WidgetPointerHelper
>
227 typedef mozilla::WidgetPointerHelper paramType
;
229 static void Write(Message
* aMsg
, const paramType
& aParam
)
231 WriteParam(aMsg
, aParam
.pointerId
);
232 WriteParam(aMsg
, aParam
.tiltX
);
233 WriteParam(aMsg
, aParam
.tiltY
);
234 WriteParam(aMsg
, aParam
.twist
);
235 WriteParam(aMsg
, aParam
.tangentialPressure
);
236 // We don't serialize convertToPointer since it's temporarily variable and
237 // should be reset to default.
240 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
243 rv
= ReadParam(aMsg
, aIter
, &aResult
->pointerId
) &&
244 ReadParam(aMsg
, aIter
, &aResult
->tiltX
) &&
245 ReadParam(aMsg
, aIter
, &aResult
->tiltY
) &&
246 ReadParam(aMsg
, aIter
, &aResult
->twist
) &&
247 ReadParam(aMsg
, aIter
, &aResult
->tangentialPressure
);
253 struct ParamTraits
<mozilla::WidgetMouseEvent
>
255 typedef mozilla::WidgetMouseEvent paramType
;
257 static void Write(Message
* aMsg
, const paramType
& aParam
)
259 WriteParam(aMsg
, static_cast<const mozilla::WidgetMouseEventBase
&>(aParam
));
260 WriteParam(aMsg
, static_cast<const mozilla::WidgetPointerHelper
&>(aParam
));
261 WriteParam(aMsg
, aParam
.mIgnoreRootScrollFrame
);
262 WriteParam(aMsg
, static_cast<paramType::ReasonType
>(aParam
.mReason
));
263 WriteParam(aMsg
, static_cast<paramType::ContextMenuTriggerType
>(
264 aParam
.mContextMenuTrigger
));
265 WriteParam(aMsg
, static_cast<paramType::ExitFromType
>(aParam
.mExitFrom
));
266 WriteParam(aMsg
, aParam
.mClickCount
);
269 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
272 paramType::ReasonType reason
= 0;
273 paramType::ContextMenuTriggerType contextMenuTrigger
= 0;
274 paramType::ExitFromType exitFrom
= 0;
275 rv
= ReadParam(aMsg
, aIter
,
276 static_cast<mozilla::WidgetMouseEventBase
*>(aResult
)) &&
277 ReadParam(aMsg
, aIter
,
278 static_cast<mozilla::WidgetPointerHelper
*>(aResult
)) &&
279 ReadParam(aMsg
, aIter
, &aResult
->mIgnoreRootScrollFrame
) &&
280 ReadParam(aMsg
, aIter
, &reason
) &&
281 ReadParam(aMsg
, aIter
, &contextMenuTrigger
) &&
282 ReadParam(aMsg
, aIter
, &exitFrom
) &&
283 ReadParam(aMsg
, aIter
, &aResult
->mClickCount
);
284 aResult
->mReason
= static_cast<paramType::Reason
>(reason
);
285 aResult
->mContextMenuTrigger
=
286 static_cast<paramType::ContextMenuTrigger
>(contextMenuTrigger
);
287 aResult
->mExitFrom
= static_cast<paramType::ExitFrom
>(exitFrom
);
294 struct ParamTraits
<mozilla::WidgetDragEvent
>
296 typedef mozilla::WidgetDragEvent paramType
;
298 static void Write(Message
* aMsg
, const paramType
& aParam
)
300 WriteParam(aMsg
, static_cast<const mozilla::WidgetMouseEvent
&>(aParam
));
301 WriteParam(aMsg
, aParam
.mUserCancelled
);
302 WriteParam(aMsg
, aParam
.mDefaultPreventedOnContent
);
305 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
308 ReadParam(aMsg
, aIter
, static_cast<mozilla::WidgetMouseEvent
*>(aResult
)) &&
309 ReadParam(aMsg
, aIter
, &aResult
->mUserCancelled
) &&
310 ReadParam(aMsg
, aIter
, &aResult
->mDefaultPreventedOnContent
);
316 struct ParamTraits
<mozilla::WidgetPointerEvent
>
318 typedef mozilla::WidgetPointerEvent paramType
;
320 static void Write(Message
* aMsg
, const paramType
& aParam
)
322 WriteParam(aMsg
, static_cast<const mozilla::WidgetMouseEvent
&>(aParam
));
323 WriteParam(aMsg
, aParam
.mWidth
);
324 WriteParam(aMsg
, aParam
.mHeight
);
325 WriteParam(aMsg
, aParam
.mIsPrimary
);
328 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
331 ReadParam(aMsg
, aIter
, static_cast<mozilla::WidgetMouseEvent
*>(aResult
)) &&
332 ReadParam(aMsg
, aIter
, &aResult
->mWidth
) &&
333 ReadParam(aMsg
, aIter
, &aResult
->mHeight
) &&
334 ReadParam(aMsg
, aIter
, &aResult
->mIsPrimary
);
340 struct ParamTraits
<mozilla::WidgetTouchEvent
>
342 typedef mozilla::WidgetTouchEvent paramType
;
344 static void Write(Message
* aMsg
, const paramType
& aParam
)
346 WriteParam(aMsg
, static_cast<const mozilla::WidgetInputEvent
&>(aParam
));
347 // Sigh, Touch bites us again! We want to be able to do
348 // WriteParam(aMsg, aParam.mTouches);
349 const paramType::TouchArray
& touches
= aParam
.mTouches
;
350 WriteParam(aMsg
, touches
.Length());
351 for (uint32_t i
= 0; i
< touches
.Length(); ++i
) {
352 mozilla::dom::Touch
* touch
= touches
[i
];
353 WriteParam(aMsg
, touch
->mIdentifier
);
354 WriteParam(aMsg
, touch
->mRefPoint
);
355 WriteParam(aMsg
, touch
->mRadius
);
356 WriteParam(aMsg
, touch
->mRotationAngle
);
357 WriteParam(aMsg
, touch
->mForce
);
361 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
363 paramType::TouchArray::size_type numTouches
;
364 if (!ReadParam(aMsg
, aIter
,
365 static_cast<mozilla::WidgetInputEvent
*>(aResult
)) ||
366 !ReadParam(aMsg
, aIter
, &numTouches
)) {
369 for (uint32_t i
= 0; i
< numTouches
; ++i
) {
371 mozilla::LayoutDeviceIntPoint refPoint
;
372 mozilla::LayoutDeviceIntPoint radius
;
375 if (!ReadParam(aMsg
, aIter
, &identifier
) ||
376 !ReadParam(aMsg
, aIter
, &refPoint
) ||
377 !ReadParam(aMsg
, aIter
, &radius
) ||
378 !ReadParam(aMsg
, aIter
, &rotationAngle
) ||
379 !ReadParam(aMsg
, aIter
, &force
)) {
382 aResult
->mTouches
.AppendElement(
383 new mozilla::dom::Touch(
384 identifier
, refPoint
, radius
, rotationAngle
, force
));
391 struct ParamTraits
<mozilla::AlternativeCharCode
>
393 typedef mozilla::AlternativeCharCode paramType
;
395 static void Write(Message
* aMsg
, const paramType
& aParam
)
397 WriteParam(aMsg
, aParam
.mUnshiftedCharCode
);
398 WriteParam(aMsg
, aParam
.mShiftedCharCode
);
401 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
403 return ReadParam(aMsg
, aIter
, &aResult
->mUnshiftedCharCode
) &&
404 ReadParam(aMsg
, aIter
, &aResult
->mShiftedCharCode
);
409 struct ParamTraits
<mozilla::ShortcutKeyCandidate
>
411 typedef mozilla::ShortcutKeyCandidate paramType
;
413 static void Write(Message
* aMsg
, const paramType
& aParam
)
415 WriteParam(aMsg
, aParam
.mCharCode
);
416 WriteParam(aMsg
, aParam
.mIgnoreShift
);
419 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
421 return ReadParam(aMsg
, aIter
, &aResult
->mCharCode
) &&
422 ReadParam(aMsg
, aIter
, &aResult
->mIgnoreShift
);
427 struct ParamTraits
<mozilla::WidgetKeyboardEvent
>
429 typedef mozilla::WidgetKeyboardEvent paramType
;
431 static void Write(Message
* aMsg
, const paramType
& aParam
)
433 WriteParam(aMsg
, static_cast<const mozilla::WidgetInputEvent
&>(aParam
));
435 static_cast<mozilla::KeyNameIndexType
>(aParam
.mKeyNameIndex
));
437 static_cast<mozilla::CodeNameIndexType
>(aParam
.mCodeNameIndex
));
438 WriteParam(aMsg
, aParam
.mKeyValue
);
439 WriteParam(aMsg
, aParam
.mCodeValue
);
440 WriteParam(aMsg
, aParam
.mKeyCode
);
441 WriteParam(aMsg
, aParam
.mCharCode
);
442 WriteParam(aMsg
, aParam
.mPseudoCharCode
);
443 WriteParam(aMsg
, aParam
.mAlternativeCharCodes
);
444 WriteParam(aMsg
, aParam
.mIsRepeat
);
445 WriteParam(aMsg
, aParam
.mLocation
);
446 WriteParam(aMsg
, aParam
.mUniqueId
);
447 WriteParam(aMsg
, aParam
.mIsSynthesizedByTIP
);
449 WriteParam(aMsg
, aParam
.mNativeKeyCode
);
450 WriteParam(aMsg
, aParam
.mNativeModifierFlags
);
451 WriteParam(aMsg
, aParam
.mNativeCharacters
);
452 WriteParam(aMsg
, aParam
.mNativeCharactersIgnoringModifiers
);
453 WriteParam(aMsg
, aParam
.mPluginTextEventString
);
456 // An OS-specific native event might be attached in |mNativeKeyEvent|, but
457 // that cannot be copied across process boundaries.
459 WriteParam(aMsg
, aParam
.mEditCommandsForSingleLineEditor
);
460 WriteParam(aMsg
, aParam
.mEditCommandsForMultiLineEditor
);
461 WriteParam(aMsg
, aParam
.mEditCommandsForRichTextEditor
);
462 WriteParam(aMsg
, aParam
.mEditCommandsForSingleLineEditorInitialized
);
463 WriteParam(aMsg
, aParam
.mEditCommandsForMultiLineEditorInitialized
);
464 WriteParam(aMsg
, aParam
.mEditCommandsForRichTextEditorInitialized
);
467 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
469 mozilla::KeyNameIndexType keyNameIndex
= 0;
470 mozilla::CodeNameIndexType codeNameIndex
= 0;
471 if (ReadParam(aMsg
, aIter
,
472 static_cast<mozilla::WidgetInputEvent
*>(aResult
)) &&
473 ReadParam(aMsg
, aIter
, &keyNameIndex
) &&
474 ReadParam(aMsg
, aIter
, &codeNameIndex
) &&
475 ReadParam(aMsg
, aIter
, &aResult
->mKeyValue
) &&
476 ReadParam(aMsg
, aIter
, &aResult
->mCodeValue
) &&
477 ReadParam(aMsg
, aIter
, &aResult
->mKeyCode
) &&
478 ReadParam(aMsg
, aIter
, &aResult
->mCharCode
) &&
479 ReadParam(aMsg
, aIter
, &aResult
->mPseudoCharCode
) &&
480 ReadParam(aMsg
, aIter
, &aResult
->mAlternativeCharCodes
) &&
481 ReadParam(aMsg
, aIter
, &aResult
->mIsRepeat
) &&
482 ReadParam(aMsg
, aIter
, &aResult
->mLocation
) &&
483 ReadParam(aMsg
, aIter
, &aResult
->mUniqueId
) &&
484 ReadParam(aMsg
, aIter
, &aResult
->mIsSynthesizedByTIP
) &&
486 ReadParam(aMsg
, aIter
, &aResult
->mNativeKeyCode
) &&
487 ReadParam(aMsg
, aIter
, &aResult
->mNativeModifierFlags
) &&
488 ReadParam(aMsg
, aIter
, &aResult
->mNativeCharacters
) &&
489 ReadParam(aMsg
, aIter
, &aResult
->mNativeCharactersIgnoringModifiers
) &&
490 ReadParam(aMsg
, aIter
, &aResult
->mPluginTextEventString
) &&
492 ReadParam(aMsg
, aIter
, &aResult
->mEditCommandsForSingleLineEditor
) &&
493 ReadParam(aMsg
, aIter
, &aResult
->mEditCommandsForMultiLineEditor
) &&
494 ReadParam(aMsg
, aIter
, &aResult
->mEditCommandsForRichTextEditor
) &&
495 ReadParam(aMsg
, aIter
,
496 &aResult
->mEditCommandsForSingleLineEditorInitialized
) &&
497 ReadParam(aMsg
, aIter
,
498 &aResult
->mEditCommandsForMultiLineEditorInitialized
) &&
499 ReadParam(aMsg
, aIter
,
500 &aResult
->mEditCommandsForRichTextEditorInitialized
)) {
501 aResult
->mKeyNameIndex
= static_cast<mozilla::KeyNameIndex
>(keyNameIndex
);
502 aResult
->mCodeNameIndex
=
503 static_cast<mozilla::CodeNameIndex
>(codeNameIndex
);
504 aResult
->mNativeKeyEvent
= nullptr;
512 struct ParamTraits
<mozilla::TextRangeStyle
>
514 typedef mozilla::TextRangeStyle paramType
;
516 static void Write(Message
* aMsg
, const paramType
& aParam
)
518 WriteParam(aMsg
, aParam
.mDefinedStyles
);
519 WriteParam(aMsg
, aParam
.mLineStyle
);
520 WriteParam(aMsg
, aParam
.mIsBoldLine
);
521 WriteParam(aMsg
, aParam
.mForegroundColor
);
522 WriteParam(aMsg
, aParam
.mBackgroundColor
);
523 WriteParam(aMsg
, aParam
.mUnderlineColor
);
526 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
528 return ReadParam(aMsg
, aIter
, &aResult
->mDefinedStyles
) &&
529 ReadParam(aMsg
, aIter
, &aResult
->mLineStyle
) &&
530 ReadParam(aMsg
, aIter
, &aResult
->mIsBoldLine
) &&
531 ReadParam(aMsg
, aIter
, &aResult
->mForegroundColor
) &&
532 ReadParam(aMsg
, aIter
, &aResult
->mBackgroundColor
) &&
533 ReadParam(aMsg
, aIter
, &aResult
->mUnderlineColor
);
538 struct ParamTraits
<mozilla::TextRange
>
540 typedef mozilla::TextRange paramType
;
542 static void Write(Message
* aMsg
, const paramType
& aParam
)
544 WriteParam(aMsg
, aParam
.mStartOffset
);
545 WriteParam(aMsg
, aParam
.mEndOffset
);
546 WriteParam(aMsg
, mozilla::ToRawTextRangeType(aParam
.mRangeType
));
547 WriteParam(aMsg
, aParam
.mRangeStyle
);
550 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
552 mozilla::RawTextRangeType rawTextRangeType
;
553 if (ReadParam(aMsg
, aIter
, &aResult
->mStartOffset
) &&
554 ReadParam(aMsg
, aIter
, &aResult
->mEndOffset
) &&
555 ReadParam(aMsg
, aIter
, &rawTextRangeType
) &&
556 ReadParam(aMsg
, aIter
, &aResult
->mRangeStyle
)) {
557 aResult
->mRangeType
= mozilla::ToTextRangeType(rawTextRangeType
);
565 struct ParamTraits
<mozilla::TextRangeArray
>
567 typedef mozilla::TextRangeArray paramType
;
569 static void Write(Message
* aMsg
, const paramType
& aParam
)
571 WriteParam(aMsg
, aParam
.Length());
572 for (uint32_t index
= 0; index
< aParam
.Length(); index
++) {
573 WriteParam(aMsg
, aParam
[index
]);
577 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
579 paramType::size_type length
;
580 if (!ReadParam(aMsg
, aIter
, &length
)) {
583 for (uint32_t index
= 0; index
< length
; index
++) {
584 mozilla::TextRange textRange
;
585 if (!ReadParam(aMsg
, aIter
, &textRange
)) {
589 aResult
->AppendElement(textRange
);
596 struct ParamTraits
<mozilla::WidgetCompositionEvent
>
598 typedef mozilla::WidgetCompositionEvent paramType
;
600 static void Write(Message
* aMsg
, const paramType
& aParam
)
602 WriteParam(aMsg
, static_cast<const mozilla::WidgetGUIEvent
&>(aParam
));
603 WriteParam(aMsg
, aParam
.mData
);
604 WriteParam(aMsg
, aParam
.mNativeIMEContext
);
605 bool hasRanges
= !!aParam
.mRanges
;
606 WriteParam(aMsg
, hasRanges
);
608 WriteParam(aMsg
, *aParam
.mRanges
.get());
612 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
615 if (!ReadParam(aMsg
, aIter
,
616 static_cast<mozilla::WidgetGUIEvent
*>(aResult
)) ||
617 !ReadParam(aMsg
, aIter
, &aResult
->mData
) ||
618 !ReadParam(aMsg
, aIter
, &aResult
->mNativeIMEContext
) ||
619 !ReadParam(aMsg
, aIter
, &hasRanges
)) {
624 aResult
->mRanges
= nullptr;
626 aResult
->mRanges
= new mozilla::TextRangeArray();
627 if (!ReadParam(aMsg
, aIter
, aResult
->mRanges
.get())) {
636 struct ParamTraits
<mozilla::FontRange
>
638 typedef mozilla::FontRange paramType
;
640 static void Write(Message
* aMsg
, const paramType
& aParam
)
642 WriteParam(aMsg
, aParam
.mStartOffset
);
643 WriteParam(aMsg
, aParam
.mFontName
);
644 WriteParam(aMsg
, aParam
.mFontSize
);
647 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
649 return ReadParam(aMsg
, aIter
, &aResult
->mStartOffset
) &&
650 ReadParam(aMsg
, aIter
, &aResult
->mFontName
) &&
651 ReadParam(aMsg
, aIter
, &aResult
->mFontSize
);
656 struct ParamTraits
<mozilla::WidgetQueryContentEvent::Input
>
658 typedef mozilla::WidgetQueryContentEvent::Input paramType
;
659 typedef mozilla::WidgetQueryContentEvent event
;
661 static void Write(Message
* aMsg
, const paramType
& aParam
)
663 WriteParam(aMsg
, aParam
.mOffset
);
664 WriteParam(aMsg
, aParam
.mLength
);
665 WriteParam(aMsg
, mozilla::ToRawSelectionType(aParam
.mSelectionType
));
668 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
670 mozilla::RawSelectionType rawSelectionType
= 0;
671 bool ok
= ReadParam(aMsg
, aIter
, &aResult
->mOffset
) &&
672 ReadParam(aMsg
, aIter
, &aResult
->mLength
) &&
673 ReadParam(aMsg
, aIter
, &rawSelectionType
);
674 aResult
->mSelectionType
= mozilla::ToSelectionType(rawSelectionType
);
680 struct ParamTraits
<mozilla::WidgetQueryContentEvent
>
682 typedef mozilla::WidgetQueryContentEvent paramType
;
684 static void Write(Message
* aMsg
, const paramType
& aParam
)
686 WriteParam(aMsg
, static_cast<const mozilla::WidgetGUIEvent
&>(aParam
));
687 WriteParam(aMsg
, aParam
.mSucceeded
);
688 WriteParam(aMsg
, aParam
.mUseNativeLineBreak
);
689 WriteParam(aMsg
, aParam
.mWithFontRanges
);
690 WriteParam(aMsg
, aParam
.mInput
);
691 WriteParam(aMsg
, aParam
.mReply
.mOffset
);
692 WriteParam(aMsg
, aParam
.mReply
.mTentativeCaretOffset
);
693 WriteParam(aMsg
, aParam
.mReply
.mString
);
694 WriteParam(aMsg
, aParam
.mReply
.mRect
);
695 WriteParam(aMsg
, aParam
.mReply
.mReversed
);
696 WriteParam(aMsg
, aParam
.mReply
.mHasSelection
);
697 WriteParam(aMsg
, aParam
.mReply
.mWidgetIsHit
);
698 WriteParam(aMsg
, aParam
.mReply
.mFontRanges
);
701 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
703 return ReadParam(aMsg
, aIter
,
704 static_cast<mozilla::WidgetGUIEvent
*>(aResult
)) &&
705 ReadParam(aMsg
, aIter
, &aResult
->mSucceeded
) &&
706 ReadParam(aMsg
, aIter
, &aResult
->mUseNativeLineBreak
) &&
707 ReadParam(aMsg
, aIter
, &aResult
->mWithFontRanges
) &&
708 ReadParam(aMsg
, aIter
, &aResult
->mInput
) &&
709 ReadParam(aMsg
, aIter
, &aResult
->mReply
.mOffset
) &&
710 ReadParam(aMsg
, aIter
, &aResult
->mReply
.mTentativeCaretOffset
) &&
711 ReadParam(aMsg
, aIter
, &aResult
->mReply
.mString
) &&
712 ReadParam(aMsg
, aIter
, &aResult
->mReply
.mRect
) &&
713 ReadParam(aMsg
, aIter
, &aResult
->mReply
.mReversed
) &&
714 ReadParam(aMsg
, aIter
, &aResult
->mReply
.mHasSelection
) &&
715 ReadParam(aMsg
, aIter
, &aResult
->mReply
.mWidgetIsHit
) &&
716 ReadParam(aMsg
, aIter
, &aResult
->mReply
.mFontRanges
);
721 struct ParamTraits
<mozilla::WidgetSelectionEvent
>
723 typedef mozilla::WidgetSelectionEvent paramType
;
725 static void Write(Message
* aMsg
, const paramType
& aParam
)
727 WriteParam(aMsg
, static_cast<const mozilla::WidgetGUIEvent
&>(aParam
));
728 WriteParam(aMsg
, aParam
.mOffset
);
729 WriteParam(aMsg
, aParam
.mLength
);
730 WriteParam(aMsg
, aParam
.mReversed
);
731 WriteParam(aMsg
, aParam
.mExpandToClusterBoundary
);
732 WriteParam(aMsg
, aParam
.mSucceeded
);
733 WriteParam(aMsg
, aParam
.mUseNativeLineBreak
);
736 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
738 return ReadParam(aMsg
, aIter
,
739 static_cast<mozilla::WidgetGUIEvent
*>(aResult
)) &&
740 ReadParam(aMsg
, aIter
, &aResult
->mOffset
) &&
741 ReadParam(aMsg
, aIter
, &aResult
->mLength
) &&
742 ReadParam(aMsg
, aIter
, &aResult
->mReversed
) &&
743 ReadParam(aMsg
, aIter
, &aResult
->mExpandToClusterBoundary
) &&
744 ReadParam(aMsg
, aIter
, &aResult
->mSucceeded
) &&
745 ReadParam(aMsg
, aIter
, &aResult
->mUseNativeLineBreak
);
750 struct ParamTraits
<mozilla::widget::IMENotificationRequests
>
752 typedef mozilla::widget::IMENotificationRequests paramType
;
754 static void Write(Message
* aMsg
, const paramType
& aParam
)
756 WriteParam(aMsg
, aParam
.mWantUpdates
);
759 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
761 return ReadParam(aMsg
, aIter
, &aResult
->mWantUpdates
);
766 struct ParamTraits
<mozilla::widget::NativeIMEContext
>
768 typedef mozilla::widget::NativeIMEContext paramType
;
770 static void Write(Message
* aMsg
, const paramType
& aParam
)
772 WriteParam(aMsg
, aParam
.mRawNativeIMEContext
);
773 WriteParam(aMsg
, aParam
.mOriginProcessID
);
776 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
778 return ReadParam(aMsg
, aIter
, &aResult
->mRawNativeIMEContext
) &&
779 ReadParam(aMsg
, aIter
, &aResult
->mOriginProcessID
);
784 struct ParamTraits
<mozilla::widget::IMENotification::Point
>
786 typedef mozilla::widget::IMENotification::Point paramType
;
788 static void Write(Message
* aMsg
, const paramType
& aParam
)
790 WriteParam(aMsg
, aParam
.mX
);
791 WriteParam(aMsg
, aParam
.mY
);
794 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
796 return ReadParam(aMsg
, aIter
, &aResult
->mX
) &&
797 ReadParam(aMsg
, aIter
, &aResult
->mY
);
802 struct ParamTraits
<mozilla::widget::IMENotification::Rect
>
804 typedef mozilla::widget::IMENotification::Rect paramType
;
806 static void Write(Message
* aMsg
, const paramType
& aParam
)
808 WriteParam(aMsg
, aParam
.mX
);
809 WriteParam(aMsg
, aParam
.mY
);
810 WriteParam(aMsg
, aParam
.mWidth
);
811 WriteParam(aMsg
, aParam
.mHeight
);
814 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
816 return ReadParam(aMsg
, aIter
, &aResult
->mX
) &&
817 ReadParam(aMsg
, aIter
, &aResult
->mY
) &&
818 ReadParam(aMsg
, aIter
, &aResult
->mWidth
) &&
819 ReadParam(aMsg
, aIter
, &aResult
->mHeight
);
824 struct ParamTraits
<mozilla::widget::IMENotification::SelectionChangeDataBase
>
826 typedef mozilla::widget::IMENotification::SelectionChangeDataBase paramType
;
828 static void Write(Message
* aMsg
, const paramType
& aParam
)
830 MOZ_RELEASE_ASSERT(aParam
.mString
);
831 WriteParam(aMsg
, aParam
.mOffset
);
832 WriteParam(aMsg
, *aParam
.mString
);
833 WriteParam(aMsg
, aParam
.mWritingMode
);
834 WriteParam(aMsg
, aParam
.mReversed
);
835 WriteParam(aMsg
, aParam
.mCausedByComposition
);
836 WriteParam(aMsg
, aParam
.mCausedBySelectionEvent
);
837 WriteParam(aMsg
, aParam
.mOccurredDuringComposition
);
840 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
842 aResult
->mString
= new nsString();
843 return ReadParam(aMsg
, aIter
, &aResult
->mOffset
) &&
844 ReadParam(aMsg
, aIter
, aResult
->mString
) &&
845 ReadParam(aMsg
, aIter
, &aResult
->mWritingMode
) &&
846 ReadParam(aMsg
, aIter
, &aResult
->mReversed
) &&
847 ReadParam(aMsg
, aIter
, &aResult
->mCausedByComposition
) &&
848 ReadParam(aMsg
, aIter
, &aResult
->mCausedBySelectionEvent
) &&
849 ReadParam(aMsg
, aIter
, &aResult
->mOccurredDuringComposition
);
854 struct ParamTraits
<mozilla::widget::IMENotification::TextChangeDataBase
>
856 typedef mozilla::widget::IMENotification::TextChangeDataBase paramType
;
858 static void Write(Message
* aMsg
, const paramType
& aParam
)
860 WriteParam(aMsg
, aParam
.mStartOffset
);
861 WriteParam(aMsg
, aParam
.mRemovedEndOffset
);
862 WriteParam(aMsg
, aParam
.mAddedEndOffset
);
863 WriteParam(aMsg
, aParam
.mCausedOnlyByComposition
);
864 WriteParam(aMsg
, aParam
.mIncludingChangesDuringComposition
);
865 WriteParam(aMsg
, aParam
.mIncludingChangesWithoutComposition
);
868 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
870 return ReadParam(aMsg
, aIter
, &aResult
->mStartOffset
) &&
871 ReadParam(aMsg
, aIter
, &aResult
->mRemovedEndOffset
) &&
872 ReadParam(aMsg
, aIter
, &aResult
->mAddedEndOffset
) &&
873 ReadParam(aMsg
, aIter
, &aResult
->mCausedOnlyByComposition
) &&
874 ReadParam(aMsg
, aIter
,
875 &aResult
->mIncludingChangesDuringComposition
) &&
876 ReadParam(aMsg
, aIter
,
877 &aResult
->mIncludingChangesWithoutComposition
);
882 struct ParamTraits
<mozilla::widget::IMENotification::MouseButtonEventData
>
884 typedef mozilla::widget::IMENotification::MouseButtonEventData paramType
;
886 static void Write(Message
* aMsg
, const paramType
& aParam
)
888 WriteParam(aMsg
, aParam
.mEventMessage
);
889 WriteParam(aMsg
, aParam
.mOffset
);
890 WriteParam(aMsg
, aParam
.mCursorPos
);
891 WriteParam(aMsg
, aParam
.mCharRect
);
892 WriteParam(aMsg
, aParam
.mButton
);
893 WriteParam(aMsg
, aParam
.mButtons
);
894 WriteParam(aMsg
, aParam
.mModifiers
);
897 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
899 return ReadParam(aMsg
, aIter
, &aResult
->mEventMessage
) &&
900 ReadParam(aMsg
, aIter
, &aResult
->mOffset
) &&
901 ReadParam(aMsg
, aIter
, &aResult
->mCursorPos
) &&
902 ReadParam(aMsg
, aIter
, &aResult
->mCharRect
) &&
903 ReadParam(aMsg
, aIter
, &aResult
->mButton
) &&
904 ReadParam(aMsg
, aIter
, &aResult
->mButtons
) &&
905 ReadParam(aMsg
, aIter
, &aResult
->mModifiers
);
910 struct ParamTraits
<mozilla::widget::IMENotification
>
912 typedef mozilla::widget::IMENotification paramType
;
914 static void Write(Message
* aMsg
, const paramType
& aParam
)
917 static_cast<mozilla::widget::IMEMessageType
>(aParam
.mMessage
));
918 switch (aParam
.mMessage
) {
919 case mozilla::widget::NOTIFY_IME_OF_SELECTION_CHANGE
:
920 WriteParam(aMsg
, aParam
.mSelectionChangeData
);
922 case mozilla::widget::NOTIFY_IME_OF_TEXT_CHANGE
:
923 WriteParam(aMsg
, aParam
.mTextChangeData
);
925 case mozilla::widget::NOTIFY_IME_OF_MOUSE_BUTTON_EVENT
:
926 WriteParam(aMsg
, aParam
.mMouseButtonEventData
);
933 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
935 mozilla::widget::IMEMessageType IMEMessage
= 0;
936 if (!ReadParam(aMsg
, aIter
, &IMEMessage
)) {
939 aResult
->mMessage
= static_cast<mozilla::widget::IMEMessage
>(IMEMessage
);
940 switch (aResult
->mMessage
) {
941 case mozilla::widget::NOTIFY_IME_OF_SELECTION_CHANGE
:
942 return ReadParam(aMsg
, aIter
, &aResult
->mSelectionChangeData
);
943 case mozilla::widget::NOTIFY_IME_OF_TEXT_CHANGE
:
944 return ReadParam(aMsg
, aIter
, &aResult
->mTextChangeData
);
945 case mozilla::widget::NOTIFY_IME_OF_MOUSE_BUTTON_EVENT
:
946 return ReadParam(aMsg
, aIter
, &aResult
->mMouseButtonEventData
);
954 struct ParamTraits
<mozilla::widget::IMEState::Enabled
>
955 : ContiguousEnumSerializer
<mozilla::widget::IMEState::Enabled
,
956 mozilla::widget::IMEState::Enabled::DISABLED
,
957 mozilla::widget::IMEState::Enabled::UNKNOWN
>
962 struct ParamTraits
<mozilla::widget::IMEState::Open
>
963 : ContiguousEnumSerializerInclusive
<
964 mozilla::widget::IMEState::Open
,
965 mozilla::widget::IMEState::Open::OPEN_STATE_NOT_SUPPORTED
,
966 mozilla::widget::IMEState::Open::CLOSED
>
971 struct ParamTraits
<mozilla::widget::InputContextAction::Cause
>
972 : ContiguousEnumSerializerInclusive
<
973 mozilla::widget::InputContextAction::Cause
,
974 mozilla::widget::InputContextAction::Cause::CAUSE_UNKNOWN
,
975 mozilla::widget::InputContextAction::Cause::
976 CAUSE_UNKNOWN_DURING_KEYBOARD_INPUT
>
981 struct ParamTraits
<mozilla::widget::InputContextAction::FocusChange
>
982 : ContiguousEnumSerializerInclusive
<
983 mozilla::widget::InputContextAction::FocusChange
,
984 mozilla::widget::InputContextAction::FocusChange::FOCUS_NOT_CHANGED
,
985 mozilla::widget::InputContextAction::FocusChange::WIDGET_CREATED
>
990 struct ParamTraits
<mozilla::WidgetPluginEvent
>
992 typedef mozilla::WidgetPluginEvent paramType
;
994 static void Write(Message
* aMsg
, const paramType
& aParam
)
996 WriteParam(aMsg
, static_cast<const mozilla::WidgetGUIEvent
&>(aParam
));
997 WriteParam(aMsg
, aParam
.mRetargetToFocusedDocument
);
1000 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
1002 return ReadParam(aMsg
, aIter
,
1003 static_cast<mozilla::WidgetGUIEvent
*>(aResult
)) &&
1004 ReadParam(aMsg
, aIter
, &aResult
->mRetargetToFocusedDocument
);
1009 struct ParamTraits
<mozilla::WritingMode
>
1011 typedef mozilla::WritingMode paramType
;
1013 static void Write(Message
* aMsg
, const paramType
& aParam
)
1015 WriteParam(aMsg
, aParam
.mWritingMode
);
1018 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
1020 return ReadParam(aMsg
, aIter
, &aResult
->mWritingMode
);
1025 struct ParamTraits
<mozilla::ContentCache
>
1027 typedef mozilla::ContentCache paramType
;
1029 static void Write(Message
* aMsg
, const paramType
& aParam
)
1031 WriteParam(aMsg
, aParam
.mCompositionStart
);
1032 WriteParam(aMsg
, aParam
.mText
);
1033 WriteParam(aMsg
, aParam
.mSelection
.mAnchor
);
1034 WriteParam(aMsg
, aParam
.mSelection
.mFocus
);
1035 WriteParam(aMsg
, aParam
.mSelection
.mWritingMode
);
1036 WriteParam(aMsg
, aParam
.mSelection
.mAnchorCharRects
[0]);
1037 WriteParam(aMsg
, aParam
.mSelection
.mAnchorCharRects
[1]);
1038 WriteParam(aMsg
, aParam
.mSelection
.mFocusCharRects
[0]);
1039 WriteParam(aMsg
, aParam
.mSelection
.mFocusCharRects
[1]);
1040 WriteParam(aMsg
, aParam
.mSelection
.mRect
);
1041 WriteParam(aMsg
, aParam
.mFirstCharRect
);
1042 WriteParam(aMsg
, aParam
.mCaret
.mOffset
);
1043 WriteParam(aMsg
, aParam
.mCaret
.mRect
);
1044 WriteParam(aMsg
, aParam
.mTextRectArray
.mStart
);
1045 WriteParam(aMsg
, aParam
.mTextRectArray
.mRects
);
1046 WriteParam(aMsg
, aParam
.mEditorRect
);
1049 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
1051 return ReadParam(aMsg
, aIter
, &aResult
->mCompositionStart
) &&
1052 ReadParam(aMsg
, aIter
, &aResult
->mText
) &&
1053 ReadParam(aMsg
, aIter
, &aResult
->mSelection
.mAnchor
) &&
1054 ReadParam(aMsg
, aIter
, &aResult
->mSelection
.mFocus
) &&
1055 ReadParam(aMsg
, aIter
, &aResult
->mSelection
.mWritingMode
) &&
1056 ReadParam(aMsg
, aIter
, &aResult
->mSelection
.mAnchorCharRects
[0]) &&
1057 ReadParam(aMsg
, aIter
, &aResult
->mSelection
.mAnchorCharRects
[1]) &&
1058 ReadParam(aMsg
, aIter
, &aResult
->mSelection
.mFocusCharRects
[0]) &&
1059 ReadParam(aMsg
, aIter
, &aResult
->mSelection
.mFocusCharRects
[1]) &&
1060 ReadParam(aMsg
, aIter
, &aResult
->mSelection
.mRect
) &&
1061 ReadParam(aMsg
, aIter
, &aResult
->mFirstCharRect
) &&
1062 ReadParam(aMsg
, aIter
, &aResult
->mCaret
.mOffset
) &&
1063 ReadParam(aMsg
, aIter
, &aResult
->mCaret
.mRect
) &&
1064 ReadParam(aMsg
, aIter
, &aResult
->mTextRectArray
.mStart
) &&
1065 ReadParam(aMsg
, aIter
, &aResult
->mTextRectArray
.mRects
) &&
1066 ReadParam(aMsg
, aIter
, &aResult
->mEditorRect
);
1071 struct ParamTraits
<mozilla::widget::CandidateWindowPosition
>
1073 typedef mozilla::widget::CandidateWindowPosition paramType
;
1075 static void Write(Message
* aMsg
, const paramType
& aParam
)
1077 WriteParam(aMsg
, aParam
.mPoint
);
1078 WriteParam(aMsg
, aParam
.mRect
);
1079 WriteParam(aMsg
, aParam
.mExcludeRect
);
1082 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
1084 return ReadParam(aMsg
, aIter
, &aResult
->mPoint
) &&
1085 ReadParam(aMsg
, aIter
, &aResult
->mRect
) &&
1086 ReadParam(aMsg
, aIter
, &aResult
->mExcludeRect
);
1093 struct ParamTraits
<mozilla::InputType
>
1094 : public ContiguousEnumSerializerInclusive
<
1096 mozilla::InputType::MULTITOUCH_INPUT
,
1097 mozilla::kHighestInputType
>
1101 struct ParamTraits
<mozilla::InputData
>
1103 typedef mozilla::InputData paramType
;
1105 static void Write(Message
* aMsg
, const paramType
& aParam
)
1107 WriteParam(aMsg
, aParam
.mInputType
);
1108 WriteParam(aMsg
, aParam
.mTime
);
1109 WriteParam(aMsg
, aParam
.mTimeStamp
);
1110 WriteParam(aMsg
, aParam
.modifiers
);
1111 WriteParam(aMsg
, aParam
.mFocusSequenceNumber
);
1114 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
1116 return ReadParam(aMsg
, aIter
, &aResult
->mInputType
) &&
1117 ReadParam(aMsg
, aIter
, &aResult
->mTime
) &&
1118 ReadParam(aMsg
, aIter
, &aResult
->mTimeStamp
) &&
1119 ReadParam(aMsg
, aIter
, &aResult
->modifiers
) &&
1120 ReadParam(aMsg
, aIter
, &aResult
->mFocusSequenceNumber
);
1125 struct ParamTraits
<mozilla::SingleTouchData
>
1127 typedef mozilla::SingleTouchData paramType
;
1129 static void Write(Message
* aMsg
, const paramType
& aParam
)
1131 WriteParam(aMsg
, aParam
.mIdentifier
);
1132 WriteParam(aMsg
, aParam
.mScreenPoint
);
1133 WriteParam(aMsg
, aParam
.mLocalScreenPoint
);
1134 WriteParam(aMsg
, aParam
.mRadius
);
1135 WriteParam(aMsg
, aParam
.mRotationAngle
);
1136 WriteParam(aMsg
, aParam
.mForce
);
1139 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
1141 return (ReadParam(aMsg
, aIter
, &aResult
->mIdentifier
) &&
1142 ReadParam(aMsg
, aIter
, &aResult
->mScreenPoint
) &&
1143 ReadParam(aMsg
, aIter
, &aResult
->mLocalScreenPoint
) &&
1144 ReadParam(aMsg
, aIter
, &aResult
->mRadius
) &&
1145 ReadParam(aMsg
, aIter
, &aResult
->mRotationAngle
) &&
1146 ReadParam(aMsg
, aIter
, &aResult
->mForce
));
1151 struct ParamTraits
<mozilla::MultiTouchInput::MultiTouchType
>
1152 : public ContiguousEnumSerializerInclusive
<
1153 mozilla::MultiTouchInput::MultiTouchType
,
1154 mozilla::MultiTouchInput::MultiTouchType::MULTITOUCH_START
,
1155 mozilla::MultiTouchInput::sHighestMultiTouchType
>
1159 struct ParamTraits
<mozilla::MultiTouchInput
>
1161 typedef mozilla::MultiTouchInput paramType
;
1163 static void Write(Message
* aMsg
, const paramType
& aParam
)
1165 WriteParam(aMsg
, static_cast<const mozilla::InputData
&>(aParam
));
1166 WriteParam(aMsg
, aParam
.mType
);
1167 WriteParam(aMsg
, aParam
.mTouches
);
1168 WriteParam(aMsg
, aParam
.mHandledByAPZ
);
1171 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
1173 return ReadParam(aMsg
, aIter
, static_cast<mozilla::InputData
*>(aResult
)) &&
1174 ReadParam(aMsg
, aIter
, &aResult
->mType
) &&
1175 ReadParam(aMsg
, aIter
, &aResult
->mTouches
) &&
1176 ReadParam(aMsg
, aIter
, &aResult
->mHandledByAPZ
);
1181 struct ParamTraits
<mozilla::MouseInput::MouseType
>
1182 : public ContiguousEnumSerializerInclusive
<
1183 mozilla::MouseInput::MouseType
,
1184 mozilla::MouseInput::MouseType::MOUSE_NONE
,
1185 mozilla::MouseInput::sHighestMouseType
>
1189 struct ParamTraits
<mozilla::MouseInput::ButtonType
>
1190 : public ContiguousEnumSerializerInclusive
<
1191 mozilla::MouseInput::ButtonType
,
1192 mozilla::MouseInput::ButtonType::LEFT_BUTTON
,
1193 mozilla::MouseInput::sHighestButtonType
>
1197 struct ParamTraits
<mozilla::MouseInput
>
1199 typedef mozilla::MouseInput paramType
;
1201 static void Write(Message
* aMsg
, const paramType
& aParam
)
1203 WriteParam(aMsg
, static_cast<const mozilla::InputData
&>(aParam
));
1204 WriteParam(aMsg
, aParam
.mButtonType
);
1205 WriteParam(aMsg
, aParam
.mType
);
1206 WriteParam(aMsg
, aParam
.mInputSource
);
1207 WriteParam(aMsg
, aParam
.mButtons
);
1208 WriteParam(aMsg
, aParam
.mOrigin
);
1209 WriteParam(aMsg
, aParam
.mLocalOrigin
);
1210 WriteParam(aMsg
, aParam
.mHandledByAPZ
);
1213 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
1215 return ReadParam(aMsg
, aIter
, static_cast<mozilla::InputData
*>(aResult
)) &&
1216 ReadParam(aMsg
, aIter
, &aResult
->mButtonType
) &&
1217 ReadParam(aMsg
, aIter
, &aResult
->mType
) &&
1218 ReadParam(aMsg
, aIter
, &aResult
->mInputSource
) &&
1219 ReadParam(aMsg
, aIter
, &aResult
->mButtons
) &&
1220 ReadParam(aMsg
, aIter
, &aResult
->mOrigin
) &&
1221 ReadParam(aMsg
, aIter
, &aResult
->mLocalOrigin
) &&
1222 ReadParam(aMsg
, aIter
, &aResult
->mHandledByAPZ
);
1227 struct ParamTraits
<mozilla::PanGestureInput::PanGestureType
>
1228 : public ContiguousEnumSerializerInclusive
<
1229 mozilla::PanGestureInput::PanGestureType
,
1230 mozilla::PanGestureInput::PanGestureType::PANGESTURE_MAYSTART
,
1231 mozilla::PanGestureInput::sHighestPanGestureType
>
1235 struct ParamTraits
<mozilla::PanGestureInput
>
1237 typedef mozilla::PanGestureInput paramType
;
1239 static void Write(Message
* aMsg
, const paramType
& aParam
)
1241 WriteParam(aMsg
, static_cast<const mozilla::InputData
&>(aParam
));
1242 WriteParam(aMsg
, aParam
.mType
);
1243 WriteParam(aMsg
, aParam
.mPanStartPoint
);
1244 WriteParam(aMsg
, aParam
.mPanDisplacement
);
1245 WriteParam(aMsg
, aParam
.mLocalPanStartPoint
);
1246 WriteParam(aMsg
, aParam
.mLocalPanDisplacement
);
1247 WriteParam(aMsg
, aParam
.mLineOrPageDeltaX
);
1248 WriteParam(aMsg
, aParam
.mLineOrPageDeltaY
);
1249 WriteParam(aMsg
, aParam
.mUserDeltaMultiplierX
);
1250 WriteParam(aMsg
, aParam
.mUserDeltaMultiplierY
);
1251 WriteParam(aMsg
, aParam
.mHandledByAPZ
);
1252 WriteParam(aMsg
, aParam
.mFollowedByMomentum
);
1253 WriteParam(aMsg
, aParam
.mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection
);
1254 WriteParam(aMsg
, aParam
.mOverscrollBehaviorAllowsSwipe
);
1257 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
1259 return ReadParam(aMsg
, aIter
, static_cast<mozilla::InputData
*>(aResult
)) &&
1260 ReadParam(aMsg
, aIter
, &aResult
->mType
) &&
1261 ReadParam(aMsg
, aIter
, &aResult
->mPanStartPoint
) &&
1262 ReadParam(aMsg
, aIter
, &aResult
->mPanDisplacement
) &&
1263 ReadParam(aMsg
, aIter
, &aResult
->mLocalPanStartPoint
) &&
1264 ReadParam(aMsg
, aIter
, &aResult
->mLocalPanDisplacement
) &&
1265 ReadParam(aMsg
, aIter
, &aResult
->mLineOrPageDeltaX
) &&
1266 ReadParam(aMsg
, aIter
, &aResult
->mLineOrPageDeltaY
) &&
1267 ReadParam(aMsg
, aIter
, &aResult
->mUserDeltaMultiplierX
) &&
1268 ReadParam(aMsg
, aIter
, &aResult
->mUserDeltaMultiplierY
) &&
1269 ReadParam(aMsg
, aIter
, &aResult
->mHandledByAPZ
) &&
1270 ReadParam(aMsg
, aIter
, &aResult
->mFollowedByMomentum
) &&
1271 ReadParam(aMsg
, aIter
, &aResult
->mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection
) &&
1272 ReadParam(aMsg
, aIter
, &aResult
->mOverscrollBehaviorAllowsSwipe
);
1277 struct ParamTraits
<mozilla::PinchGestureInput::PinchGestureType
>
1278 : public ContiguousEnumSerializerInclusive
<
1279 mozilla::PinchGestureInput::PinchGestureType
,
1280 mozilla::PinchGestureInput::PinchGestureType::PINCHGESTURE_START
,
1281 mozilla::PinchGestureInput::sHighestPinchGestureType
>
1285 struct ParamTraits
<mozilla::PinchGestureInput
>
1287 typedef mozilla::PinchGestureInput paramType
;
1289 static void Write(Message
* aMsg
, const paramType
& aParam
)
1291 WriteParam(aMsg
, static_cast<const mozilla::InputData
&>(aParam
));
1292 WriteParam(aMsg
, aParam
.mType
);
1293 WriteParam(aMsg
, aParam
.mFocusPoint
);
1294 WriteParam(aMsg
, aParam
.mLocalFocusPoint
);
1295 WriteParam(aMsg
, aParam
.mCurrentSpan
);
1296 WriteParam(aMsg
, aParam
.mPreviousSpan
);
1299 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
1301 return ReadParam(aMsg
, aIter
, static_cast<mozilla::InputData
*>(aResult
)) &&
1302 ReadParam(aMsg
, aIter
, &aResult
->mType
) &&
1303 ReadParam(aMsg
, aIter
, &aResult
->mFocusPoint
) &&
1304 ReadParam(aMsg
, aIter
, &aResult
->mLocalFocusPoint
) &&
1305 ReadParam(aMsg
, aIter
, &aResult
->mCurrentSpan
) &&
1306 ReadParam(aMsg
, aIter
, &aResult
->mPreviousSpan
);
1311 struct ParamTraits
<mozilla::TapGestureInput::TapGestureType
>
1312 : public ContiguousEnumSerializerInclusive
<
1313 mozilla::TapGestureInput::TapGestureType
,
1314 mozilla::TapGestureInput::TapGestureType::TAPGESTURE_LONG
,
1315 mozilla::TapGestureInput::sHighestTapGestureType
>
1319 struct ParamTraits
<mozilla::TapGestureInput
>
1321 typedef mozilla::TapGestureInput paramType
;
1323 static void Write(Message
* aMsg
, const paramType
& aParam
)
1325 WriteParam(aMsg
, static_cast<const mozilla::InputData
&>(aParam
));
1326 WriteParam(aMsg
, aParam
.mType
);
1327 WriteParam(aMsg
, aParam
.mPoint
);
1328 WriteParam(aMsg
, aParam
.mLocalPoint
);
1331 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
1333 return ReadParam(aMsg
, aIter
, static_cast<mozilla::InputData
*>(aResult
)) &&
1334 ReadParam(aMsg
, aIter
, &aResult
->mType
) &&
1335 ReadParam(aMsg
, aIter
, &aResult
->mPoint
) &&
1336 ReadParam(aMsg
, aIter
, &aResult
->mLocalPoint
);
1341 struct ParamTraits
<mozilla::ScrollWheelInput::ScrollDeltaType
>
1342 : public ContiguousEnumSerializerInclusive
<
1343 mozilla::ScrollWheelInput::ScrollDeltaType
,
1344 mozilla::ScrollWheelInput::ScrollDeltaType::SCROLLDELTA_LINE
,
1345 mozilla::ScrollWheelInput::sHighestScrollDeltaType
>
1349 struct ParamTraits
<mozilla::ScrollWheelInput::ScrollMode
>
1350 : public ContiguousEnumSerializerInclusive
<
1351 mozilla::ScrollWheelInput::ScrollMode
,
1352 mozilla::ScrollWheelInput::ScrollMode::SCROLLMODE_INSTANT
,
1353 mozilla::ScrollWheelInput::sHighestScrollMode
>
1357 struct ParamTraits
<mozilla::WheelDeltaAdjustmentStrategy
> :
1358 public ContiguousEnumSerializer
<
1359 mozilla::WheelDeltaAdjustmentStrategy
,
1360 mozilla::WheelDeltaAdjustmentStrategy(0),
1361 mozilla::WheelDeltaAdjustmentStrategy::eSentinel
>
1365 struct ParamTraits
<mozilla::ScrollWheelInput
>
1367 typedef mozilla::ScrollWheelInput paramType
;
1369 static void Write(Message
* aMsg
, const paramType
& aParam
)
1371 WriteParam(aMsg
, static_cast<const mozilla::InputData
&>(aParam
));
1372 WriteParam(aMsg
, aParam
.mDeltaType
);
1373 WriteParam(aMsg
, aParam
.mScrollMode
);
1374 WriteParam(aMsg
, aParam
.mOrigin
);
1375 WriteParam(aMsg
, aParam
.mHandledByAPZ
);
1376 WriteParam(aMsg
, aParam
.mDeltaX
);
1377 WriteParam(aMsg
, aParam
.mDeltaY
);
1378 WriteParam(aMsg
, aParam
.mLocalOrigin
);
1379 WriteParam(aMsg
, aParam
.mLineOrPageDeltaX
);
1380 WriteParam(aMsg
, aParam
.mLineOrPageDeltaY
);
1381 WriteParam(aMsg
, aParam
.mScrollSeriesNumber
);
1382 WriteParam(aMsg
, aParam
.mUserDeltaMultiplierX
);
1383 WriteParam(aMsg
, aParam
.mUserDeltaMultiplierY
);
1384 WriteParam(aMsg
, aParam
.mMayHaveMomentum
);
1385 WriteParam(aMsg
, aParam
.mIsMomentum
);
1386 WriteParam(aMsg
, aParam
.mAllowToOverrideSystemScrollSpeed
);
1387 WriteParam(aMsg
, aParam
.mWheelDeltaAdjustmentStrategy
);
1390 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
1392 return ReadParam(aMsg
, aIter
, static_cast<mozilla::InputData
*>(aResult
)) &&
1393 ReadParam(aMsg
, aIter
, &aResult
->mDeltaType
) &&
1394 ReadParam(aMsg
, aIter
, &aResult
->mScrollMode
) &&
1395 ReadParam(aMsg
, aIter
, &aResult
->mOrigin
) &&
1396 ReadParam(aMsg
, aIter
, &aResult
->mHandledByAPZ
) &&
1397 ReadParam(aMsg
, aIter
, &aResult
->mDeltaX
) &&
1398 ReadParam(aMsg
, aIter
, &aResult
->mDeltaY
) &&
1399 ReadParam(aMsg
, aIter
, &aResult
->mLocalOrigin
) &&
1400 ReadParam(aMsg
, aIter
, &aResult
->mLineOrPageDeltaX
) &&
1401 ReadParam(aMsg
, aIter
, &aResult
->mLineOrPageDeltaY
) &&
1402 ReadParam(aMsg
, aIter
, &aResult
->mScrollSeriesNumber
) &&
1403 ReadParam(aMsg
, aIter
, &aResult
->mUserDeltaMultiplierX
) &&
1404 ReadParam(aMsg
, aIter
, &aResult
->mUserDeltaMultiplierY
) &&
1405 ReadParam(aMsg
, aIter
, &aResult
->mMayHaveMomentum
) &&
1406 ReadParam(aMsg
, aIter
, &aResult
->mIsMomentum
) &&
1407 ReadParam(aMsg
, aIter
,
1408 &aResult
->mAllowToOverrideSystemScrollSpeed
) &&
1409 ReadParam(aMsg
, aIter
, &aResult
->mWheelDeltaAdjustmentStrategy
);
1414 struct ParamTraits
<mozilla::KeyboardInput::KeyboardEventType
>
1415 : public ContiguousEnumSerializer
<
1416 mozilla::KeyboardInput::KeyboardEventType
,
1417 mozilla::KeyboardInput::KeyboardEventType::KEY_DOWN
,
1418 mozilla::KeyboardInput::KeyboardEventType::KEY_SENTINEL
>
1422 struct ParamTraits
<mozilla::KeyboardInput
>
1424 typedef mozilla::KeyboardInput paramType
;
1426 static void Write(Message
* aMsg
, const paramType
& aParam
)
1428 WriteParam(aMsg
, static_cast<const mozilla::InputData
&>(aParam
));
1429 WriteParam(aMsg
, aParam
.mType
);
1430 WriteParam(aMsg
, aParam
.mKeyCode
);
1431 WriteParam(aMsg
, aParam
.mCharCode
);
1432 WriteParam(aMsg
, aParam
.mShortcutCandidates
);
1433 WriteParam(aMsg
, aParam
.mHandledByAPZ
);
1436 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
, paramType
* aResult
)
1438 return ReadParam(aMsg
, aIter
, static_cast<mozilla::InputData
*>(aResult
)) &&
1439 ReadParam(aMsg
, aIter
, &aResult
->mType
) &&
1440 ReadParam(aMsg
, aIter
, &aResult
->mKeyCode
) &&
1441 ReadParam(aMsg
, aIter
, &aResult
->mCharCode
) &&
1442 ReadParam(aMsg
, aIter
, &aResult
->mShortcutCandidates
) &&
1443 ReadParam(aMsg
, aIter
, &aResult
->mHandledByAPZ
);
1449 #endif // nsGUIEventIPC_h__