LCOV - app.info - content/events/src/nsDOMScrollAreaEvent.cpp

LCOV - code coverage report
| Current view: | directory - content/events/src - nsDOMScrollAreaEvent.cpp (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 53 | 0 | 0.0 %
| Date: | 2012-04-21 | Functions: | 14 | 0 | 0.0 %

           1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
           2                 : /* ***** BEGIN LICENSE BLOCK *****
           3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
           4                 :  *
           5                 :  * The contents of this file are subject to the Mozilla Public License Version
           6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
           7                 :  * the License. You may obtain a copy of the License at
           8                 :  * http://www.mozilla.org/MPL/
           9                 :  *
          10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
          11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
          12                 :  * for the specific language governing rights and limitations under the
          13                 :  * License.
          14                 :  *
          15                 :  * The Original Code is Mozilla code.
          16                 :  *
          17                 :  * The Initial Developer of the Original Code is Mozilla Foundation
          18                 :  * Portions created by the Initial Developer are Copyright (C) 2009
          19                 :  * the Initial Developer. All Rights Reserved.
          20                 :  *
          21                 :  * Contributor(s):
          22                 :  *   Roy Frostig <froystig@cs.stanford.edu>
          23                 :  *
          24                 :  * Alternatively, the contents of this file may be used under the terms of
          25                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
          26                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
          27                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
          28                 :  * of those above. If you wish to allow use of your version of this file only
          29                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
          30                 :  * use your version of this file under the terms of the MPL, indicate your
          31                 :  * decision by deleting the provisions above and replace them with the notice
          32                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
          33                 :  * the provisions above, a recipient may use your version of this file under
          34                 :  * the terms of any one of the MPL, the GPL or the LGPL.
          35                 :  *
          36                 :  * ***** END LICENSE BLOCK ***** */
          37                 :
          38                 : #include "base/basictypes.h"
          39                 : #include "IPC/IPCMessageUtils.h"
          40                 :
          41                 : #include "nsDOMScrollAreaEvent.h"
          42                 : #include "nsGUIEvent.h"
          43                 : #include "nsClientRect.h"
          44                 : #include "nsDOMClassInfoID.h"
          45                 : #include "nsIClassInfo.h"
          46                 : #include "nsIXPCScriptable.h"
          47                 :
          48               0 : nsDOMScrollAreaEvent::nsDOMScrollAreaEvent(nsPresContext *aPresContext,
          49                 :                                            nsScrollAreaEvent *aEvent)
          50               0 :   : nsDOMUIEvent(aPresContext, aEvent)
          51                 : {
          52               0 :   mClientArea.SetLayoutRect(aEvent ? aEvent->mArea : nsRect());
          53               0 : }
          54                 :
          55               0 : nsDOMScrollAreaEvent::~nsDOMScrollAreaEvent()
          56                 : {
          57               0 :   if (mEventIsInternal && mEvent) {
          58               0 :     if (mEvent->eventStructType == NS_SCROLLAREA_EVENT) {
          59               0 :       delete static_cast<nsScrollAreaEvent *>(mEvent);
          60               0 :       mEvent = nsnull;
          61                 :     }
          62                 :   }
          63               0 : }
          64                 :
          65               0 : NS_IMPL_ADDREF_INHERITED(nsDOMScrollAreaEvent, nsDOMUIEvent)
          66               0 : NS_IMPL_RELEASE_INHERITED(nsDOMScrollAreaEvent, nsDOMUIEvent)
          67                 :
          68                 : DOMCI_DATA(ScrollAreaEvent, nsDOMScrollAreaEvent)
          69                 :
          70               0 : NS_INTERFACE_MAP_BEGIN(nsDOMScrollAreaEvent)
          71               0 :   NS_INTERFACE_MAP_ENTRY(nsIDOMScrollAreaEvent)
          72               0 :   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(ScrollAreaEvent)
          73               0 : NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
          74                 :
          75                 :
          76                 : NS_IMETHODIMP
          77               0 : nsDOMScrollAreaEvent::GetX(float *aX)
          78                 : {
          79               0 :   return mClientArea.GetLeft(aX);
          80                 : }
          81                 :
          82                 : NS_IMETHODIMP
          83               0 : nsDOMScrollAreaEvent::GetY(float *aY)
          84                 : {
          85               0 :   return mClientArea.GetTop(aY);
          86                 : }
          87                 :
          88                 : NS_IMETHODIMP
          89               0 : nsDOMScrollAreaEvent::GetWidth(float *aWidth)
          90                 : {
          91               0 :   return mClientArea.GetWidth(aWidth);
          92                 : }
          93                 :
          94                 : NS_IMETHODIMP
          95               0 : nsDOMScrollAreaEvent::GetHeight(float *aHeight)
          96                 : {
          97               0 :   return mClientArea.GetHeight(aHeight);
          98                 : }
          99                 :
         100                 : NS_IMETHODIMP
         101               0 : nsDOMScrollAreaEvent::InitScrollAreaEvent(const nsAString &aEventType,
         102                 :                                           bool aCanBubble,
         103                 :                                           bool aCancelable,
         104                 :                                           nsIDOMWindow *aView,
         105                 :                                           PRInt32 aDetail,
         106                 :                                           float aX, float aY,
         107                 :                                           float aWidth, float aHeight)
         108                 : {
         109               0 :   nsresult rv = nsDOMUIEvent::InitUIEvent(aEventType, aCanBubble, aCancelable, aView, aDetail);
         110               0 :   NS_ENSURE_SUCCESS(rv, rv);
         111                 :
         112               0 :   mClientArea.SetRect(aX, aY, aWidth, aHeight);
         113                 :
         114               0 :   return NS_OK;
         115                 : }
         116                 :
         117                 : void
         118               0 : nsDOMScrollAreaEvent::Serialize(IPC::Message* aMsg,
         119                 :                                 bool aSerializeInterfaceType)
         120                 : {
         121               0 :   if (aSerializeInterfaceType) {
         122               0 :     IPC::WriteParam(aMsg, NS_LITERAL_STRING("scrollareaevent"));
         123                 :   }
         124                 :
         125               0 :   nsDOMEvent::Serialize(aMsg, false);
         126                 :
         127                 :   float val;
         128               0 :   mClientArea.GetLeft(&val);
         129               0 :   IPC::WriteParam(aMsg, val);
         130               0 :   mClientArea.GetTop(&val);
         131               0 :   IPC::WriteParam(aMsg, val);
         132               0 :   mClientArea.GetWidth(&val);
         133               0 :   IPC::WriteParam(aMsg, val);
         134               0 :   mClientArea.GetHeight(&val);
         135               0 :   IPC::WriteParam(aMsg, val);
         136               0 : }
         137                 :
         138                 : bool
         139               0 : nsDOMScrollAreaEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
         140                 : {
         141               0 :   NS_ENSURE_TRUE(nsDOMEvent::Deserialize(aMsg, aIter), false);
         142                 :
         143                 :   float x, y, width, height;
         144               0 :   NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &x), false);
         145               0 :   NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &y), false);
         146               0 :   NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &width), false);
         147               0 :   NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &height), false);
         148               0 :   mClientArea.SetRect(x, y, width, height);
         149                 :
         150               0 :   return true;
         151                 : }
         152                 :
         153                 : nsresult
         154               0 : NS_NewDOMScrollAreaEvent(nsIDOMEvent **aInstancePtrResult,
         155                 :                          nsPresContext *aPresContext,
         156                 :                          nsScrollAreaEvent *aEvent)
         157                 : {
         158               0 :   nsDOMScrollAreaEvent *ev = new nsDOMScrollAreaEvent(aPresContext, aEvent);
         159               0 :   return CallQueryInterface(ev, aInstancePtrResult);
         160                 : }

Generated by: LCOV version 1.7