Bug 542047 - Forward nsDOMScrollAreaEvent. r=smaug
authorJoe Drew <joe@drew.ca>
Wed, 27 Jan 2010 15:55:57 -0500
changeset 46627 b4bd87233c78f019fab5adef916313f8b61a1781
parent 46626 15fc08aacb4e7f5339447fb672f18f6740de0907
child 46628 03d47e41b1a5a18099548d598574bd5e99b928db
push idunknown
push userunknown
push dateunknown
reviewerssmaug
bugs542047
milestone1.9.3a1pre
Bug 542047 - Forward nsDOMScrollAreaEvent. r=smaug
content/events/src/nsDOMScrollAreaEvent.cpp
content/events/src/nsDOMScrollAreaEvent.h
--- a/content/events/src/nsDOMScrollAreaEvent.cpp
+++ b/content/events/src/nsDOMScrollAreaEvent.cpp
@@ -30,16 +30,21 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
+#ifdef MOZ_IPC
+#include "base/basictypes.h"
+#include "IPC/IPCMessageUtils.h"
+#endif
+
 #include "nsDOMScrollAreaEvent.h"
 #include "nsGUIEvent.h"
 #include "nsClientRect.h"
 
 nsDOMScrollAreaEvent::nsDOMScrollAreaEvent(nsPresContext *aPresContext,
                                            nsScrollAreaEvent *aEvent)
   : nsDOMUIEvent(aPresContext, aEvent)
 {
@@ -101,16 +106,54 @@ nsDOMScrollAreaEvent::InitScrollAreaEven
   nsresult rv = nsDOMUIEvent::InitUIEvent(aEventType, aCanBubble, aCancelable, aView, aDetail);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mClientArea.SetRect(aX, aY, aWidth, aHeight);
 
   return NS_OK;
 }
 
+#ifdef MOZ_IPC
+void
+nsDOMScrollAreaEvent::Serialize(IPC::Message* aMsg,
+                                PRBool aSerializeInterfaceType)
+{
+  if (aSerializeInterfaceType) {
+    IPC::WriteParam(aMsg, NS_LITERAL_STRING("scrollareaevent"));
+  }
+
+  nsDOMEvent::Serialize(aMsg, PR_FALSE);
+
+  float val;
+  mClientArea.GetLeft(&val);
+  IPC::WriteParam(aMsg, val);
+  mClientArea.GetTop(&val);
+  IPC::WriteParam(aMsg, val);
+  mClientArea.GetWidth(&val);
+  IPC::WriteParam(aMsg, val);
+  mClientArea.GetHeight(&val);
+  IPC::WriteParam(aMsg, val);
+}
+
+PRBool
+nsDOMScrollAreaEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
+{
+  NS_ENSURE_TRUE(nsDOMEvent::Deserialize(aMsg, aIter), PR_FALSE);
+
+  float x, y, width, height;
+  NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &x), PR_FALSE);
+  NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &y), PR_FALSE);
+  NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &width), PR_FALSE);
+  NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &height), PR_FALSE);
+  mClientArea.SetRect(x, y, width, height);
+
+  return PR_TRUE;
+}
+#endif
+
 nsresult
 NS_NewDOMScrollAreaEvent(nsIDOMEvent **aInstancePtrResult,
                          nsPresContext *aPresContext,
                          nsScrollAreaEvent *aEvent)
 {
   nsDOMScrollAreaEvent *ev = new nsDOMScrollAreaEvent(aPresContext, aEvent);
 
   if (!ev) {
--- a/content/events/src/nsDOMScrollAreaEvent.h
+++ b/content/events/src/nsDOMScrollAreaEvent.h
@@ -53,13 +53,18 @@ public:
   virtual ~nsDOMScrollAreaEvent();
 
   NS_DECL_ISUPPORTS_INHERITED
 
   NS_DECL_NSIDOMSCROLLAREAEVENT
 
   NS_FORWARD_TO_NSDOMUIEVENT
 
+#ifdef MOZ_IPC
+    virtual void Serialize(IPC::Message* aMsg, PRBool aSerializeInterfaceType);
+    virtual PRBool Deserialize(const IPC::Message* aMsg, void** aIter);
+#endif
+
 protected:
   nsClientRect mClientArea;
 };
 
 #endif // nsDOMScrollAreaEvent_h__