|
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/GfxMessageUtils.h" |
|
11 #include "mozilla/dom/Touch.h" |
|
12 #include "mozilla/MiscEvents.h" |
|
13 #include "mozilla/MouseEvents.h" |
|
14 #include "mozilla/TextEvents.h" |
|
15 #include "mozilla/TouchEvents.h" |
|
16 |
|
17 namespace IPC |
|
18 { |
|
19 |
|
20 template<> |
|
21 struct ParamTraits<mozilla::BaseEventFlags> |
|
22 { |
|
23 typedef mozilla::BaseEventFlags paramType; |
|
24 |
|
25 static void Write(Message* aMsg, const paramType& aParam) |
|
26 { |
|
27 aMsg->WriteBytes(&aParam, sizeof(aParam)); |
|
28 } |
|
29 |
|
30 static bool Read(const Message* aMsg, void** aIter, paramType* aResult) |
|
31 { |
|
32 const char* outp; |
|
33 if (!aMsg->ReadBytes(aIter, &outp, sizeof(*aResult))) { |
|
34 return false; |
|
35 } |
|
36 *aResult = *reinterpret_cast<const paramType*>(outp); |
|
37 return true; |
|
38 } |
|
39 }; |
|
40 |
|
41 template<> |
|
42 struct ParamTraits<mozilla::WidgetEvent> |
|
43 { |
|
44 typedef mozilla::WidgetEvent paramType; |
|
45 |
|
46 static void Write(Message* aMsg, const paramType& aParam) |
|
47 { |
|
48 WriteParam(aMsg, (uint8_t) aParam.eventStructType); |
|
49 WriteParam(aMsg, aParam.message); |
|
50 WriteParam(aMsg, aParam.refPoint); |
|
51 WriteParam(aMsg, aParam.time); |
|
52 WriteParam(aMsg, aParam.mFlags); |
|
53 } |
|
54 |
|
55 static bool Read(const Message* aMsg, void** aIter, paramType* aResult) |
|
56 { |
|
57 uint8_t eventStructType = 0; |
|
58 bool ret = ReadParam(aMsg, aIter, &eventStructType) && |
|
59 ReadParam(aMsg, aIter, &aResult->message) && |
|
60 ReadParam(aMsg, aIter, &aResult->refPoint) && |
|
61 ReadParam(aMsg, aIter, &aResult->time) && |
|
62 ReadParam(aMsg, aIter, &aResult->mFlags); |
|
63 aResult->eventStructType = static_cast<nsEventStructType>(eventStructType); |
|
64 return ret; |
|
65 } |
|
66 }; |
|
67 |
|
68 template<> |
|
69 struct ParamTraits<mozilla::WidgetGUIEvent> |
|
70 { |
|
71 typedef mozilla::WidgetGUIEvent paramType; |
|
72 |
|
73 static void Write(Message* aMsg, const paramType& aParam) |
|
74 { |
|
75 WriteParam(aMsg, static_cast<mozilla::WidgetEvent>(aParam)); |
|
76 } |
|
77 |
|
78 static bool Read(const Message* aMsg, void** aIter, paramType* aResult) |
|
79 { |
|
80 return ReadParam(aMsg, aIter, static_cast<mozilla::WidgetEvent*>(aResult)); |
|
81 } |
|
82 }; |
|
83 |
|
84 template<> |
|
85 struct ParamTraits<mozilla::WidgetInputEvent> |
|
86 { |
|
87 typedef mozilla::WidgetInputEvent paramType; |
|
88 |
|
89 static void Write(Message* aMsg, const paramType& aParam) |
|
90 { |
|
91 WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam)); |
|
92 WriteParam(aMsg, aParam.modifiers); |
|
93 } |
|
94 |
|
95 static bool Read(const Message* aMsg, void** aIter, paramType* aResult) |
|
96 { |
|
97 return ReadParam(aMsg, aIter, |
|
98 static_cast<mozilla::WidgetGUIEvent*>(aResult)) && |
|
99 ReadParam(aMsg, aIter, &aResult->modifiers); |
|
100 } |
|
101 }; |
|
102 |
|
103 template<> |
|
104 struct ParamTraits<mozilla::WidgetMouseEventBase> |
|
105 { |
|
106 typedef mozilla::WidgetMouseEventBase paramType; |
|
107 |
|
108 static void Write(Message* aMsg, const paramType& aParam) |
|
109 { |
|
110 WriteParam(aMsg, static_cast<mozilla::WidgetInputEvent>(aParam)); |
|
111 WriteParam(aMsg, aParam.button); |
|
112 WriteParam(aMsg, aParam.buttons); |
|
113 WriteParam(aMsg, aParam.pressure); |
|
114 WriteParam(aMsg, aParam.inputSource); |
|
115 } |
|
116 |
|
117 static bool Read(const Message* aMsg, void** aIter, paramType* aResult) |
|
118 { |
|
119 return ReadParam(aMsg, aIter, |
|
120 static_cast<mozilla::WidgetInputEvent*>(aResult)) && |
|
121 ReadParam(aMsg, aIter, &aResult->button) && |
|
122 ReadParam(aMsg, aIter, &aResult->buttons) && |
|
123 ReadParam(aMsg, aIter, &aResult->pressure) && |
|
124 ReadParam(aMsg, aIter, &aResult->inputSource); |
|
125 } |
|
126 }; |
|
127 |
|
128 template<> |
|
129 struct ParamTraits<mozilla::WidgetWheelEvent> |
|
130 { |
|
131 typedef mozilla::WidgetWheelEvent paramType; |
|
132 |
|
133 static void Write(Message* aMsg, const paramType& aParam) |
|
134 { |
|
135 WriteParam(aMsg, static_cast<mozilla::WidgetMouseEventBase>(aParam)); |
|
136 WriteParam(aMsg, aParam.deltaX); |
|
137 WriteParam(aMsg, aParam.deltaY); |
|
138 WriteParam(aMsg, aParam.deltaZ); |
|
139 WriteParam(aMsg, aParam.deltaMode); |
|
140 WriteParam(aMsg, aParam.customizedByUserPrefs); |
|
141 WriteParam(aMsg, aParam.isMomentum); |
|
142 WriteParam(aMsg, aParam.isPixelOnlyDevice); |
|
143 WriteParam(aMsg, aParam.lineOrPageDeltaX); |
|
144 WriteParam(aMsg, aParam.lineOrPageDeltaY); |
|
145 WriteParam(aMsg, static_cast<int32_t>(aParam.scrollType)); |
|
146 WriteParam(aMsg, aParam.overflowDeltaX); |
|
147 WriteParam(aMsg, aParam.overflowDeltaY); |
|
148 } |
|
149 |
|
150 static bool Read(const Message* aMsg, void** aIter, paramType* aResult) |
|
151 { |
|
152 int32_t scrollType = 0; |
|
153 bool rv = |
|
154 ReadParam(aMsg, aIter, |
|
155 static_cast<mozilla::WidgetMouseEventBase*>(aResult)) && |
|
156 ReadParam(aMsg, aIter, &aResult->deltaX) && |
|
157 ReadParam(aMsg, aIter, &aResult->deltaY) && |
|
158 ReadParam(aMsg, aIter, &aResult->deltaZ) && |
|
159 ReadParam(aMsg, aIter, &aResult->deltaMode) && |
|
160 ReadParam(aMsg, aIter, &aResult->customizedByUserPrefs) && |
|
161 ReadParam(aMsg, aIter, &aResult->isMomentum) && |
|
162 ReadParam(aMsg, aIter, &aResult->isPixelOnlyDevice) && |
|
163 ReadParam(aMsg, aIter, &aResult->lineOrPageDeltaX) && |
|
164 ReadParam(aMsg, aIter, &aResult->lineOrPageDeltaY) && |
|
165 ReadParam(aMsg, aIter, &scrollType) && |
|
166 ReadParam(aMsg, aIter, &aResult->overflowDeltaX) && |
|
167 ReadParam(aMsg, aIter, &aResult->overflowDeltaY); |
|
168 aResult->scrollType = |
|
169 static_cast<mozilla::WidgetWheelEvent::ScrollType>(scrollType); |
|
170 return rv; |
|
171 } |
|
172 }; |
|
173 |
|
174 template<> |
|
175 struct ParamTraits<mozilla::WidgetMouseEvent> |
|
176 { |
|
177 typedef mozilla::WidgetMouseEvent paramType; |
|
178 |
|
179 static void Write(Message* aMsg, const paramType& aParam) |
|
180 { |
|
181 WriteParam(aMsg, static_cast<mozilla::WidgetMouseEventBase>(aParam)); |
|
182 WriteParam(aMsg, aParam.ignoreRootScrollFrame); |
|
183 WriteParam(aMsg, (uint8_t) aParam.reason); |
|
184 WriteParam(aMsg, (uint8_t) aParam.context); |
|
185 WriteParam(aMsg, (uint8_t) aParam.exit); |
|
186 WriteParam(aMsg, aParam.clickCount); |
|
187 } |
|
188 |
|
189 static bool Read(const Message* aMsg, void** aIter, paramType* aResult) |
|
190 { |
|
191 bool rv; |
|
192 uint8_t reason = 0, context = 0, exit = 0; |
|
193 rv = ReadParam(aMsg, aIter, |
|
194 static_cast<mozilla::WidgetMouseEventBase*>(aResult)) && |
|
195 ReadParam(aMsg, aIter, &aResult->ignoreRootScrollFrame) && |
|
196 ReadParam(aMsg, aIter, &reason) && |
|
197 ReadParam(aMsg, aIter, &context) && |
|
198 ReadParam(aMsg, aIter, &exit) && |
|
199 ReadParam(aMsg, aIter, &aResult->clickCount); |
|
200 aResult->reason = |
|
201 static_cast<mozilla::WidgetMouseEvent::reasonType>(reason); |
|
202 aResult->context = |
|
203 static_cast<mozilla::WidgetMouseEvent::contextType>(context); |
|
204 aResult->exit = static_cast<mozilla::WidgetMouseEvent::exitType>(exit); |
|
205 return rv; |
|
206 } |
|
207 }; |
|
208 |
|
209 template<> |
|
210 struct ParamTraits<mozilla::WidgetPointerEvent> |
|
211 { |
|
212 typedef mozilla::WidgetPointerEvent paramType; |
|
213 |
|
214 static void Write(Message* aMsg, const paramType& aParam) |
|
215 { |
|
216 WriteParam(aMsg, static_cast<mozilla::WidgetMouseEvent>(aParam)); |
|
217 WriteParam(aMsg, aParam.pointerId); |
|
218 WriteParam(aMsg, aParam.width); |
|
219 WriteParam(aMsg, aParam.height); |
|
220 WriteParam(aMsg, aParam.tiltX); |
|
221 WriteParam(aMsg, aParam.tiltY); |
|
222 WriteParam(aMsg, aParam.isPrimary); |
|
223 } |
|
224 |
|
225 static bool Read(const Message* aMsg, void** aIter, paramType* aResult) |
|
226 { |
|
227 bool rv = |
|
228 ReadParam(aMsg, aIter, static_cast<mozilla::WidgetMouseEvent*>(aResult)) && |
|
229 ReadParam(aMsg, aIter, &aResult->pointerId) && |
|
230 ReadParam(aMsg, aIter, &aResult->width) && |
|
231 ReadParam(aMsg, aIter, &aResult->height) && |
|
232 ReadParam(aMsg, aIter, &aResult->tiltX) && |
|
233 ReadParam(aMsg, aIter, &aResult->tiltY) && |
|
234 ReadParam(aMsg, aIter, &aResult->isPrimary); |
|
235 return rv; |
|
236 } |
|
237 }; |
|
238 |
|
239 template<> |
|
240 struct ParamTraits<mozilla::WidgetTouchEvent> |
|
241 { |
|
242 typedef mozilla::WidgetTouchEvent paramType; |
|
243 |
|
244 static void Write(Message* aMsg, const paramType& aParam) |
|
245 { |
|
246 WriteParam(aMsg, static_cast<const mozilla::WidgetInputEvent&>(aParam)); |
|
247 // Sigh, Touch bites us again! We want to be able to do |
|
248 // WriteParam(aMsg, aParam.touches); |
|
249 const nsTArray< nsRefPtr<mozilla::dom::Touch> >& touches = aParam.touches; |
|
250 WriteParam(aMsg, touches.Length()); |
|
251 for (uint32_t i = 0; i < touches.Length(); ++i) { |
|
252 mozilla::dom::Touch* touch = touches[i]; |
|
253 WriteParam(aMsg, touch->mIdentifier); |
|
254 WriteParam(aMsg, touch->mRefPoint); |
|
255 WriteParam(aMsg, touch->mRadius); |
|
256 WriteParam(aMsg, touch->mRotationAngle); |
|
257 WriteParam(aMsg, touch->mForce); |
|
258 } |
|
259 } |
|
260 |
|
261 static bool Read(const Message* aMsg, void** aIter, paramType* aResult) |
|
262 { |
|
263 uint32_t numTouches; |
|
264 if (!ReadParam(aMsg, aIter, |
|
265 static_cast<mozilla::WidgetInputEvent*>(aResult)) || |
|
266 !ReadParam(aMsg, aIter, &numTouches)) { |
|
267 return false; |
|
268 } |
|
269 for (uint32_t i = 0; i < numTouches; ++i) { |
|
270 int32_t identifier; |
|
271 mozilla::LayoutDeviceIntPoint refPoint; |
|
272 nsIntPoint radius; |
|
273 float rotationAngle; |
|
274 float force; |
|
275 if (!ReadParam(aMsg, aIter, &identifier) || |
|
276 !ReadParam(aMsg, aIter, &refPoint) || |
|
277 !ReadParam(aMsg, aIter, &radius) || |
|
278 !ReadParam(aMsg, aIter, &rotationAngle) || |
|
279 !ReadParam(aMsg, aIter, &force)) { |
|
280 return false; |
|
281 } |
|
282 aResult->touches.AppendElement( |
|
283 new mozilla::dom::Touch( |
|
284 identifier, mozilla::LayoutDeviceIntPoint::ToUntyped(refPoint), |
|
285 radius, rotationAngle, force)); |
|
286 } |
|
287 return true; |
|
288 } |
|
289 }; |
|
290 |
|
291 template<> |
|
292 struct ParamTraits<mozilla::WidgetKeyboardEvent> |
|
293 { |
|
294 typedef mozilla::WidgetKeyboardEvent paramType; |
|
295 |
|
296 static void Write(Message* aMsg, const paramType& aParam) |
|
297 { |
|
298 WriteParam(aMsg, static_cast<mozilla::WidgetInputEvent>(aParam)); |
|
299 WriteParam(aMsg, static_cast<uint32_t>(aParam.mKeyNameIndex)); |
|
300 WriteParam(aMsg, aParam.mKeyValue); |
|
301 WriteParam(aMsg, aParam.keyCode); |
|
302 WriteParam(aMsg, aParam.charCode); |
|
303 WriteParam(aMsg, aParam.isChar); |
|
304 WriteParam(aMsg, aParam.mIsRepeat); |
|
305 WriteParam(aMsg, aParam.location); |
|
306 WriteParam(aMsg, aParam.mUniqueId); |
|
307 // An OS-specific native event might be attached in |mNativeKeyEvent|, but |
|
308 // that cannot be copied across process boundaries. |
|
309 } |
|
310 |
|
311 static bool Read(const Message* aMsg, void** aIter, paramType* aResult) |
|
312 { |
|
313 uint32_t keyNameIndex = 0; |
|
314 if (ReadParam(aMsg, aIter, |
|
315 static_cast<mozilla::WidgetInputEvent*>(aResult)) && |
|
316 ReadParam(aMsg, aIter, &keyNameIndex) && |
|
317 ReadParam(aMsg, aIter, &aResult->mKeyValue) && |
|
318 ReadParam(aMsg, aIter, &aResult->keyCode) && |
|
319 ReadParam(aMsg, aIter, &aResult->charCode) && |
|
320 ReadParam(aMsg, aIter, &aResult->isChar) && |
|
321 ReadParam(aMsg, aIter, &aResult->mIsRepeat) && |
|
322 ReadParam(aMsg, aIter, &aResult->location) && |
|
323 ReadParam(aMsg, aIter, &aResult->mUniqueId)) |
|
324 { |
|
325 aResult->mKeyNameIndex = static_cast<mozilla::KeyNameIndex>(keyNameIndex); |
|
326 aResult->mNativeKeyEvent = nullptr; |
|
327 return true; |
|
328 } |
|
329 return false; |
|
330 } |
|
331 }; |
|
332 |
|
333 template<> |
|
334 struct ParamTraits<mozilla::TextRangeStyle> |
|
335 { |
|
336 typedef mozilla::TextRangeStyle paramType; |
|
337 |
|
338 static void Write(Message* aMsg, const paramType& aParam) |
|
339 { |
|
340 WriteParam(aMsg, aParam.mDefinedStyles); |
|
341 WriteParam(aMsg, aParam.mLineStyle); |
|
342 WriteParam(aMsg, aParam.mIsBoldLine); |
|
343 WriteParam(aMsg, aParam.mForegroundColor); |
|
344 WriteParam(aMsg, aParam.mBackgroundColor); |
|
345 WriteParam(aMsg, aParam.mUnderlineColor); |
|
346 } |
|
347 |
|
348 static bool Read(const Message* aMsg, void** aIter, paramType* aResult) |
|
349 { |
|
350 return ReadParam(aMsg, aIter, &aResult->mDefinedStyles) && |
|
351 ReadParam(aMsg, aIter, &aResult->mLineStyle) && |
|
352 ReadParam(aMsg, aIter, &aResult->mIsBoldLine) && |
|
353 ReadParam(aMsg, aIter, &aResult->mForegroundColor) && |
|
354 ReadParam(aMsg, aIter, &aResult->mBackgroundColor) && |
|
355 ReadParam(aMsg, aIter, &aResult->mUnderlineColor); |
|
356 } |
|
357 }; |
|
358 |
|
359 template<> |
|
360 struct ParamTraits<mozilla::TextRange> |
|
361 { |
|
362 typedef mozilla::TextRange paramType; |
|
363 |
|
364 static void Write(Message* aMsg, const paramType& aParam) |
|
365 { |
|
366 WriteParam(aMsg, aParam.mStartOffset); |
|
367 WriteParam(aMsg, aParam.mEndOffset); |
|
368 WriteParam(aMsg, aParam.mRangeType); |
|
369 WriteParam(aMsg, aParam.mRangeStyle); |
|
370 } |
|
371 |
|
372 static bool Read(const Message* aMsg, void** aIter, paramType* aResult) |
|
373 { |
|
374 return ReadParam(aMsg, aIter, &aResult->mStartOffset) && |
|
375 ReadParam(aMsg, aIter, &aResult->mEndOffset) && |
|
376 ReadParam(aMsg, aIter, &aResult->mRangeType) && |
|
377 ReadParam(aMsg, aIter, &aResult->mRangeStyle); |
|
378 } |
|
379 }; |
|
380 |
|
381 template<> |
|
382 struct ParamTraits<mozilla::TextRangeArray> |
|
383 { |
|
384 typedef mozilla::TextRangeArray paramType; |
|
385 |
|
386 static void Write(Message* aMsg, const paramType& aParam) |
|
387 { |
|
388 WriteParam(aMsg, aParam.Length()); |
|
389 for (uint32_t index = 0; index < aParam.Length(); index++) { |
|
390 WriteParam(aMsg, aParam[index]); |
|
391 } |
|
392 } |
|
393 |
|
394 static bool Read(const Message* aMsg, void** aIter, paramType* aResult) |
|
395 { |
|
396 uint32_t length; |
|
397 if (!ReadParam(aMsg, aIter, &length)) { |
|
398 return false; |
|
399 } |
|
400 for (uint32_t index = 0; index < length; index++) { |
|
401 mozilla::TextRange textRange; |
|
402 if (!ReadParam(aMsg, aIter, &textRange)) { |
|
403 aResult->Clear(); |
|
404 return false; |
|
405 } |
|
406 aResult->AppendElement(textRange); |
|
407 } |
|
408 return true; |
|
409 } |
|
410 }; |
|
411 |
|
412 template<> |
|
413 struct ParamTraits<mozilla::WidgetTextEvent> |
|
414 { |
|
415 typedef mozilla::WidgetTextEvent paramType; |
|
416 |
|
417 static void Write(Message* aMsg, const paramType& aParam) |
|
418 { |
|
419 WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam)); |
|
420 WriteParam(aMsg, aParam.mSeqno); |
|
421 WriteParam(aMsg, aParam.theText); |
|
422 WriteParam(aMsg, aParam.isChar); |
|
423 bool hasRanges = !!aParam.mRanges; |
|
424 WriteParam(aMsg, hasRanges); |
|
425 if (hasRanges) { |
|
426 WriteParam(aMsg, *aParam.mRanges.get()); |
|
427 } |
|
428 } |
|
429 |
|
430 static bool Read(const Message* aMsg, void** aIter, paramType* aResult) |
|
431 { |
|
432 bool hasRanges; |
|
433 if (!ReadParam(aMsg, aIter, |
|
434 static_cast<mozilla::WidgetGUIEvent*>(aResult)) || |
|
435 !ReadParam(aMsg, aIter, &aResult->mSeqno) || |
|
436 !ReadParam(aMsg, aIter, &aResult->theText) || |
|
437 !ReadParam(aMsg, aIter, &aResult->isChar) || |
|
438 !ReadParam(aMsg, aIter, &hasRanges)) { |
|
439 return false; |
|
440 } |
|
441 |
|
442 if (!hasRanges) { |
|
443 aResult->mRanges = nullptr; |
|
444 } else { |
|
445 aResult->mRanges = new mozilla::TextRangeArray(); |
|
446 if (!aResult->mRanges) { |
|
447 return false; |
|
448 } |
|
449 if (!ReadParam(aMsg, aIter, aResult->mRanges.get())) { |
|
450 return false; |
|
451 } |
|
452 } |
|
453 return true; |
|
454 } |
|
455 }; |
|
456 |
|
457 template<> |
|
458 struct ParamTraits<mozilla::WidgetCompositionEvent> |
|
459 { |
|
460 typedef mozilla::WidgetCompositionEvent paramType; |
|
461 |
|
462 static void Write(Message* aMsg, const paramType& aParam) |
|
463 { |
|
464 WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam)); |
|
465 WriteParam(aMsg, aParam.mSeqno); |
|
466 WriteParam(aMsg, aParam.data); |
|
467 } |
|
468 |
|
469 static bool Read(const Message* aMsg, void** aIter, paramType* aResult) |
|
470 { |
|
471 return ReadParam(aMsg, aIter, |
|
472 static_cast<mozilla::WidgetGUIEvent*>(aResult)) && |
|
473 ReadParam(aMsg, aIter, &aResult->mSeqno) && |
|
474 ReadParam(aMsg, aIter, &aResult->data); |
|
475 } |
|
476 }; |
|
477 |
|
478 template<> |
|
479 struct ParamTraits<mozilla::WidgetQueryContentEvent> |
|
480 { |
|
481 typedef mozilla::WidgetQueryContentEvent paramType; |
|
482 |
|
483 static void Write(Message* aMsg, const paramType& aParam) |
|
484 { |
|
485 WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam)); |
|
486 WriteParam(aMsg, aParam.mSucceeded); |
|
487 WriteParam(aMsg, aParam.mUseNativeLineBreak); |
|
488 WriteParam(aMsg, aParam.mInput.mOffset); |
|
489 WriteParam(aMsg, aParam.mInput.mLength); |
|
490 WriteParam(aMsg, aParam.mReply.mOffset); |
|
491 WriteParam(aMsg, aParam.mReply.mString); |
|
492 WriteParam(aMsg, aParam.mReply.mRect); |
|
493 WriteParam(aMsg, aParam.mReply.mReversed); |
|
494 WriteParam(aMsg, aParam.mReply.mHasSelection); |
|
495 WriteParam(aMsg, aParam.mReply.mWidgetIsHit); |
|
496 } |
|
497 |
|
498 static bool Read(const Message* aMsg, void** aIter, paramType* aResult) |
|
499 { |
|
500 aResult->mWasAsync = true; |
|
501 return ReadParam(aMsg, aIter, |
|
502 static_cast<mozilla::WidgetGUIEvent*>(aResult)) && |
|
503 ReadParam(aMsg, aIter, &aResult->mSucceeded) && |
|
504 ReadParam(aMsg, aIter, &aResult->mUseNativeLineBreak) && |
|
505 ReadParam(aMsg, aIter, &aResult->mInput.mOffset) && |
|
506 ReadParam(aMsg, aIter, &aResult->mInput.mLength) && |
|
507 ReadParam(aMsg, aIter, &aResult->mReply.mOffset) && |
|
508 ReadParam(aMsg, aIter, &aResult->mReply.mString) && |
|
509 ReadParam(aMsg, aIter, &aResult->mReply.mRect) && |
|
510 ReadParam(aMsg, aIter, &aResult->mReply.mReversed) && |
|
511 ReadParam(aMsg, aIter, &aResult->mReply.mHasSelection) && |
|
512 ReadParam(aMsg, aIter, &aResult->mReply.mWidgetIsHit); |
|
513 } |
|
514 }; |
|
515 |
|
516 template<> |
|
517 struct ParamTraits<mozilla::WidgetSelectionEvent> |
|
518 { |
|
519 typedef mozilla::WidgetSelectionEvent paramType; |
|
520 |
|
521 static void Write(Message* aMsg, const paramType& aParam) |
|
522 { |
|
523 WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam)); |
|
524 WriteParam(aMsg, aParam.mSeqno); |
|
525 WriteParam(aMsg, aParam.mOffset); |
|
526 WriteParam(aMsg, aParam.mLength); |
|
527 WriteParam(aMsg, aParam.mReversed); |
|
528 WriteParam(aMsg, aParam.mExpandToClusterBoundary); |
|
529 WriteParam(aMsg, aParam.mSucceeded); |
|
530 WriteParam(aMsg, aParam.mUseNativeLineBreak); |
|
531 } |
|
532 |
|
533 static bool Read(const Message* aMsg, void** aIter, paramType* aResult) |
|
534 { |
|
535 return ReadParam(aMsg, aIter, |
|
536 static_cast<mozilla::WidgetGUIEvent*>(aResult)) && |
|
537 ReadParam(aMsg, aIter, &aResult->mSeqno) && |
|
538 ReadParam(aMsg, aIter, &aResult->mOffset) && |
|
539 ReadParam(aMsg, aIter, &aResult->mLength) && |
|
540 ReadParam(aMsg, aIter, &aResult->mReversed) && |
|
541 ReadParam(aMsg, aIter, &aResult->mExpandToClusterBoundary) && |
|
542 ReadParam(aMsg, aIter, &aResult->mSucceeded) && |
|
543 ReadParam(aMsg, aIter, &aResult->mUseNativeLineBreak); |
|
544 } |
|
545 }; |
|
546 |
|
547 template<> |
|
548 struct ParamTraits<nsIMEUpdatePreference> |
|
549 { |
|
550 typedef nsIMEUpdatePreference paramType; |
|
551 |
|
552 static void Write(Message* aMsg, const paramType& aParam) |
|
553 { |
|
554 WriteParam(aMsg, aParam.mWantUpdates); |
|
555 } |
|
556 |
|
557 static bool Read(const Message* aMsg, void** aIter, paramType* aResult) |
|
558 { |
|
559 return ReadParam(aMsg, aIter, &aResult->mWantUpdates); |
|
560 } |
|
561 }; |
|
562 |
|
563 template<> |
|
564 struct ParamTraits<mozilla::WidgetPluginEvent> |
|
565 { |
|
566 typedef mozilla::WidgetPluginEvent paramType; |
|
567 |
|
568 static void Write(Message* aMsg, const paramType& aParam) |
|
569 { |
|
570 WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam)); |
|
571 WriteParam(aMsg, aParam.retargetToFocusedDocument); |
|
572 } |
|
573 |
|
574 static bool Read(const Message* aMsg, void** aIter, paramType* aResult) |
|
575 { |
|
576 return ReadParam(aMsg, aIter, |
|
577 static_cast<mozilla::WidgetGUIEvent*>(aResult)) && |
|
578 ReadParam(aMsg, aIter, &aResult->retargetToFocusedDocument); |
|
579 } |
|
580 }; |
|
581 |
|
582 } // namespace IPC |
|
583 |
|
584 #endif // nsGUIEventIPC_h__ |
|
585 |