Line data Source code
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/. */
5 :
6 : #ifndef nsGUIEventIPC_h__
7 : #define nsGUIEventIPC_h__
8 :
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 "InputData.h"
18 :
19 : namespace IPC
20 : {
21 :
22 : template<>
23 : struct ParamTraits<mozilla::EventMessage>
24 : {
25 : typedef mozilla::EventMessage paramType;
26 :
27 6 : static void Write(Message* aMsg, const paramType& aParam)
28 : {
29 6 : WriteParam(aMsg, static_cast<const mozilla::EventMessageType&>(aParam));
30 6 : }
31 :
32 6 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
33 : {
34 6 : mozilla::EventMessageType eventMessage = 0;
35 6 : bool ret = ReadParam(aMsg, aIter, &eventMessage);
36 6 : *aResult = static_cast<paramType>(eventMessage);
37 6 : return ret;
38 : }
39 : };
40 :
41 : template<>
42 : struct ParamTraits<mozilla::BaseEventFlags>
43 : {
44 : typedef mozilla::BaseEventFlags paramType;
45 :
46 6 : static void Write(Message* aMsg, const paramType& aParam)
47 : {
48 6 : aMsg->WriteBytes(&aParam, sizeof(aParam));
49 6 : }
50 :
51 6 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
52 : {
53 6 : return aMsg->ReadBytesInto(aIter, aResult, sizeof(*aResult));
54 : }
55 : };
56 :
57 : template<>
58 : struct ParamTraits<mozilla::WidgetEvent>
59 : {
60 : typedef mozilla::WidgetEvent paramType;
61 :
62 6 : static void Write(Message* aMsg, const paramType& aParam)
63 : {
64 : // Mark the event as posted to another process.
65 6 : const_cast<mozilla::WidgetEvent&>(aParam).MarkAsPostedToRemoteProcess();
66 :
67 : WriteParam(aMsg,
68 6 : static_cast<mozilla::EventClassIDType>(aParam.mClass));
69 6 : WriteParam(aMsg, aParam.mMessage);
70 6 : WriteParam(aMsg, aParam.mRefPoint);
71 6 : WriteParam(aMsg, aParam.mFocusSequenceNumber);
72 6 : WriteParam(aMsg, aParam.mTime);
73 6 : WriteParam(aMsg, aParam.mTimeStamp);
74 6 : WriteParam(aMsg, aParam.mFlags);
75 6 : }
76 :
77 6 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
78 : {
79 6 : mozilla::EventClassIDType eventClassID = 0;
80 12 : bool ret = ReadParam(aMsg, aIter, &eventClassID) &&
81 12 : ReadParam(aMsg, aIter, &aResult->mMessage) &&
82 12 : ReadParam(aMsg, aIter, &aResult->mRefPoint) &&
83 12 : ReadParam(aMsg, aIter, &aResult->mFocusSequenceNumber) &&
84 12 : ReadParam(aMsg, aIter, &aResult->mTime) &&
85 18 : ReadParam(aMsg, aIter, &aResult->mTimeStamp) &&
86 12 : ReadParam(aMsg, aIter, &aResult->mFlags);
87 6 : aResult->mClass = static_cast<mozilla::EventClassID>(eventClassID);
88 6 : if (ret) {
89 : // Reset cross process dispatching state here because the event has not
90 : // been dispatched to different process from current process.
91 6 : aResult->ResetCrossProcessDispatchingState();
92 : }
93 6 : return ret;
94 : }
95 : };
96 :
97 : template<>
98 : struct ParamTraits<mozilla::NativeEventData>
99 : {
100 : typedef mozilla::NativeEventData paramType;
101 :
102 6 : static void Write(Message* aMsg, const paramType& aParam)
103 : {
104 6 : WriteParam(aMsg, aParam.mBuffer);
105 6 : }
106 :
107 6 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
108 : {
109 6 : return ReadParam(aMsg, aIter, &aResult->mBuffer);
110 : }
111 : };
112 :
113 : template<>
114 : struct ParamTraits<mozilla::WidgetGUIEvent>
115 : {
116 : typedef mozilla::WidgetGUIEvent paramType;
117 :
118 6 : static void Write(Message* aMsg, const paramType& aParam)
119 : {
120 6 : WriteParam(aMsg, static_cast<const mozilla::WidgetEvent&>(aParam));
121 6 : WriteParam(aMsg, aParam.mPluginEvent);
122 6 : }
123 :
124 6 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
125 : {
126 12 : return ReadParam(aMsg, aIter, static_cast<mozilla::WidgetEvent*>(aResult)) &&
127 12 : ReadParam(aMsg, aIter, &aResult->mPluginEvent);
128 : }
129 : };
130 :
131 : template<>
132 : struct ParamTraits<mozilla::WidgetInputEvent>
133 : {
134 : typedef mozilla::WidgetInputEvent paramType;
135 :
136 6 : static void Write(Message* aMsg, const paramType& aParam)
137 : {
138 6 : WriteParam(aMsg, static_cast<const mozilla::WidgetGUIEvent&>(aParam));
139 6 : WriteParam(aMsg, aParam.mModifiers);
140 6 : }
141 :
142 6 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
143 : {
144 6 : return ReadParam(aMsg, aIter,
145 12 : static_cast<mozilla::WidgetGUIEvent*>(aResult)) &&
146 12 : ReadParam(aMsg, aIter, &aResult->mModifiers);
147 : }
148 : };
149 :
150 : template<>
151 : struct ParamTraits<mozilla::WidgetMouseEventBase>
152 : {
153 : typedef mozilla::WidgetMouseEventBase paramType;
154 :
155 6 : static void Write(Message* aMsg, const paramType& aParam)
156 : {
157 6 : WriteParam(aMsg, static_cast<const mozilla::WidgetInputEvent&>(aParam));
158 6 : WriteParam(aMsg, aParam.button);
159 6 : WriteParam(aMsg, aParam.buttons);
160 6 : WriteParam(aMsg, aParam.pressure);
161 6 : WriteParam(aMsg, aParam.hitCluster);
162 6 : WriteParam(aMsg, aParam.inputSource);
163 6 : }
164 :
165 6 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
166 : {
167 6 : return ReadParam(aMsg, aIter,
168 6 : static_cast<mozilla::WidgetInputEvent*>(aResult)) &&
169 12 : ReadParam(aMsg, aIter, &aResult->button) &&
170 12 : ReadParam(aMsg, aIter, &aResult->buttons) &&
171 12 : ReadParam(aMsg, aIter, &aResult->pressure) &&
172 18 : ReadParam(aMsg, aIter, &aResult->hitCluster) &&
173 12 : ReadParam(aMsg, aIter, &aResult->inputSource);
174 : }
175 : };
176 :
177 : template<>
178 : struct ParamTraits<mozilla::WidgetWheelEvent>
179 : {
180 : typedef mozilla::WidgetWheelEvent paramType;
181 :
182 0 : static void Write(Message* aMsg, const paramType& aParam)
183 : {
184 0 : WriteParam(aMsg, static_cast<const mozilla::WidgetMouseEventBase&>(aParam));
185 0 : WriteParam(aMsg, aParam.mDeltaX);
186 0 : WriteParam(aMsg, aParam.mDeltaY);
187 0 : WriteParam(aMsg, aParam.mDeltaZ);
188 0 : WriteParam(aMsg, aParam.mDeltaMode);
189 0 : WriteParam(aMsg, aParam.mCustomizedByUserPrefs);
190 0 : WriteParam(aMsg, aParam.mMayHaveMomentum);
191 0 : WriteParam(aMsg, aParam.mIsMomentum);
192 0 : WriteParam(aMsg, aParam.mIsNoLineOrPageDelta);
193 0 : WriteParam(aMsg, aParam.mLineOrPageDeltaX);
194 0 : WriteParam(aMsg, aParam.mLineOrPageDeltaY);
195 0 : WriteParam(aMsg, static_cast<uint8_t>(aParam.mScrollType));
196 0 : WriteParam(aMsg, aParam.mOverflowDeltaX);
197 0 : WriteParam(aMsg, aParam.mOverflowDeltaY);
198 0 : WriteParam(aMsg, aParam.mViewPortIsOverscrolled);
199 0 : WriteParam(aMsg, aParam.mCanTriggerSwipe);
200 0 : WriteParam(aMsg, aParam.mAllowToOverrideSystemScrollSpeed);
201 0 : }
202 :
203 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
204 : {
205 0 : uint8_t scrollType = 0;
206 : bool rv =
207 0 : ReadParam(aMsg, aIter,
208 0 : static_cast<mozilla::WidgetMouseEventBase*>(aResult)) &&
209 0 : ReadParam(aMsg, aIter, &aResult->mDeltaX) &&
210 0 : ReadParam(aMsg, aIter, &aResult->mDeltaY) &&
211 0 : ReadParam(aMsg, aIter, &aResult->mDeltaZ) &&
212 0 : ReadParam(aMsg, aIter, &aResult->mDeltaMode) &&
213 0 : ReadParam(aMsg, aIter, &aResult->mCustomizedByUserPrefs) &&
214 0 : ReadParam(aMsg, aIter, &aResult->mMayHaveMomentum) &&
215 0 : ReadParam(aMsg, aIter, &aResult->mIsMomentum) &&
216 0 : ReadParam(aMsg, aIter, &aResult->mIsNoLineOrPageDelta) &&
217 0 : ReadParam(aMsg, aIter, &aResult->mLineOrPageDeltaX) &&
218 0 : ReadParam(aMsg, aIter, &aResult->mLineOrPageDeltaY) &&
219 0 : ReadParam(aMsg, aIter, &scrollType) &&
220 0 : ReadParam(aMsg, aIter, &aResult->mOverflowDeltaX) &&
221 0 : ReadParam(aMsg, aIter, &aResult->mOverflowDeltaY) &&
222 0 : ReadParam(aMsg, aIter, &aResult->mViewPortIsOverscrolled) &&
223 0 : ReadParam(aMsg, aIter, &aResult->mCanTriggerSwipe) &&
224 0 : ReadParam(aMsg, aIter, &aResult->mAllowToOverrideSystemScrollSpeed);
225 0 : aResult->mScrollType =
226 0 : static_cast<mozilla::WidgetWheelEvent::ScrollType>(scrollType);
227 0 : return rv;
228 : }
229 : };
230 :
231 : template<>
232 : struct ParamTraits<mozilla::WidgetPointerHelper>
233 : {
234 : typedef mozilla::WidgetPointerHelper paramType;
235 :
236 6 : static void Write(Message* aMsg, const paramType& aParam)
237 : {
238 6 : WriteParam(aMsg, aParam.pointerId);
239 6 : WriteParam(aMsg, aParam.tiltX);
240 6 : WriteParam(aMsg, aParam.tiltY);
241 6 : WriteParam(aMsg, aParam.twist);
242 6 : WriteParam(aMsg, aParam.tangentialPressure);
243 : // We don't serialize convertToPointer since it's temporarily variable and
244 : // should be reset to default.
245 6 : }
246 :
247 6 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
248 : {
249 : bool rv;
250 18 : rv = ReadParam(aMsg, aIter, &aResult->pointerId) &&
251 12 : ReadParam(aMsg, aIter, &aResult->tiltX) &&
252 12 : ReadParam(aMsg, aIter, &aResult->tiltY) &&
253 18 : ReadParam(aMsg, aIter, &aResult->twist) &&
254 6 : ReadParam(aMsg, aIter, &aResult->tangentialPressure);
255 6 : return rv;
256 : }
257 : };
258 :
259 : template<>
260 : struct ParamTraits<mozilla::WidgetMouseEvent>
261 : {
262 : typedef mozilla::WidgetMouseEvent paramType;
263 :
264 6 : static void Write(Message* aMsg, const paramType& aParam)
265 : {
266 6 : WriteParam(aMsg, static_cast<const mozilla::WidgetMouseEventBase&>(aParam));
267 6 : WriteParam(aMsg, static_cast<mozilla::WidgetPointerHelper>(aParam));
268 6 : WriteParam(aMsg, aParam.mIgnoreRootScrollFrame);
269 6 : WriteParam(aMsg, static_cast<paramType::ReasonType>(aParam.mReason));
270 12 : WriteParam(aMsg, static_cast<paramType::ContextMenuTriggerType>(
271 12 : aParam.mContextMenuTrigger));
272 6 : WriteParam(aMsg, static_cast<paramType::ExitFromType>(aParam.mExitFrom));
273 6 : WriteParam(aMsg, aParam.mClickCount);
274 6 : }
275 :
276 6 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
277 : {
278 : bool rv;
279 6 : paramType::ReasonType reason = 0;
280 6 : paramType::ContextMenuTriggerType contextMenuTrigger = 0;
281 6 : paramType::ExitFromType exitFrom = 0;
282 12 : rv = ReadParam(aMsg, aIter,
283 6 : static_cast<mozilla::WidgetMouseEventBase*>(aResult)) &&
284 6 : ReadParam(aMsg, aIter,
285 6 : static_cast<mozilla::WidgetPointerHelper*>(aResult)) &&
286 12 : ReadParam(aMsg, aIter, &aResult->mIgnoreRootScrollFrame) &&
287 12 : ReadParam(aMsg, aIter, &reason) &&
288 12 : ReadParam(aMsg, aIter, &contextMenuTrigger) &&
289 18 : ReadParam(aMsg, aIter, &exitFrom) &&
290 6 : ReadParam(aMsg, aIter, &aResult->mClickCount);
291 6 : aResult->mReason = static_cast<paramType::Reason>(reason);
292 6 : aResult->mContextMenuTrigger =
293 6 : static_cast<paramType::ContextMenuTrigger>(contextMenuTrigger);
294 6 : aResult->mExitFrom = static_cast<paramType::ExitFrom>(exitFrom);
295 6 : return rv;
296 : }
297 : };
298 :
299 :
300 : template<>
301 : struct ParamTraits<mozilla::WidgetDragEvent>
302 : {
303 : typedef mozilla::WidgetDragEvent paramType;
304 :
305 0 : static void Write(Message* aMsg, const paramType& aParam)
306 : {
307 0 : WriteParam(aMsg, static_cast<const mozilla::WidgetMouseEvent&>(aParam));
308 0 : WriteParam(aMsg, aParam.mUserCancelled);
309 0 : WriteParam(aMsg, aParam.mDefaultPreventedOnContent);
310 0 : }
311 :
312 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
313 : {
314 : bool rv =
315 0 : ReadParam(aMsg, aIter, static_cast<mozilla::WidgetMouseEvent*>(aResult)) &&
316 0 : ReadParam(aMsg, aIter, &aResult->mUserCancelled) &&
317 0 : ReadParam(aMsg, aIter, &aResult->mDefaultPreventedOnContent);
318 0 : return rv;
319 : }
320 : };
321 :
322 : template<>
323 : struct ParamTraits<mozilla::WidgetPointerEvent>
324 : {
325 : typedef mozilla::WidgetPointerEvent paramType;
326 :
327 : static void Write(Message* aMsg, const paramType& aParam)
328 : {
329 : WriteParam(aMsg, static_cast<const mozilla::WidgetMouseEvent&>(aParam));
330 : WriteParam(aMsg, aParam.mWidth);
331 : WriteParam(aMsg, aParam.mHeight);
332 : WriteParam(aMsg, aParam.mIsPrimary);
333 : }
334 :
335 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
336 : {
337 : bool rv =
338 : ReadParam(aMsg, aIter, static_cast<mozilla::WidgetMouseEvent*>(aResult)) &&
339 : ReadParam(aMsg, aIter, &aResult->mWidth) &&
340 : ReadParam(aMsg, aIter, &aResult->mHeight) &&
341 : ReadParam(aMsg, aIter, &aResult->mIsPrimary);
342 : return rv;
343 : }
344 : };
345 :
346 : template<>
347 : struct ParamTraits<mozilla::WidgetTouchEvent>
348 : {
349 : typedef mozilla::WidgetTouchEvent paramType;
350 :
351 0 : static void Write(Message* aMsg, const paramType& aParam)
352 : {
353 0 : WriteParam(aMsg, static_cast<const mozilla::WidgetInputEvent&>(aParam));
354 : // Sigh, Touch bites us again! We want to be able to do
355 : // WriteParam(aMsg, aParam.mTouches);
356 0 : const paramType::TouchArray& touches = aParam.mTouches;
357 0 : WriteParam(aMsg, touches.Length());
358 0 : for (uint32_t i = 0; i < touches.Length(); ++i) {
359 0 : mozilla::dom::Touch* touch = touches[i];
360 0 : WriteParam(aMsg, touch->mIdentifier);
361 0 : WriteParam(aMsg, touch->mRefPoint);
362 0 : WriteParam(aMsg, touch->mRadius);
363 0 : WriteParam(aMsg, touch->mRotationAngle);
364 0 : WriteParam(aMsg, touch->mForce);
365 : }
366 0 : }
367 :
368 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
369 : {
370 : paramType::TouchArray::size_type numTouches;
371 0 : if (!ReadParam(aMsg, aIter,
372 0 : static_cast<mozilla::WidgetInputEvent*>(aResult)) ||
373 0 : !ReadParam(aMsg, aIter, &numTouches)) {
374 0 : return false;
375 : }
376 0 : for (uint32_t i = 0; i < numTouches; ++i) {
377 : int32_t identifier;
378 0 : mozilla::LayoutDeviceIntPoint refPoint;
379 0 : mozilla::LayoutDeviceIntPoint radius;
380 : float rotationAngle;
381 : float force;
382 0 : if (!ReadParam(aMsg, aIter, &identifier) ||
383 0 : !ReadParam(aMsg, aIter, &refPoint) ||
384 0 : !ReadParam(aMsg, aIter, &radius) ||
385 0 : !ReadParam(aMsg, aIter, &rotationAngle) ||
386 0 : !ReadParam(aMsg, aIter, &force)) {
387 0 : return false;
388 : }
389 0 : aResult->mTouches.AppendElement(
390 0 : new mozilla::dom::Touch(
391 0 : identifier, refPoint, radius, rotationAngle, force));
392 : }
393 0 : return true;
394 : }
395 : };
396 :
397 : template<>
398 : struct ParamTraits<mozilla::AlternativeCharCode>
399 : {
400 : typedef mozilla::AlternativeCharCode paramType;
401 :
402 0 : static void Write(Message* aMsg, const paramType& aParam)
403 : {
404 0 : WriteParam(aMsg, aParam.mUnshiftedCharCode);
405 0 : WriteParam(aMsg, aParam.mShiftedCharCode);
406 0 : }
407 :
408 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
409 : {
410 0 : return ReadParam(aMsg, aIter, &aResult->mUnshiftedCharCode) &&
411 0 : ReadParam(aMsg, aIter, &aResult->mShiftedCharCode);
412 : }
413 : };
414 :
415 : template<>
416 : struct ParamTraits<mozilla::ShortcutKeyCandidate>
417 : {
418 : typedef mozilla::ShortcutKeyCandidate paramType;
419 :
420 0 : static void Write(Message* aMsg, const paramType& aParam)
421 : {
422 0 : WriteParam(aMsg, aParam.mCharCode);
423 0 : WriteParam(aMsg, aParam.mIgnoreShift);
424 0 : }
425 :
426 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
427 : {
428 0 : return ReadParam(aMsg, aIter, &aResult->mCharCode) &&
429 0 : ReadParam(aMsg, aIter, &aResult->mIgnoreShift);
430 : }
431 : };
432 :
433 : template<>
434 : struct ParamTraits<mozilla::WidgetKeyboardEvent>
435 : {
436 : typedef mozilla::WidgetKeyboardEvent paramType;
437 :
438 0 : static void Write(Message* aMsg, const paramType& aParam)
439 : {
440 0 : WriteParam(aMsg, static_cast<const mozilla::WidgetInputEvent&>(aParam));
441 : WriteParam(aMsg,
442 0 : static_cast<mozilla::KeyNameIndexType>(aParam.mKeyNameIndex));
443 : WriteParam(aMsg,
444 0 : static_cast<mozilla::CodeNameIndexType>(aParam.mCodeNameIndex));
445 0 : WriteParam(aMsg, aParam.mKeyValue);
446 0 : WriteParam(aMsg, aParam.mCodeValue);
447 0 : WriteParam(aMsg, aParam.mKeyCode);
448 0 : WriteParam(aMsg, aParam.mCharCode);
449 0 : WriteParam(aMsg, aParam.mPseudoCharCode);
450 0 : WriteParam(aMsg, aParam.mAlternativeCharCodes);
451 0 : WriteParam(aMsg, aParam.mIsRepeat);
452 0 : WriteParam(aMsg, aParam.mAccessKeyForwardedToChild);
453 0 : WriteParam(aMsg, aParam.mLocation);
454 0 : WriteParam(aMsg, aParam.mUniqueId);
455 0 : WriteParam(aMsg, aParam.mIsSynthesizedByTIP);
456 : #ifdef XP_MACOSX
457 : WriteParam(aMsg, aParam.mNativeKeyCode);
458 : WriteParam(aMsg, aParam.mNativeModifierFlags);
459 : WriteParam(aMsg, aParam.mNativeCharacters);
460 : WriteParam(aMsg, aParam.mNativeCharactersIgnoringModifiers);
461 : WriteParam(aMsg, aParam.mPluginTextEventString);
462 : #endif
463 :
464 : // An OS-specific native event might be attached in |mNativeKeyEvent|, but
465 : // that cannot be copied across process boundaries.
466 :
467 0 : WriteParam(aMsg, aParam.mEditCommandsForSingleLineEditor);
468 0 : WriteParam(aMsg, aParam.mEditCommandsForMultiLineEditor);
469 0 : WriteParam(aMsg, aParam.mEditCommandsForRichTextEditor);
470 0 : WriteParam(aMsg, aParam.mEditCommandsForSingleLineEditorInitialized);
471 0 : WriteParam(aMsg, aParam.mEditCommandsForMultiLineEditorInitialized);
472 0 : WriteParam(aMsg, aParam.mEditCommandsForRichTextEditorInitialized);
473 0 : }
474 :
475 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
476 : {
477 0 : mozilla::KeyNameIndexType keyNameIndex = 0;
478 0 : mozilla::CodeNameIndexType codeNameIndex = 0;
479 0 : if (ReadParam(aMsg, aIter,
480 0 : static_cast<mozilla::WidgetInputEvent*>(aResult)) &&
481 0 : ReadParam(aMsg, aIter, &keyNameIndex) &&
482 0 : ReadParam(aMsg, aIter, &codeNameIndex) &&
483 0 : ReadParam(aMsg, aIter, &aResult->mKeyValue) &&
484 0 : ReadParam(aMsg, aIter, &aResult->mCodeValue) &&
485 0 : ReadParam(aMsg, aIter, &aResult->mKeyCode) &&
486 0 : ReadParam(aMsg, aIter, &aResult->mCharCode) &&
487 0 : ReadParam(aMsg, aIter, &aResult->mPseudoCharCode) &&
488 0 : ReadParam(aMsg, aIter, &aResult->mAlternativeCharCodes) &&
489 0 : ReadParam(aMsg, aIter, &aResult->mIsRepeat) &&
490 0 : ReadParam(aMsg, aIter, &aResult->mAccessKeyForwardedToChild) &&
491 0 : ReadParam(aMsg, aIter, &aResult->mLocation) &&
492 0 : ReadParam(aMsg, aIter, &aResult->mUniqueId) &&
493 0 : ReadParam(aMsg, aIter, &aResult->mIsSynthesizedByTIP) &&
494 : #ifdef XP_MACOSX
495 : ReadParam(aMsg, aIter, &aResult->mNativeKeyCode) &&
496 : ReadParam(aMsg, aIter, &aResult->mNativeModifierFlags) &&
497 : ReadParam(aMsg, aIter, &aResult->mNativeCharacters) &&
498 : ReadParam(aMsg, aIter, &aResult->mNativeCharactersIgnoringModifiers) &&
499 : ReadParam(aMsg, aIter, &aResult->mPluginTextEventString) &&
500 : #endif
501 0 : ReadParam(aMsg, aIter, &aResult->mEditCommandsForSingleLineEditor) &&
502 0 : ReadParam(aMsg, aIter, &aResult->mEditCommandsForMultiLineEditor) &&
503 0 : ReadParam(aMsg, aIter, &aResult->mEditCommandsForRichTextEditor) &&
504 0 : ReadParam(aMsg, aIter,
505 0 : &aResult->mEditCommandsForSingleLineEditorInitialized) &&
506 0 : ReadParam(aMsg, aIter,
507 0 : &aResult->mEditCommandsForMultiLineEditorInitialized) &&
508 0 : ReadParam(aMsg, aIter,
509 : &aResult->mEditCommandsForRichTextEditorInitialized)) {
510 0 : aResult->mKeyNameIndex = static_cast<mozilla::KeyNameIndex>(keyNameIndex);
511 0 : aResult->mCodeNameIndex =
512 0 : static_cast<mozilla::CodeNameIndex>(codeNameIndex);
513 0 : aResult->mNativeKeyEvent = nullptr;
514 0 : return true;
515 : }
516 0 : return false;
517 : }
518 : };
519 :
520 : template<>
521 : struct ParamTraits<mozilla::TextRangeStyle>
522 : {
523 : typedef mozilla::TextRangeStyle paramType;
524 :
525 0 : static void Write(Message* aMsg, const paramType& aParam)
526 : {
527 0 : WriteParam(aMsg, aParam.mDefinedStyles);
528 0 : WriteParam(aMsg, aParam.mLineStyle);
529 0 : WriteParam(aMsg, aParam.mIsBoldLine);
530 0 : WriteParam(aMsg, aParam.mForegroundColor);
531 0 : WriteParam(aMsg, aParam.mBackgroundColor);
532 0 : WriteParam(aMsg, aParam.mUnderlineColor);
533 0 : }
534 :
535 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
536 : {
537 0 : return ReadParam(aMsg, aIter, &aResult->mDefinedStyles) &&
538 0 : ReadParam(aMsg, aIter, &aResult->mLineStyle) &&
539 0 : ReadParam(aMsg, aIter, &aResult->mIsBoldLine) &&
540 0 : ReadParam(aMsg, aIter, &aResult->mForegroundColor) &&
541 0 : ReadParam(aMsg, aIter, &aResult->mBackgroundColor) &&
542 0 : ReadParam(aMsg, aIter, &aResult->mUnderlineColor);
543 : }
544 : };
545 :
546 : template<>
547 : struct ParamTraits<mozilla::TextRange>
548 : {
549 : typedef mozilla::TextRange paramType;
550 :
551 0 : static void Write(Message* aMsg, const paramType& aParam)
552 : {
553 0 : WriteParam(aMsg, aParam.mStartOffset);
554 0 : WriteParam(aMsg, aParam.mEndOffset);
555 0 : WriteParam(aMsg, mozilla::ToRawTextRangeType(aParam.mRangeType));
556 0 : WriteParam(aMsg, aParam.mRangeStyle);
557 0 : }
558 :
559 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
560 : {
561 : mozilla::RawTextRangeType rawTextRangeType;
562 0 : if (ReadParam(aMsg, aIter, &aResult->mStartOffset) &&
563 0 : ReadParam(aMsg, aIter, &aResult->mEndOffset) &&
564 0 : ReadParam(aMsg, aIter, &rawTextRangeType) &&
565 0 : ReadParam(aMsg, aIter, &aResult->mRangeStyle)) {
566 0 : aResult->mRangeType = mozilla::ToTextRangeType(rawTextRangeType);
567 0 : return true;
568 : }
569 0 : return false;
570 : }
571 : };
572 :
573 : template<>
574 : struct ParamTraits<mozilla::TextRangeArray>
575 : {
576 : typedef mozilla::TextRangeArray paramType;
577 :
578 0 : static void Write(Message* aMsg, const paramType& aParam)
579 : {
580 0 : WriteParam(aMsg, aParam.Length());
581 0 : for (uint32_t index = 0; index < aParam.Length(); index++) {
582 0 : WriteParam(aMsg, aParam[index]);
583 : }
584 0 : }
585 :
586 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
587 : {
588 : paramType::size_type length;
589 0 : if (!ReadParam(aMsg, aIter, &length)) {
590 0 : return false;
591 : }
592 0 : for (uint32_t index = 0; index < length; index++) {
593 0 : mozilla::TextRange textRange;
594 0 : if (!ReadParam(aMsg, aIter, &textRange)) {
595 0 : aResult->Clear();
596 0 : return false;
597 : }
598 0 : aResult->AppendElement(textRange);
599 : }
600 0 : return true;
601 : }
602 : };
603 :
604 : template<>
605 : struct ParamTraits<mozilla::WidgetCompositionEvent>
606 : {
607 : typedef mozilla::WidgetCompositionEvent paramType;
608 :
609 0 : static void Write(Message* aMsg, const paramType& aParam)
610 : {
611 0 : WriteParam(aMsg, static_cast<const mozilla::WidgetGUIEvent&>(aParam));
612 0 : WriteParam(aMsg, aParam.mData);
613 0 : WriteParam(aMsg, aParam.mNativeIMEContext);
614 0 : bool hasRanges = !!aParam.mRanges;
615 0 : WriteParam(aMsg, hasRanges);
616 0 : if (hasRanges) {
617 0 : WriteParam(aMsg, *aParam.mRanges.get());
618 : }
619 0 : }
620 :
621 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
622 : {
623 : bool hasRanges;
624 0 : if (!ReadParam(aMsg, aIter,
625 0 : static_cast<mozilla::WidgetGUIEvent*>(aResult)) ||
626 0 : !ReadParam(aMsg, aIter, &aResult->mData) ||
627 0 : !ReadParam(aMsg, aIter, &aResult->mNativeIMEContext) ||
628 0 : !ReadParam(aMsg, aIter, &hasRanges)) {
629 0 : return false;
630 : }
631 :
632 0 : if (!hasRanges) {
633 0 : aResult->mRanges = nullptr;
634 : } else {
635 0 : aResult->mRanges = new mozilla::TextRangeArray();
636 0 : if (!ReadParam(aMsg, aIter, aResult->mRanges.get())) {
637 0 : return false;
638 : }
639 : }
640 0 : return true;
641 : }
642 : };
643 :
644 : template<>
645 : struct ParamTraits<mozilla::FontRange>
646 : {
647 : typedef mozilla::FontRange paramType;
648 :
649 0 : static void Write(Message* aMsg, const paramType& aParam)
650 : {
651 0 : WriteParam(aMsg, aParam.mStartOffset);
652 0 : WriteParam(aMsg, aParam.mFontName);
653 0 : WriteParam(aMsg, aParam.mFontSize);
654 0 : }
655 :
656 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
657 : {
658 0 : return ReadParam(aMsg, aIter, &aResult->mStartOffset) &&
659 0 : ReadParam(aMsg, aIter, &aResult->mFontName) &&
660 0 : ReadParam(aMsg, aIter, &aResult->mFontSize);
661 : }
662 : };
663 :
664 : template<>
665 : struct ParamTraits<mozilla::WidgetQueryContentEvent::Input>
666 : {
667 : typedef mozilla::WidgetQueryContentEvent::Input paramType;
668 : typedef mozilla::WidgetQueryContentEvent event;
669 :
670 : static void Write(Message* aMsg, const paramType& aParam)
671 : {
672 : WriteParam(aMsg, aParam.mOffset);
673 : WriteParam(aMsg, aParam.mLength);
674 : WriteParam(aMsg, mozilla::ToRawSelectionType(aParam.mSelectionType));
675 : }
676 :
677 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
678 : {
679 : mozilla::RawSelectionType rawSelectionType = 0;
680 : bool ok = ReadParam(aMsg, aIter, &aResult->mOffset) &&
681 : ReadParam(aMsg, aIter, &aResult->mLength) &&
682 : ReadParam(aMsg, aIter, &rawSelectionType);
683 : aResult->mSelectionType = mozilla::ToSelectionType(rawSelectionType);
684 : return ok;
685 : }
686 : };
687 :
688 : template<>
689 : struct ParamTraits<mozilla::WidgetQueryContentEvent>
690 : {
691 : typedef mozilla::WidgetQueryContentEvent paramType;
692 :
693 : static void Write(Message* aMsg, const paramType& aParam)
694 : {
695 : WriteParam(aMsg, static_cast<const mozilla::WidgetGUIEvent&>(aParam));
696 : WriteParam(aMsg, aParam.mSucceeded);
697 : WriteParam(aMsg, aParam.mUseNativeLineBreak);
698 : WriteParam(aMsg, aParam.mWithFontRanges);
699 : WriteParam(aMsg, aParam.mInput);
700 : WriteParam(aMsg, aParam.mReply.mOffset);
701 : WriteParam(aMsg, aParam.mReply.mTentativeCaretOffset);
702 : WriteParam(aMsg, aParam.mReply.mString);
703 : WriteParam(aMsg, aParam.mReply.mRect);
704 : WriteParam(aMsg, aParam.mReply.mReversed);
705 : WriteParam(aMsg, aParam.mReply.mHasSelection);
706 : WriteParam(aMsg, aParam.mReply.mWidgetIsHit);
707 : WriteParam(aMsg, aParam.mReply.mFontRanges);
708 : }
709 :
710 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
711 : {
712 : return ReadParam(aMsg, aIter,
713 : static_cast<mozilla::WidgetGUIEvent*>(aResult)) &&
714 : ReadParam(aMsg, aIter, &aResult->mSucceeded) &&
715 : ReadParam(aMsg, aIter, &aResult->mUseNativeLineBreak) &&
716 : ReadParam(aMsg, aIter, &aResult->mWithFontRanges) &&
717 : ReadParam(aMsg, aIter, &aResult->mInput) &&
718 : ReadParam(aMsg, aIter, &aResult->mReply.mOffset) &&
719 : ReadParam(aMsg, aIter, &aResult->mReply.mTentativeCaretOffset) &&
720 : ReadParam(aMsg, aIter, &aResult->mReply.mString) &&
721 : ReadParam(aMsg, aIter, &aResult->mReply.mRect) &&
722 : ReadParam(aMsg, aIter, &aResult->mReply.mReversed) &&
723 : ReadParam(aMsg, aIter, &aResult->mReply.mHasSelection) &&
724 : ReadParam(aMsg, aIter, &aResult->mReply.mWidgetIsHit) &&
725 : ReadParam(aMsg, aIter, &aResult->mReply.mFontRanges);
726 : }
727 : };
728 :
729 : template<>
730 : struct ParamTraits<mozilla::WidgetSelectionEvent>
731 : {
732 : typedef mozilla::WidgetSelectionEvent paramType;
733 :
734 0 : static void Write(Message* aMsg, const paramType& aParam)
735 : {
736 0 : WriteParam(aMsg, static_cast<const mozilla::WidgetGUIEvent&>(aParam));
737 0 : WriteParam(aMsg, aParam.mOffset);
738 0 : WriteParam(aMsg, aParam.mLength);
739 0 : WriteParam(aMsg, aParam.mReversed);
740 0 : WriteParam(aMsg, aParam.mExpandToClusterBoundary);
741 0 : WriteParam(aMsg, aParam.mSucceeded);
742 0 : WriteParam(aMsg, aParam.mUseNativeLineBreak);
743 0 : }
744 :
745 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
746 : {
747 0 : return ReadParam(aMsg, aIter,
748 0 : static_cast<mozilla::WidgetGUIEvent*>(aResult)) &&
749 0 : ReadParam(aMsg, aIter, &aResult->mOffset) &&
750 0 : ReadParam(aMsg, aIter, &aResult->mLength) &&
751 0 : ReadParam(aMsg, aIter, &aResult->mReversed) &&
752 0 : ReadParam(aMsg, aIter, &aResult->mExpandToClusterBoundary) &&
753 0 : ReadParam(aMsg, aIter, &aResult->mSucceeded) &&
754 0 : ReadParam(aMsg, aIter, &aResult->mUseNativeLineBreak);
755 : }
756 : };
757 :
758 : template<>
759 : struct ParamTraits<mozilla::widget::IMENotificationRequests>
760 : {
761 : typedef mozilla::widget::IMENotificationRequests paramType;
762 :
763 0 : static void Write(Message* aMsg, const paramType& aParam)
764 : {
765 0 : WriteParam(aMsg, aParam.mWantUpdates);
766 0 : }
767 :
768 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
769 : {
770 0 : return ReadParam(aMsg, aIter, &aResult->mWantUpdates);
771 : }
772 : };
773 :
774 : template<>
775 : struct ParamTraits<mozilla::widget::NativeIMEContext>
776 : {
777 : typedef mozilla::widget::NativeIMEContext paramType;
778 :
779 0 : static void Write(Message* aMsg, const paramType& aParam)
780 : {
781 0 : WriteParam(aMsg, aParam.mRawNativeIMEContext);
782 0 : WriteParam(aMsg, aParam.mOriginProcessID);
783 0 : }
784 :
785 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
786 : {
787 0 : return ReadParam(aMsg, aIter, &aResult->mRawNativeIMEContext) &&
788 0 : ReadParam(aMsg, aIter, &aResult->mOriginProcessID);
789 : }
790 : };
791 :
792 : template<>
793 : struct ParamTraits<mozilla::widget::IMENotification::Point>
794 : {
795 : typedef mozilla::widget::IMENotification::Point paramType;
796 :
797 0 : static void Write(Message* aMsg, const paramType& aParam)
798 : {
799 0 : WriteParam(aMsg, aParam.mX);
800 0 : WriteParam(aMsg, aParam.mY);
801 0 : }
802 :
803 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
804 : {
805 0 : return ReadParam(aMsg, aIter, &aResult->mX) &&
806 0 : ReadParam(aMsg, aIter, &aResult->mY);
807 : }
808 : };
809 :
810 : template<>
811 : struct ParamTraits<mozilla::widget::IMENotification::Rect>
812 : {
813 : typedef mozilla::widget::IMENotification::Rect paramType;
814 :
815 0 : static void Write(Message* aMsg, const paramType& aParam)
816 : {
817 0 : WriteParam(aMsg, aParam.mX);
818 0 : WriteParam(aMsg, aParam.mY);
819 0 : WriteParam(aMsg, aParam.mWidth);
820 0 : WriteParam(aMsg, aParam.mHeight);
821 0 : }
822 :
823 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
824 : {
825 0 : return ReadParam(aMsg, aIter, &aResult->mX) &&
826 0 : ReadParam(aMsg, aIter, &aResult->mY) &&
827 0 : ReadParam(aMsg, aIter, &aResult->mWidth) &&
828 0 : ReadParam(aMsg, aIter, &aResult->mHeight);
829 : }
830 : };
831 :
832 : template<>
833 : struct ParamTraits<mozilla::widget::IMENotification::SelectionChangeDataBase>
834 : {
835 : typedef mozilla::widget::IMENotification::SelectionChangeDataBase paramType;
836 :
837 0 : static void Write(Message* aMsg, const paramType& aParam)
838 : {
839 0 : MOZ_RELEASE_ASSERT(aParam.mString);
840 0 : WriteParam(aMsg, aParam.mOffset);
841 0 : WriteParam(aMsg, *aParam.mString);
842 0 : WriteParam(aMsg, aParam.mWritingMode);
843 0 : WriteParam(aMsg, aParam.mReversed);
844 0 : WriteParam(aMsg, aParam.mCausedByComposition);
845 0 : WriteParam(aMsg, aParam.mCausedBySelectionEvent);
846 0 : WriteParam(aMsg, aParam.mOccurredDuringComposition);
847 0 : }
848 :
849 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
850 : {
851 0 : aResult->mString = new nsString();
852 0 : return ReadParam(aMsg, aIter, &aResult->mOffset) &&
853 0 : ReadParam(aMsg, aIter, aResult->mString) &&
854 0 : ReadParam(aMsg, aIter, &aResult->mWritingMode) &&
855 0 : ReadParam(aMsg, aIter, &aResult->mReversed) &&
856 0 : ReadParam(aMsg, aIter, &aResult->mCausedByComposition) &&
857 0 : ReadParam(aMsg, aIter, &aResult->mCausedBySelectionEvent) &&
858 0 : ReadParam(aMsg, aIter, &aResult->mOccurredDuringComposition);
859 : }
860 : };
861 :
862 : template<>
863 : struct ParamTraits<mozilla::widget::IMENotification::TextChangeDataBase>
864 : {
865 : typedef mozilla::widget::IMENotification::TextChangeDataBase paramType;
866 :
867 0 : static void Write(Message* aMsg, const paramType& aParam)
868 : {
869 0 : WriteParam(aMsg, aParam.mStartOffset);
870 0 : WriteParam(aMsg, aParam.mRemovedEndOffset);
871 0 : WriteParam(aMsg, aParam.mAddedEndOffset);
872 0 : WriteParam(aMsg, aParam.mCausedOnlyByComposition);
873 0 : WriteParam(aMsg, aParam.mIncludingChangesDuringComposition);
874 0 : WriteParam(aMsg, aParam.mIncludingChangesWithoutComposition);
875 0 : }
876 :
877 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
878 : {
879 0 : return ReadParam(aMsg, aIter, &aResult->mStartOffset) &&
880 0 : ReadParam(aMsg, aIter, &aResult->mRemovedEndOffset) &&
881 0 : ReadParam(aMsg, aIter, &aResult->mAddedEndOffset) &&
882 0 : ReadParam(aMsg, aIter, &aResult->mCausedOnlyByComposition) &&
883 0 : ReadParam(aMsg, aIter,
884 0 : &aResult->mIncludingChangesDuringComposition) &&
885 0 : ReadParam(aMsg, aIter,
886 0 : &aResult->mIncludingChangesWithoutComposition);
887 : }
888 : };
889 :
890 : template<>
891 : struct ParamTraits<mozilla::widget::IMENotification::MouseButtonEventData>
892 : {
893 : typedef mozilla::widget::IMENotification::MouseButtonEventData paramType;
894 :
895 0 : static void Write(Message* aMsg, const paramType& aParam)
896 : {
897 0 : WriteParam(aMsg, aParam.mEventMessage);
898 0 : WriteParam(aMsg, aParam.mOffset);
899 0 : WriteParam(aMsg, aParam.mCursorPos);
900 0 : WriteParam(aMsg, aParam.mCharRect);
901 0 : WriteParam(aMsg, aParam.mButton);
902 0 : WriteParam(aMsg, aParam.mButtons);
903 0 : WriteParam(aMsg, aParam.mModifiers);
904 0 : }
905 :
906 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
907 : {
908 0 : return ReadParam(aMsg, aIter, &aResult->mEventMessage) &&
909 0 : ReadParam(aMsg, aIter, &aResult->mOffset) &&
910 0 : ReadParam(aMsg, aIter, &aResult->mCursorPos) &&
911 0 : ReadParam(aMsg, aIter, &aResult->mCharRect) &&
912 0 : ReadParam(aMsg, aIter, &aResult->mButton) &&
913 0 : ReadParam(aMsg, aIter, &aResult->mButtons) &&
914 0 : ReadParam(aMsg, aIter, &aResult->mModifiers);
915 : }
916 : };
917 :
918 : template<>
919 : struct ParamTraits<mozilla::widget::IMENotification>
920 : {
921 : typedef mozilla::widget::IMENotification paramType;
922 :
923 0 : static void Write(Message* aMsg, const paramType& aParam)
924 : {
925 : WriteParam(aMsg,
926 0 : static_cast<mozilla::widget::IMEMessageType>(aParam.mMessage));
927 0 : switch (aParam.mMessage) {
928 : case mozilla::widget::NOTIFY_IME_OF_SELECTION_CHANGE:
929 0 : WriteParam(aMsg, aParam.mSelectionChangeData);
930 0 : return;
931 : case mozilla::widget::NOTIFY_IME_OF_TEXT_CHANGE:
932 0 : WriteParam(aMsg, aParam.mTextChangeData);
933 0 : return;
934 : case mozilla::widget::NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
935 0 : WriteParam(aMsg, aParam.mMouseButtonEventData);
936 0 : return;
937 : default:
938 0 : return;
939 : }
940 : }
941 :
942 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
943 : {
944 0 : mozilla::widget::IMEMessageType IMEMessage = 0;
945 0 : if (!ReadParam(aMsg, aIter, &IMEMessage)) {
946 0 : return false;
947 : }
948 0 : aResult->mMessage = static_cast<mozilla::widget::IMEMessage>(IMEMessage);
949 0 : switch (aResult->mMessage) {
950 : case mozilla::widget::NOTIFY_IME_OF_SELECTION_CHANGE:
951 0 : return ReadParam(aMsg, aIter, &aResult->mSelectionChangeData);
952 : case mozilla::widget::NOTIFY_IME_OF_TEXT_CHANGE:
953 0 : return ReadParam(aMsg, aIter, &aResult->mTextChangeData);
954 : case mozilla::widget::NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
955 0 : return ReadParam(aMsg, aIter, &aResult->mMouseButtonEventData);
956 : default:
957 0 : return true;
958 : }
959 : }
960 : };
961 :
962 : template<>
963 : struct ParamTraits<mozilla::WidgetPluginEvent>
964 : {
965 : typedef mozilla::WidgetPluginEvent paramType;
966 :
967 0 : static void Write(Message* aMsg, const paramType& aParam)
968 : {
969 0 : WriteParam(aMsg, static_cast<const mozilla::WidgetGUIEvent&>(aParam));
970 0 : WriteParam(aMsg, aParam.mRetargetToFocusedDocument);
971 0 : }
972 :
973 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
974 : {
975 0 : return ReadParam(aMsg, aIter,
976 0 : static_cast<mozilla::WidgetGUIEvent*>(aResult)) &&
977 0 : ReadParam(aMsg, aIter, &aResult->mRetargetToFocusedDocument);
978 : }
979 : };
980 :
981 : template<>
982 : struct ParamTraits<mozilla::WritingMode>
983 : {
984 : typedef mozilla::WritingMode paramType;
985 :
986 1 : static void Write(Message* aMsg, const paramType& aParam)
987 : {
988 1 : WriteParam(aMsg, aParam.mWritingMode);
989 1 : }
990 :
991 1 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
992 : {
993 1 : return ReadParam(aMsg, aIter, &aResult->mWritingMode);
994 : }
995 : };
996 :
997 : template<>
998 : struct ParamTraits<mozilla::ContentCache>
999 : {
1000 : typedef mozilla::ContentCache paramType;
1001 :
1002 1 : static void Write(Message* aMsg, const paramType& aParam)
1003 : {
1004 1 : WriteParam(aMsg, aParam.mCompositionStart);
1005 1 : WriteParam(aMsg, aParam.mText);
1006 1 : WriteParam(aMsg, aParam.mSelection.mAnchor);
1007 1 : WriteParam(aMsg, aParam.mSelection.mFocus);
1008 1 : WriteParam(aMsg, aParam.mSelection.mWritingMode);
1009 1 : WriteParam(aMsg, aParam.mSelection.mAnchorCharRects[0]);
1010 1 : WriteParam(aMsg, aParam.mSelection.mAnchorCharRects[1]);
1011 1 : WriteParam(aMsg, aParam.mSelection.mFocusCharRects[0]);
1012 1 : WriteParam(aMsg, aParam.mSelection.mFocusCharRects[1]);
1013 1 : WriteParam(aMsg, aParam.mSelection.mRect);
1014 1 : WriteParam(aMsg, aParam.mFirstCharRect);
1015 1 : WriteParam(aMsg, aParam.mCaret.mOffset);
1016 1 : WriteParam(aMsg, aParam.mCaret.mRect);
1017 1 : WriteParam(aMsg, aParam.mTextRectArray.mStart);
1018 1 : WriteParam(aMsg, aParam.mTextRectArray.mRects);
1019 1 : WriteParam(aMsg, aParam.mEditorRect);
1020 1 : }
1021 :
1022 1 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
1023 : {
1024 2 : return ReadParam(aMsg, aIter, &aResult->mCompositionStart) &&
1025 2 : ReadParam(aMsg, aIter, &aResult->mText) &&
1026 2 : ReadParam(aMsg, aIter, &aResult->mSelection.mAnchor) &&
1027 2 : ReadParam(aMsg, aIter, &aResult->mSelection.mFocus) &&
1028 2 : ReadParam(aMsg, aIter, &aResult->mSelection.mWritingMode) &&
1029 2 : ReadParam(aMsg, aIter, &aResult->mSelection.mAnchorCharRects[0]) &&
1030 2 : ReadParam(aMsg, aIter, &aResult->mSelection.mAnchorCharRects[1]) &&
1031 2 : ReadParam(aMsg, aIter, &aResult->mSelection.mFocusCharRects[0]) &&
1032 2 : ReadParam(aMsg, aIter, &aResult->mSelection.mFocusCharRects[1]) &&
1033 2 : ReadParam(aMsg, aIter, &aResult->mSelection.mRect) &&
1034 2 : ReadParam(aMsg, aIter, &aResult->mFirstCharRect) &&
1035 2 : ReadParam(aMsg, aIter, &aResult->mCaret.mOffset) &&
1036 2 : ReadParam(aMsg, aIter, &aResult->mCaret.mRect) &&
1037 2 : ReadParam(aMsg, aIter, &aResult->mTextRectArray.mStart) &&
1038 3 : ReadParam(aMsg, aIter, &aResult->mTextRectArray.mRects) &&
1039 2 : ReadParam(aMsg, aIter, &aResult->mEditorRect);
1040 : }
1041 : };
1042 :
1043 : template<>
1044 : struct ParamTraits<mozilla::widget::CandidateWindowPosition>
1045 : {
1046 : typedef mozilla::widget::CandidateWindowPosition paramType;
1047 :
1048 0 : static void Write(Message* aMsg, const paramType& aParam)
1049 : {
1050 0 : WriteParam(aMsg, aParam.mPoint);
1051 0 : WriteParam(aMsg, aParam.mRect);
1052 0 : WriteParam(aMsg, aParam.mExcludeRect);
1053 0 : }
1054 :
1055 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
1056 : {
1057 0 : return ReadParam(aMsg, aIter, &aResult->mPoint) &&
1058 0 : ReadParam(aMsg, aIter, &aResult->mRect) &&
1059 0 : ReadParam(aMsg, aIter, &aResult->mExcludeRect);
1060 : }
1061 : };
1062 :
1063 : // InputData.h
1064 :
1065 : template<>
1066 : struct ParamTraits<mozilla::InputType>
1067 : : public ContiguousEnumSerializerInclusive<
1068 : mozilla::InputType,
1069 : mozilla::InputType::MULTITOUCH_INPUT,
1070 : mozilla::kHighestInputType>
1071 : {};
1072 :
1073 : template<>
1074 : struct ParamTraits<mozilla::InputData>
1075 : {
1076 : typedef mozilla::InputData paramType;
1077 :
1078 0 : static void Write(Message* aMsg, const paramType& aParam)
1079 : {
1080 0 : WriteParam(aMsg, aParam.mInputType);
1081 0 : WriteParam(aMsg, aParam.mTime);
1082 0 : WriteParam(aMsg, aParam.mTimeStamp);
1083 0 : WriteParam(aMsg, aParam.modifiers);
1084 0 : WriteParam(aMsg, aParam.mFocusSequenceNumber);
1085 0 : }
1086 :
1087 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
1088 : {
1089 0 : return ReadParam(aMsg, aIter, &aResult->mInputType) &&
1090 0 : ReadParam(aMsg, aIter, &aResult->mTime) &&
1091 0 : ReadParam(aMsg, aIter, &aResult->mTimeStamp) &&
1092 0 : ReadParam(aMsg, aIter, &aResult->modifiers) &&
1093 0 : ReadParam(aMsg, aIter, &aResult->mFocusSequenceNumber);
1094 : }
1095 : };
1096 :
1097 : template<>
1098 : struct ParamTraits<mozilla::SingleTouchData>
1099 : {
1100 : typedef mozilla::SingleTouchData paramType;
1101 :
1102 0 : static void Write(Message* aMsg, const paramType& aParam)
1103 : {
1104 0 : WriteParam(aMsg, aParam.mIdentifier);
1105 0 : WriteParam(aMsg, aParam.mScreenPoint);
1106 0 : WriteParam(aMsg, aParam.mLocalScreenPoint);
1107 0 : WriteParam(aMsg, aParam.mRadius);
1108 0 : WriteParam(aMsg, aParam.mRotationAngle);
1109 0 : WriteParam(aMsg, aParam.mForce);
1110 0 : }
1111 :
1112 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
1113 : {
1114 0 : return (ReadParam(aMsg, aIter, &aResult->mIdentifier) &&
1115 0 : ReadParam(aMsg, aIter, &aResult->mScreenPoint) &&
1116 0 : ReadParam(aMsg, aIter, &aResult->mLocalScreenPoint) &&
1117 0 : ReadParam(aMsg, aIter, &aResult->mRadius) &&
1118 0 : ReadParam(aMsg, aIter, &aResult->mRotationAngle) &&
1119 0 : ReadParam(aMsg, aIter, &aResult->mForce));
1120 : }
1121 : };
1122 :
1123 : template<>
1124 : struct ParamTraits<mozilla::MultiTouchInput::MultiTouchType>
1125 : : public ContiguousEnumSerializerInclusive<
1126 : mozilla::MultiTouchInput::MultiTouchType,
1127 : mozilla::MultiTouchInput::MultiTouchType::MULTITOUCH_START,
1128 : mozilla::MultiTouchInput::sHighestMultiTouchType>
1129 : {};
1130 :
1131 : template<>
1132 : struct ParamTraits<mozilla::MultiTouchInput>
1133 : {
1134 : typedef mozilla::MultiTouchInput paramType;
1135 :
1136 0 : static void Write(Message* aMsg, const paramType& aParam)
1137 : {
1138 0 : WriteParam(aMsg, static_cast<const mozilla::InputData&>(aParam));
1139 0 : WriteParam(aMsg, aParam.mType);
1140 0 : WriteParam(aMsg, aParam.mTouches);
1141 0 : WriteParam(aMsg, aParam.mHandledByAPZ);
1142 0 : }
1143 :
1144 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
1145 : {
1146 0 : return ReadParam(aMsg, aIter, static_cast<mozilla::InputData*>(aResult)) &&
1147 0 : ReadParam(aMsg, aIter, &aResult->mType) &&
1148 0 : ReadParam(aMsg, aIter, &aResult->mTouches) &&
1149 0 : ReadParam(aMsg, aIter, &aResult->mHandledByAPZ);
1150 : }
1151 : };
1152 :
1153 : template<>
1154 : struct ParamTraits<mozilla::MouseInput::MouseType>
1155 : : public ContiguousEnumSerializerInclusive<
1156 : mozilla::MouseInput::MouseType,
1157 : mozilla::MouseInput::MouseType::MOUSE_NONE,
1158 : mozilla::MouseInput::sHighestMouseType>
1159 : {};
1160 :
1161 : template<>
1162 : struct ParamTraits<mozilla::MouseInput::ButtonType>
1163 : : public ContiguousEnumSerializerInclusive<
1164 : mozilla::MouseInput::ButtonType,
1165 : mozilla::MouseInput::ButtonType::LEFT_BUTTON,
1166 : mozilla::MouseInput::sHighestButtonType>
1167 : {};
1168 :
1169 : template<>
1170 : struct ParamTraits<mozilla::MouseInput>
1171 : {
1172 : typedef mozilla::MouseInput paramType;
1173 :
1174 0 : static void Write(Message* aMsg, const paramType& aParam)
1175 : {
1176 0 : WriteParam(aMsg, static_cast<const mozilla::InputData&>(aParam));
1177 0 : WriteParam(aMsg, aParam.mButtonType);
1178 0 : WriteParam(aMsg, aParam.mType);
1179 0 : WriteParam(aMsg, aParam.mInputSource);
1180 0 : WriteParam(aMsg, aParam.mButtons);
1181 0 : WriteParam(aMsg, aParam.mOrigin);
1182 0 : WriteParam(aMsg, aParam.mLocalOrigin);
1183 0 : WriteParam(aMsg, aParam.mHandledByAPZ);
1184 0 : }
1185 :
1186 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
1187 : {
1188 0 : return ReadParam(aMsg, aIter, static_cast<mozilla::InputData*>(aResult)) &&
1189 0 : ReadParam(aMsg, aIter, &aResult->mButtonType) &&
1190 0 : ReadParam(aMsg, aIter, &aResult->mType) &&
1191 0 : ReadParam(aMsg, aIter, &aResult->mInputSource) &&
1192 0 : ReadParam(aMsg, aIter, &aResult->mButtons) &&
1193 0 : ReadParam(aMsg, aIter, &aResult->mOrigin) &&
1194 0 : ReadParam(aMsg, aIter, &aResult->mLocalOrigin) &&
1195 0 : ReadParam(aMsg, aIter, &aResult->mHandledByAPZ);
1196 : }
1197 : };
1198 :
1199 : template<>
1200 : struct ParamTraits<mozilla::PanGestureInput::PanGestureType>
1201 : : public ContiguousEnumSerializerInclusive<
1202 : mozilla::PanGestureInput::PanGestureType,
1203 : mozilla::PanGestureInput::PanGestureType::PANGESTURE_MAYSTART,
1204 : mozilla::PanGestureInput::sHighestPanGestureType>
1205 : {};
1206 :
1207 : template<>
1208 : struct ParamTraits<mozilla::PanGestureInput>
1209 : {
1210 : typedef mozilla::PanGestureInput paramType;
1211 :
1212 0 : static void Write(Message* aMsg, const paramType& aParam)
1213 : {
1214 0 : WriteParam(aMsg, static_cast<const mozilla::InputData&>(aParam));
1215 0 : WriteParam(aMsg, aParam.mType);
1216 0 : WriteParam(aMsg, aParam.mPanStartPoint);
1217 0 : WriteParam(aMsg, aParam.mPanDisplacement);
1218 0 : WriteParam(aMsg, aParam.mLocalPanStartPoint);
1219 0 : WriteParam(aMsg, aParam.mLocalPanDisplacement);
1220 0 : WriteParam(aMsg, aParam.mLineOrPageDeltaX);
1221 0 : WriteParam(aMsg, aParam.mLineOrPageDeltaY);
1222 0 : WriteParam(aMsg, aParam.mUserDeltaMultiplierX);
1223 0 : WriteParam(aMsg, aParam.mUserDeltaMultiplierY);
1224 0 : WriteParam(aMsg, aParam.mHandledByAPZ);
1225 0 : WriteParam(aMsg, aParam.mFollowedByMomentum);
1226 0 : WriteParam(aMsg, aParam.mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection);
1227 0 : }
1228 :
1229 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
1230 : {
1231 0 : return ReadParam(aMsg, aIter, static_cast<mozilla::InputData*>(aResult)) &&
1232 0 : ReadParam(aMsg, aIter, &aResult->mType) &&
1233 0 : ReadParam(aMsg, aIter, &aResult->mPanStartPoint) &&
1234 0 : ReadParam(aMsg, aIter, &aResult->mPanDisplacement) &&
1235 0 : ReadParam(aMsg, aIter, &aResult->mLocalPanStartPoint) &&
1236 0 : ReadParam(aMsg, aIter, &aResult->mLocalPanDisplacement) &&
1237 0 : ReadParam(aMsg, aIter, &aResult->mLineOrPageDeltaX) &&
1238 0 : ReadParam(aMsg, aIter, &aResult->mLineOrPageDeltaY) &&
1239 0 : ReadParam(aMsg, aIter, &aResult->mUserDeltaMultiplierX) &&
1240 0 : ReadParam(aMsg, aIter, &aResult->mUserDeltaMultiplierY) &&
1241 0 : ReadParam(aMsg, aIter, &aResult->mHandledByAPZ) &&
1242 0 : ReadParam(aMsg, aIter, &aResult->mFollowedByMomentum) &&
1243 0 : ReadParam(aMsg, aIter, &aResult->mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection);
1244 : }
1245 : };
1246 :
1247 : template<>
1248 : struct ParamTraits<mozilla::PinchGestureInput::PinchGestureType>
1249 : : public ContiguousEnumSerializerInclusive<
1250 : mozilla::PinchGestureInput::PinchGestureType,
1251 : mozilla::PinchGestureInput::PinchGestureType::PINCHGESTURE_START,
1252 : mozilla::PinchGestureInput::sHighestPinchGestureType>
1253 : {};
1254 :
1255 : template<>
1256 : struct ParamTraits<mozilla::PinchGestureInput>
1257 : {
1258 : typedef mozilla::PinchGestureInput paramType;
1259 :
1260 0 : static void Write(Message* aMsg, const paramType& aParam)
1261 : {
1262 0 : WriteParam(aMsg, static_cast<const mozilla::InputData&>(aParam));
1263 0 : WriteParam(aMsg, aParam.mType);
1264 0 : WriteParam(aMsg, aParam.mFocusPoint);
1265 0 : WriteParam(aMsg, aParam.mLocalFocusPoint);
1266 0 : WriteParam(aMsg, aParam.mCurrentSpan);
1267 0 : WriteParam(aMsg, aParam.mPreviousSpan);
1268 0 : }
1269 :
1270 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
1271 : {
1272 0 : return ReadParam(aMsg, aIter, static_cast<mozilla::InputData*>(aResult)) &&
1273 0 : ReadParam(aMsg, aIter, &aResult->mType) &&
1274 0 : ReadParam(aMsg, aIter, &aResult->mFocusPoint) &&
1275 0 : ReadParam(aMsg, aIter, &aResult->mLocalFocusPoint) &&
1276 0 : ReadParam(aMsg, aIter, &aResult->mCurrentSpan) &&
1277 0 : ReadParam(aMsg, aIter, &aResult->mPreviousSpan);
1278 : }
1279 : };
1280 :
1281 : template<>
1282 : struct ParamTraits<mozilla::TapGestureInput::TapGestureType>
1283 : : public ContiguousEnumSerializerInclusive<
1284 : mozilla::TapGestureInput::TapGestureType,
1285 : mozilla::TapGestureInput::TapGestureType::TAPGESTURE_LONG,
1286 : mozilla::TapGestureInput::sHighestTapGestureType>
1287 : {};
1288 :
1289 : template<>
1290 : struct ParamTraits<mozilla::TapGestureInput>
1291 : {
1292 : typedef mozilla::TapGestureInput paramType;
1293 :
1294 0 : static void Write(Message* aMsg, const paramType& aParam)
1295 : {
1296 0 : WriteParam(aMsg, static_cast<const mozilla::InputData&>(aParam));
1297 0 : WriteParam(aMsg, aParam.mType);
1298 0 : WriteParam(aMsg, aParam.mPoint);
1299 0 : WriteParam(aMsg, aParam.mLocalPoint);
1300 0 : }
1301 :
1302 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
1303 : {
1304 0 : return ReadParam(aMsg, aIter, static_cast<mozilla::InputData*>(aResult)) &&
1305 0 : ReadParam(aMsg, aIter, &aResult->mType) &&
1306 0 : ReadParam(aMsg, aIter, &aResult->mPoint) &&
1307 0 : ReadParam(aMsg, aIter, &aResult->mLocalPoint);
1308 : }
1309 : };
1310 :
1311 : template<>
1312 : struct ParamTraits<mozilla::ScrollWheelInput::ScrollDeltaType>
1313 : : public ContiguousEnumSerializerInclusive<
1314 : mozilla::ScrollWheelInput::ScrollDeltaType,
1315 : mozilla::ScrollWheelInput::ScrollDeltaType::SCROLLDELTA_LINE,
1316 : mozilla::ScrollWheelInput::sHighestScrollDeltaType>
1317 : {};
1318 :
1319 : template<>
1320 : struct ParamTraits<mozilla::ScrollWheelInput::ScrollMode>
1321 : : public ContiguousEnumSerializerInclusive<
1322 : mozilla::ScrollWheelInput::ScrollMode,
1323 : mozilla::ScrollWheelInput::ScrollMode::SCROLLMODE_INSTANT,
1324 : mozilla::ScrollWheelInput::sHighestScrollMode>
1325 : {};
1326 :
1327 : template<>
1328 : struct ParamTraits<mozilla::ScrollWheelInput>
1329 : {
1330 : typedef mozilla::ScrollWheelInput paramType;
1331 :
1332 0 : static void Write(Message* aMsg, const paramType& aParam)
1333 : {
1334 0 : WriteParam(aMsg, static_cast<const mozilla::InputData&>(aParam));
1335 0 : WriteParam(aMsg, aParam.mDeltaType);
1336 0 : WriteParam(aMsg, aParam.mScrollMode);
1337 0 : WriteParam(aMsg, aParam.mOrigin);
1338 0 : WriteParam(aMsg, aParam.mHandledByAPZ);
1339 0 : WriteParam(aMsg, aParam.mDeltaX);
1340 0 : WriteParam(aMsg, aParam.mDeltaY);
1341 0 : WriteParam(aMsg, aParam.mLocalOrigin);
1342 0 : WriteParam(aMsg, aParam.mLineOrPageDeltaX);
1343 0 : WriteParam(aMsg, aParam.mLineOrPageDeltaY);
1344 0 : WriteParam(aMsg, aParam.mScrollSeriesNumber);
1345 0 : WriteParam(aMsg, aParam.mUserDeltaMultiplierX);
1346 0 : WriteParam(aMsg, aParam.mUserDeltaMultiplierY);
1347 0 : WriteParam(aMsg, aParam.mMayHaveMomentum);
1348 0 : WriteParam(aMsg, aParam.mIsMomentum);
1349 0 : WriteParam(aMsg, aParam.mAllowToOverrideSystemScrollSpeed);
1350 0 : }
1351 :
1352 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
1353 : {
1354 0 : return ReadParam(aMsg, aIter, static_cast<mozilla::InputData*>(aResult)) &&
1355 0 : ReadParam(aMsg, aIter, &aResult->mDeltaType) &&
1356 0 : ReadParam(aMsg, aIter, &aResult->mScrollMode) &&
1357 0 : ReadParam(aMsg, aIter, &aResult->mOrigin) &&
1358 0 : ReadParam(aMsg, aIter, &aResult->mHandledByAPZ) &&
1359 0 : ReadParam(aMsg, aIter, &aResult->mDeltaX) &&
1360 0 : ReadParam(aMsg, aIter, &aResult->mDeltaY) &&
1361 0 : ReadParam(aMsg, aIter, &aResult->mLocalOrigin) &&
1362 0 : ReadParam(aMsg, aIter, &aResult->mLineOrPageDeltaX) &&
1363 0 : ReadParam(aMsg, aIter, &aResult->mLineOrPageDeltaY) &&
1364 0 : ReadParam(aMsg, aIter, &aResult->mScrollSeriesNumber) &&
1365 0 : ReadParam(aMsg, aIter, &aResult->mUserDeltaMultiplierX) &&
1366 0 : ReadParam(aMsg, aIter, &aResult->mUserDeltaMultiplierY) &&
1367 0 : ReadParam(aMsg, aIter, &aResult->mMayHaveMomentum) &&
1368 0 : ReadParam(aMsg, aIter, &aResult->mIsMomentum) &&
1369 0 : ReadParam(aMsg, aIter, &aResult->mAllowToOverrideSystemScrollSpeed);
1370 : }
1371 : };
1372 :
1373 : template <>
1374 : struct ParamTraits<mozilla::KeyboardInput::KeyboardEventType>
1375 : : public ContiguousEnumSerializer<
1376 : mozilla::KeyboardInput::KeyboardEventType,
1377 : mozilla::KeyboardInput::KeyboardEventType::KEY_DOWN,
1378 : mozilla::KeyboardInput::KeyboardEventType::KEY_SENTINEL>
1379 : {};
1380 :
1381 : template<>
1382 : struct ParamTraits<mozilla::KeyboardInput>
1383 : {
1384 : typedef mozilla::KeyboardInput paramType;
1385 :
1386 0 : static void Write(Message* aMsg, const paramType& aParam)
1387 : {
1388 0 : WriteParam(aMsg, static_cast<const mozilla::InputData&>(aParam));
1389 0 : WriteParam(aMsg, aParam.mType);
1390 0 : WriteParam(aMsg, aParam.mKeyCode);
1391 0 : WriteParam(aMsg, aParam.mCharCode);
1392 0 : WriteParam(aMsg, aParam.mShortcutCandidates);
1393 0 : WriteParam(aMsg, aParam.mHandledByAPZ);
1394 0 : }
1395 :
1396 0 : static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
1397 : {
1398 0 : return ReadParam(aMsg, aIter, static_cast<mozilla::InputData*>(aResult)) &&
1399 0 : ReadParam(aMsg, aIter, &aResult->mType) &&
1400 0 : ReadParam(aMsg, aIter, &aResult->mKeyCode) &&
1401 0 : ReadParam(aMsg, aIter, &aResult->mCharCode) &&
1402 0 : ReadParam(aMsg, aIter, &aResult->mShortcutCandidates) &&
1403 0 : ReadParam(aMsg, aIter, &aResult->mHandledByAPZ);
1404 : }
1405 : };
1406 :
1407 : } // namespace IPC
1408 :
1409 : #endif // nsGUIEventIPC_h__
|