1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/nsGUIEventIPC.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,585 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsGUIEventIPC_h__ 1.10 +#define nsGUIEventIPC_h__ 1.11 + 1.12 +#include "ipc/IPCMessageUtils.h" 1.13 +#include "mozilla/GfxMessageUtils.h" 1.14 +#include "mozilla/dom/Touch.h" 1.15 +#include "mozilla/MiscEvents.h" 1.16 +#include "mozilla/MouseEvents.h" 1.17 +#include "mozilla/TextEvents.h" 1.18 +#include "mozilla/TouchEvents.h" 1.19 + 1.20 +namespace IPC 1.21 +{ 1.22 + 1.23 +template<> 1.24 +struct ParamTraits<mozilla::BaseEventFlags> 1.25 +{ 1.26 + typedef mozilla::BaseEventFlags paramType; 1.27 + 1.28 + static void Write(Message* aMsg, const paramType& aParam) 1.29 + { 1.30 + aMsg->WriteBytes(&aParam, sizeof(aParam)); 1.31 + } 1.32 + 1.33 + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) 1.34 + { 1.35 + const char* outp; 1.36 + if (!aMsg->ReadBytes(aIter, &outp, sizeof(*aResult))) { 1.37 + return false; 1.38 + } 1.39 + *aResult = *reinterpret_cast<const paramType*>(outp); 1.40 + return true; 1.41 + } 1.42 +}; 1.43 + 1.44 +template<> 1.45 +struct ParamTraits<mozilla::WidgetEvent> 1.46 +{ 1.47 + typedef mozilla::WidgetEvent paramType; 1.48 + 1.49 + static void Write(Message* aMsg, const paramType& aParam) 1.50 + { 1.51 + WriteParam(aMsg, (uint8_t) aParam.eventStructType); 1.52 + WriteParam(aMsg, aParam.message); 1.53 + WriteParam(aMsg, aParam.refPoint); 1.54 + WriteParam(aMsg, aParam.time); 1.55 + WriteParam(aMsg, aParam.mFlags); 1.56 + } 1.57 + 1.58 + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) 1.59 + { 1.60 + uint8_t eventStructType = 0; 1.61 + bool ret = ReadParam(aMsg, aIter, &eventStructType) && 1.62 + ReadParam(aMsg, aIter, &aResult->message) && 1.63 + ReadParam(aMsg, aIter, &aResult->refPoint) && 1.64 + ReadParam(aMsg, aIter, &aResult->time) && 1.65 + ReadParam(aMsg, aIter, &aResult->mFlags); 1.66 + aResult->eventStructType = static_cast<nsEventStructType>(eventStructType); 1.67 + return ret; 1.68 + } 1.69 +}; 1.70 + 1.71 +template<> 1.72 +struct ParamTraits<mozilla::WidgetGUIEvent> 1.73 +{ 1.74 + typedef mozilla::WidgetGUIEvent paramType; 1.75 + 1.76 + static void Write(Message* aMsg, const paramType& aParam) 1.77 + { 1.78 + WriteParam(aMsg, static_cast<mozilla::WidgetEvent>(aParam)); 1.79 + } 1.80 + 1.81 + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) 1.82 + { 1.83 + return ReadParam(aMsg, aIter, static_cast<mozilla::WidgetEvent*>(aResult)); 1.84 + } 1.85 +}; 1.86 + 1.87 +template<> 1.88 +struct ParamTraits<mozilla::WidgetInputEvent> 1.89 +{ 1.90 + typedef mozilla::WidgetInputEvent paramType; 1.91 + 1.92 + static void Write(Message* aMsg, const paramType& aParam) 1.93 + { 1.94 + WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam)); 1.95 + WriteParam(aMsg, aParam.modifiers); 1.96 + } 1.97 + 1.98 + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) 1.99 + { 1.100 + return ReadParam(aMsg, aIter, 1.101 + static_cast<mozilla::WidgetGUIEvent*>(aResult)) && 1.102 + ReadParam(aMsg, aIter, &aResult->modifiers); 1.103 + } 1.104 +}; 1.105 + 1.106 +template<> 1.107 +struct ParamTraits<mozilla::WidgetMouseEventBase> 1.108 +{ 1.109 + typedef mozilla::WidgetMouseEventBase paramType; 1.110 + 1.111 + static void Write(Message* aMsg, const paramType& aParam) 1.112 + { 1.113 + WriteParam(aMsg, static_cast<mozilla::WidgetInputEvent>(aParam)); 1.114 + WriteParam(aMsg, aParam.button); 1.115 + WriteParam(aMsg, aParam.buttons); 1.116 + WriteParam(aMsg, aParam.pressure); 1.117 + WriteParam(aMsg, aParam.inputSource); 1.118 + } 1.119 + 1.120 + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) 1.121 + { 1.122 + return ReadParam(aMsg, aIter, 1.123 + static_cast<mozilla::WidgetInputEvent*>(aResult)) && 1.124 + ReadParam(aMsg, aIter, &aResult->button) && 1.125 + ReadParam(aMsg, aIter, &aResult->buttons) && 1.126 + ReadParam(aMsg, aIter, &aResult->pressure) && 1.127 + ReadParam(aMsg, aIter, &aResult->inputSource); 1.128 + } 1.129 +}; 1.130 + 1.131 +template<> 1.132 +struct ParamTraits<mozilla::WidgetWheelEvent> 1.133 +{ 1.134 + typedef mozilla::WidgetWheelEvent paramType; 1.135 + 1.136 + static void Write(Message* aMsg, const paramType& aParam) 1.137 + { 1.138 + WriteParam(aMsg, static_cast<mozilla::WidgetMouseEventBase>(aParam)); 1.139 + WriteParam(aMsg, aParam.deltaX); 1.140 + WriteParam(aMsg, aParam.deltaY); 1.141 + WriteParam(aMsg, aParam.deltaZ); 1.142 + WriteParam(aMsg, aParam.deltaMode); 1.143 + WriteParam(aMsg, aParam.customizedByUserPrefs); 1.144 + WriteParam(aMsg, aParam.isMomentum); 1.145 + WriteParam(aMsg, aParam.isPixelOnlyDevice); 1.146 + WriteParam(aMsg, aParam.lineOrPageDeltaX); 1.147 + WriteParam(aMsg, aParam.lineOrPageDeltaY); 1.148 + WriteParam(aMsg, static_cast<int32_t>(aParam.scrollType)); 1.149 + WriteParam(aMsg, aParam.overflowDeltaX); 1.150 + WriteParam(aMsg, aParam.overflowDeltaY); 1.151 + } 1.152 + 1.153 + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) 1.154 + { 1.155 + int32_t scrollType = 0; 1.156 + bool rv = 1.157 + ReadParam(aMsg, aIter, 1.158 + static_cast<mozilla::WidgetMouseEventBase*>(aResult)) && 1.159 + ReadParam(aMsg, aIter, &aResult->deltaX) && 1.160 + ReadParam(aMsg, aIter, &aResult->deltaY) && 1.161 + ReadParam(aMsg, aIter, &aResult->deltaZ) && 1.162 + ReadParam(aMsg, aIter, &aResult->deltaMode) && 1.163 + ReadParam(aMsg, aIter, &aResult->customizedByUserPrefs) && 1.164 + ReadParam(aMsg, aIter, &aResult->isMomentum) && 1.165 + ReadParam(aMsg, aIter, &aResult->isPixelOnlyDevice) && 1.166 + ReadParam(aMsg, aIter, &aResult->lineOrPageDeltaX) && 1.167 + ReadParam(aMsg, aIter, &aResult->lineOrPageDeltaY) && 1.168 + ReadParam(aMsg, aIter, &scrollType) && 1.169 + ReadParam(aMsg, aIter, &aResult->overflowDeltaX) && 1.170 + ReadParam(aMsg, aIter, &aResult->overflowDeltaY); 1.171 + aResult->scrollType = 1.172 + static_cast<mozilla::WidgetWheelEvent::ScrollType>(scrollType); 1.173 + return rv; 1.174 + } 1.175 +}; 1.176 + 1.177 +template<> 1.178 +struct ParamTraits<mozilla::WidgetMouseEvent> 1.179 +{ 1.180 + typedef mozilla::WidgetMouseEvent paramType; 1.181 + 1.182 + static void Write(Message* aMsg, const paramType& aParam) 1.183 + { 1.184 + WriteParam(aMsg, static_cast<mozilla::WidgetMouseEventBase>(aParam)); 1.185 + WriteParam(aMsg, aParam.ignoreRootScrollFrame); 1.186 + WriteParam(aMsg, (uint8_t) aParam.reason); 1.187 + WriteParam(aMsg, (uint8_t) aParam.context); 1.188 + WriteParam(aMsg, (uint8_t) aParam.exit); 1.189 + WriteParam(aMsg, aParam.clickCount); 1.190 + } 1.191 + 1.192 + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) 1.193 + { 1.194 + bool rv; 1.195 + uint8_t reason = 0, context = 0, exit = 0; 1.196 + rv = ReadParam(aMsg, aIter, 1.197 + static_cast<mozilla::WidgetMouseEventBase*>(aResult)) && 1.198 + ReadParam(aMsg, aIter, &aResult->ignoreRootScrollFrame) && 1.199 + ReadParam(aMsg, aIter, &reason) && 1.200 + ReadParam(aMsg, aIter, &context) && 1.201 + ReadParam(aMsg, aIter, &exit) && 1.202 + ReadParam(aMsg, aIter, &aResult->clickCount); 1.203 + aResult->reason = 1.204 + static_cast<mozilla::WidgetMouseEvent::reasonType>(reason); 1.205 + aResult->context = 1.206 + static_cast<mozilla::WidgetMouseEvent::contextType>(context); 1.207 + aResult->exit = static_cast<mozilla::WidgetMouseEvent::exitType>(exit); 1.208 + return rv; 1.209 + } 1.210 +}; 1.211 + 1.212 +template<> 1.213 +struct ParamTraits<mozilla::WidgetPointerEvent> 1.214 +{ 1.215 + typedef mozilla::WidgetPointerEvent paramType; 1.216 + 1.217 + static void Write(Message* aMsg, const paramType& aParam) 1.218 + { 1.219 + WriteParam(aMsg, static_cast<mozilla::WidgetMouseEvent>(aParam)); 1.220 + WriteParam(aMsg, aParam.pointerId); 1.221 + WriteParam(aMsg, aParam.width); 1.222 + WriteParam(aMsg, aParam.height); 1.223 + WriteParam(aMsg, aParam.tiltX); 1.224 + WriteParam(aMsg, aParam.tiltY); 1.225 + WriteParam(aMsg, aParam.isPrimary); 1.226 + } 1.227 + 1.228 + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) 1.229 + { 1.230 + bool rv = 1.231 + ReadParam(aMsg, aIter, static_cast<mozilla::WidgetMouseEvent*>(aResult)) && 1.232 + ReadParam(aMsg, aIter, &aResult->pointerId) && 1.233 + ReadParam(aMsg, aIter, &aResult->width) && 1.234 + ReadParam(aMsg, aIter, &aResult->height) && 1.235 + ReadParam(aMsg, aIter, &aResult->tiltX) && 1.236 + ReadParam(aMsg, aIter, &aResult->tiltY) && 1.237 + ReadParam(aMsg, aIter, &aResult->isPrimary); 1.238 + return rv; 1.239 + } 1.240 +}; 1.241 + 1.242 +template<> 1.243 +struct ParamTraits<mozilla::WidgetTouchEvent> 1.244 +{ 1.245 + typedef mozilla::WidgetTouchEvent paramType; 1.246 + 1.247 + static void Write(Message* aMsg, const paramType& aParam) 1.248 + { 1.249 + WriteParam(aMsg, static_cast<const mozilla::WidgetInputEvent&>(aParam)); 1.250 + // Sigh, Touch bites us again! We want to be able to do 1.251 + // WriteParam(aMsg, aParam.touches); 1.252 + const nsTArray< nsRefPtr<mozilla::dom::Touch> >& touches = aParam.touches; 1.253 + WriteParam(aMsg, touches.Length()); 1.254 + for (uint32_t i = 0; i < touches.Length(); ++i) { 1.255 + mozilla::dom::Touch* touch = touches[i]; 1.256 + WriteParam(aMsg, touch->mIdentifier); 1.257 + WriteParam(aMsg, touch->mRefPoint); 1.258 + WriteParam(aMsg, touch->mRadius); 1.259 + WriteParam(aMsg, touch->mRotationAngle); 1.260 + WriteParam(aMsg, touch->mForce); 1.261 + } 1.262 + } 1.263 + 1.264 + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) 1.265 + { 1.266 + uint32_t numTouches; 1.267 + if (!ReadParam(aMsg, aIter, 1.268 + static_cast<mozilla::WidgetInputEvent*>(aResult)) || 1.269 + !ReadParam(aMsg, aIter, &numTouches)) { 1.270 + return false; 1.271 + } 1.272 + for (uint32_t i = 0; i < numTouches; ++i) { 1.273 + int32_t identifier; 1.274 + mozilla::LayoutDeviceIntPoint refPoint; 1.275 + nsIntPoint radius; 1.276 + float rotationAngle; 1.277 + float force; 1.278 + if (!ReadParam(aMsg, aIter, &identifier) || 1.279 + !ReadParam(aMsg, aIter, &refPoint) || 1.280 + !ReadParam(aMsg, aIter, &radius) || 1.281 + !ReadParam(aMsg, aIter, &rotationAngle) || 1.282 + !ReadParam(aMsg, aIter, &force)) { 1.283 + return false; 1.284 + } 1.285 + aResult->touches.AppendElement( 1.286 + new mozilla::dom::Touch( 1.287 + identifier, mozilla::LayoutDeviceIntPoint::ToUntyped(refPoint), 1.288 + radius, rotationAngle, force)); 1.289 + } 1.290 + return true; 1.291 + } 1.292 +}; 1.293 + 1.294 +template<> 1.295 +struct ParamTraits<mozilla::WidgetKeyboardEvent> 1.296 +{ 1.297 + typedef mozilla::WidgetKeyboardEvent paramType; 1.298 + 1.299 + static void Write(Message* aMsg, const paramType& aParam) 1.300 + { 1.301 + WriteParam(aMsg, static_cast<mozilla::WidgetInputEvent>(aParam)); 1.302 + WriteParam(aMsg, static_cast<uint32_t>(aParam.mKeyNameIndex)); 1.303 + WriteParam(aMsg, aParam.mKeyValue); 1.304 + WriteParam(aMsg, aParam.keyCode); 1.305 + WriteParam(aMsg, aParam.charCode); 1.306 + WriteParam(aMsg, aParam.isChar); 1.307 + WriteParam(aMsg, aParam.mIsRepeat); 1.308 + WriteParam(aMsg, aParam.location); 1.309 + WriteParam(aMsg, aParam.mUniqueId); 1.310 + // An OS-specific native event might be attached in |mNativeKeyEvent|, but 1.311 + // that cannot be copied across process boundaries. 1.312 + } 1.313 + 1.314 + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) 1.315 + { 1.316 + uint32_t keyNameIndex = 0; 1.317 + if (ReadParam(aMsg, aIter, 1.318 + static_cast<mozilla::WidgetInputEvent*>(aResult)) && 1.319 + ReadParam(aMsg, aIter, &keyNameIndex) && 1.320 + ReadParam(aMsg, aIter, &aResult->mKeyValue) && 1.321 + ReadParam(aMsg, aIter, &aResult->keyCode) && 1.322 + ReadParam(aMsg, aIter, &aResult->charCode) && 1.323 + ReadParam(aMsg, aIter, &aResult->isChar) && 1.324 + ReadParam(aMsg, aIter, &aResult->mIsRepeat) && 1.325 + ReadParam(aMsg, aIter, &aResult->location) && 1.326 + ReadParam(aMsg, aIter, &aResult->mUniqueId)) 1.327 + { 1.328 + aResult->mKeyNameIndex = static_cast<mozilla::KeyNameIndex>(keyNameIndex); 1.329 + aResult->mNativeKeyEvent = nullptr; 1.330 + return true; 1.331 + } 1.332 + return false; 1.333 + } 1.334 +}; 1.335 + 1.336 +template<> 1.337 +struct ParamTraits<mozilla::TextRangeStyle> 1.338 +{ 1.339 + typedef mozilla::TextRangeStyle paramType; 1.340 + 1.341 + static void Write(Message* aMsg, const paramType& aParam) 1.342 + { 1.343 + WriteParam(aMsg, aParam.mDefinedStyles); 1.344 + WriteParam(aMsg, aParam.mLineStyle); 1.345 + WriteParam(aMsg, aParam.mIsBoldLine); 1.346 + WriteParam(aMsg, aParam.mForegroundColor); 1.347 + WriteParam(aMsg, aParam.mBackgroundColor); 1.348 + WriteParam(aMsg, aParam.mUnderlineColor); 1.349 + } 1.350 + 1.351 + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) 1.352 + { 1.353 + return ReadParam(aMsg, aIter, &aResult->mDefinedStyles) && 1.354 + ReadParam(aMsg, aIter, &aResult->mLineStyle) && 1.355 + ReadParam(aMsg, aIter, &aResult->mIsBoldLine) && 1.356 + ReadParam(aMsg, aIter, &aResult->mForegroundColor) && 1.357 + ReadParam(aMsg, aIter, &aResult->mBackgroundColor) && 1.358 + ReadParam(aMsg, aIter, &aResult->mUnderlineColor); 1.359 + } 1.360 +}; 1.361 + 1.362 +template<> 1.363 +struct ParamTraits<mozilla::TextRange> 1.364 +{ 1.365 + typedef mozilla::TextRange paramType; 1.366 + 1.367 + static void Write(Message* aMsg, const paramType& aParam) 1.368 + { 1.369 + WriteParam(aMsg, aParam.mStartOffset); 1.370 + WriteParam(aMsg, aParam.mEndOffset); 1.371 + WriteParam(aMsg, aParam.mRangeType); 1.372 + WriteParam(aMsg, aParam.mRangeStyle); 1.373 + } 1.374 + 1.375 + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) 1.376 + { 1.377 + return ReadParam(aMsg, aIter, &aResult->mStartOffset) && 1.378 + ReadParam(aMsg, aIter, &aResult->mEndOffset) && 1.379 + ReadParam(aMsg, aIter, &aResult->mRangeType) && 1.380 + ReadParam(aMsg, aIter, &aResult->mRangeStyle); 1.381 + } 1.382 +}; 1.383 + 1.384 +template<> 1.385 +struct ParamTraits<mozilla::TextRangeArray> 1.386 +{ 1.387 + typedef mozilla::TextRangeArray paramType; 1.388 + 1.389 + static void Write(Message* aMsg, const paramType& aParam) 1.390 + { 1.391 + WriteParam(aMsg, aParam.Length()); 1.392 + for (uint32_t index = 0; index < aParam.Length(); index++) { 1.393 + WriteParam(aMsg, aParam[index]); 1.394 + } 1.395 + } 1.396 + 1.397 + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) 1.398 + { 1.399 + uint32_t length; 1.400 + if (!ReadParam(aMsg, aIter, &length)) { 1.401 + return false; 1.402 + } 1.403 + for (uint32_t index = 0; index < length; index++) { 1.404 + mozilla::TextRange textRange; 1.405 + if (!ReadParam(aMsg, aIter, &textRange)) { 1.406 + aResult->Clear(); 1.407 + return false; 1.408 + } 1.409 + aResult->AppendElement(textRange); 1.410 + } 1.411 + return true; 1.412 + } 1.413 +}; 1.414 + 1.415 +template<> 1.416 +struct ParamTraits<mozilla::WidgetTextEvent> 1.417 +{ 1.418 + typedef mozilla::WidgetTextEvent paramType; 1.419 + 1.420 + static void Write(Message* aMsg, const paramType& aParam) 1.421 + { 1.422 + WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam)); 1.423 + WriteParam(aMsg, aParam.mSeqno); 1.424 + WriteParam(aMsg, aParam.theText); 1.425 + WriteParam(aMsg, aParam.isChar); 1.426 + bool hasRanges = !!aParam.mRanges; 1.427 + WriteParam(aMsg, hasRanges); 1.428 + if (hasRanges) { 1.429 + WriteParam(aMsg, *aParam.mRanges.get()); 1.430 + } 1.431 + } 1.432 + 1.433 + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) 1.434 + { 1.435 + bool hasRanges; 1.436 + if (!ReadParam(aMsg, aIter, 1.437 + static_cast<mozilla::WidgetGUIEvent*>(aResult)) || 1.438 + !ReadParam(aMsg, aIter, &aResult->mSeqno) || 1.439 + !ReadParam(aMsg, aIter, &aResult->theText) || 1.440 + !ReadParam(aMsg, aIter, &aResult->isChar) || 1.441 + !ReadParam(aMsg, aIter, &hasRanges)) { 1.442 + return false; 1.443 + } 1.444 + 1.445 + if (!hasRanges) { 1.446 + aResult->mRanges = nullptr; 1.447 + } else { 1.448 + aResult->mRanges = new mozilla::TextRangeArray(); 1.449 + if (!aResult->mRanges) { 1.450 + return false; 1.451 + } 1.452 + if (!ReadParam(aMsg, aIter, aResult->mRanges.get())) { 1.453 + return false; 1.454 + } 1.455 + } 1.456 + return true; 1.457 + } 1.458 +}; 1.459 + 1.460 +template<> 1.461 +struct ParamTraits<mozilla::WidgetCompositionEvent> 1.462 +{ 1.463 + typedef mozilla::WidgetCompositionEvent paramType; 1.464 + 1.465 + static void Write(Message* aMsg, const paramType& aParam) 1.466 + { 1.467 + WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam)); 1.468 + WriteParam(aMsg, aParam.mSeqno); 1.469 + WriteParam(aMsg, aParam.data); 1.470 + } 1.471 + 1.472 + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) 1.473 + { 1.474 + return ReadParam(aMsg, aIter, 1.475 + static_cast<mozilla::WidgetGUIEvent*>(aResult)) && 1.476 + ReadParam(aMsg, aIter, &aResult->mSeqno) && 1.477 + ReadParam(aMsg, aIter, &aResult->data); 1.478 + } 1.479 +}; 1.480 + 1.481 +template<> 1.482 +struct ParamTraits<mozilla::WidgetQueryContentEvent> 1.483 +{ 1.484 + typedef mozilla::WidgetQueryContentEvent paramType; 1.485 + 1.486 + static void Write(Message* aMsg, const paramType& aParam) 1.487 + { 1.488 + WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam)); 1.489 + WriteParam(aMsg, aParam.mSucceeded); 1.490 + WriteParam(aMsg, aParam.mUseNativeLineBreak); 1.491 + WriteParam(aMsg, aParam.mInput.mOffset); 1.492 + WriteParam(aMsg, aParam.mInput.mLength); 1.493 + WriteParam(aMsg, aParam.mReply.mOffset); 1.494 + WriteParam(aMsg, aParam.mReply.mString); 1.495 + WriteParam(aMsg, aParam.mReply.mRect); 1.496 + WriteParam(aMsg, aParam.mReply.mReversed); 1.497 + WriteParam(aMsg, aParam.mReply.mHasSelection); 1.498 + WriteParam(aMsg, aParam.mReply.mWidgetIsHit); 1.499 + } 1.500 + 1.501 + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) 1.502 + { 1.503 + aResult->mWasAsync = true; 1.504 + return ReadParam(aMsg, aIter, 1.505 + static_cast<mozilla::WidgetGUIEvent*>(aResult)) && 1.506 + ReadParam(aMsg, aIter, &aResult->mSucceeded) && 1.507 + ReadParam(aMsg, aIter, &aResult->mUseNativeLineBreak) && 1.508 + ReadParam(aMsg, aIter, &aResult->mInput.mOffset) && 1.509 + ReadParam(aMsg, aIter, &aResult->mInput.mLength) && 1.510 + ReadParam(aMsg, aIter, &aResult->mReply.mOffset) && 1.511 + ReadParam(aMsg, aIter, &aResult->mReply.mString) && 1.512 + ReadParam(aMsg, aIter, &aResult->mReply.mRect) && 1.513 + ReadParam(aMsg, aIter, &aResult->mReply.mReversed) && 1.514 + ReadParam(aMsg, aIter, &aResult->mReply.mHasSelection) && 1.515 + ReadParam(aMsg, aIter, &aResult->mReply.mWidgetIsHit); 1.516 + } 1.517 +}; 1.518 + 1.519 +template<> 1.520 +struct ParamTraits<mozilla::WidgetSelectionEvent> 1.521 +{ 1.522 + typedef mozilla::WidgetSelectionEvent paramType; 1.523 + 1.524 + static void Write(Message* aMsg, const paramType& aParam) 1.525 + { 1.526 + WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam)); 1.527 + WriteParam(aMsg, aParam.mSeqno); 1.528 + WriteParam(aMsg, aParam.mOffset); 1.529 + WriteParam(aMsg, aParam.mLength); 1.530 + WriteParam(aMsg, aParam.mReversed); 1.531 + WriteParam(aMsg, aParam.mExpandToClusterBoundary); 1.532 + WriteParam(aMsg, aParam.mSucceeded); 1.533 + WriteParam(aMsg, aParam.mUseNativeLineBreak); 1.534 + } 1.535 + 1.536 + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) 1.537 + { 1.538 + return ReadParam(aMsg, aIter, 1.539 + static_cast<mozilla::WidgetGUIEvent*>(aResult)) && 1.540 + ReadParam(aMsg, aIter, &aResult->mSeqno) && 1.541 + ReadParam(aMsg, aIter, &aResult->mOffset) && 1.542 + ReadParam(aMsg, aIter, &aResult->mLength) && 1.543 + ReadParam(aMsg, aIter, &aResult->mReversed) && 1.544 + ReadParam(aMsg, aIter, &aResult->mExpandToClusterBoundary) && 1.545 + ReadParam(aMsg, aIter, &aResult->mSucceeded) && 1.546 + ReadParam(aMsg, aIter, &aResult->mUseNativeLineBreak); 1.547 + } 1.548 +}; 1.549 + 1.550 +template<> 1.551 +struct ParamTraits<nsIMEUpdatePreference> 1.552 +{ 1.553 + typedef nsIMEUpdatePreference paramType; 1.554 + 1.555 + static void Write(Message* aMsg, const paramType& aParam) 1.556 + { 1.557 + WriteParam(aMsg, aParam.mWantUpdates); 1.558 + } 1.559 + 1.560 + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) 1.561 + { 1.562 + return ReadParam(aMsg, aIter, &aResult->mWantUpdates); 1.563 + } 1.564 +}; 1.565 + 1.566 +template<> 1.567 +struct ParamTraits<mozilla::WidgetPluginEvent> 1.568 +{ 1.569 + typedef mozilla::WidgetPluginEvent paramType; 1.570 + 1.571 + static void Write(Message* aMsg, const paramType& aParam) 1.572 + { 1.573 + WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam)); 1.574 + WriteParam(aMsg, aParam.retargetToFocusedDocument); 1.575 + } 1.576 + 1.577 + static bool Read(const Message* aMsg, void** aIter, paramType* aResult) 1.578 + { 1.579 + return ReadParam(aMsg, aIter, 1.580 + static_cast<mozilla::WidgetGUIEvent*>(aResult)) && 1.581 + ReadParam(aMsg, aIter, &aResult->retargetToFocusedDocument); 1.582 + } 1.583 +}; 1.584 + 1.585 +} // namespace IPC 1.586 + 1.587 +#endif // nsGUIEventIPC_h__ 1.588 +