LCOV - code coverage report
Current view: directory - content/events/src - nsDOMMozTouchEvent.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 33 0 0.0 %
Date: 2012-06-02 Functions: 9 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.org code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * the Mozilla Foundation.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 2010
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *   Felipe Gomes <felipc@gmail.com>
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      27                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : #include "nsDOMMozTouchEvent.h"
      40                 : #include "nsGUIEvent.h"
      41                 : #include "nsContentUtils.h"
      42                 : 
      43               0 : nsDOMMozTouchEvent::nsDOMMozTouchEvent(nsPresContext* aPresContext, nsMozTouchEvent* aEvent)
      44               0 :   : nsDOMMouseEvent(aPresContext, aEvent ? aEvent : new nsMozTouchEvent(false, 0, nsnull, 0))
      45                 : {
      46               0 :   NS_ASSERTION(mEvent->eventStructType == NS_MOZTOUCH_EVENT, "event type mismatch NS_MOZTOUCH_EVENT");
      47                 : 
      48               0 :   if (aEvent) {
      49               0 :     mEventIsInternal = false;
      50                 :   } else {
      51               0 :     mEventIsInternal = true;
      52               0 :     mEvent->time = PR_Now();
      53               0 :     mEvent->refPoint.x = mEvent->refPoint.y = 0;
      54                 :   }
      55               0 : }
      56                 : 
      57               0 : nsDOMMozTouchEvent::~nsDOMMozTouchEvent()
      58                 : {
      59               0 :   if (mEventIsInternal) {
      60               0 :     delete static_cast<nsMozTouchEvent*>(mEvent);
      61               0 :     mEvent = nsnull;
      62                 :   }
      63               0 : }
      64                 : 
      65               0 : NS_IMPL_ADDREF_INHERITED(nsDOMMozTouchEvent, nsDOMMouseEvent)
      66               0 : NS_IMPL_RELEASE_INHERITED(nsDOMMozTouchEvent, nsDOMMouseEvent)
      67                 : 
      68                 : DOMCI_DATA(MozTouchEvent, nsDOMMozTouchEvent)
      69                 : 
      70               0 : NS_INTERFACE_MAP_BEGIN(nsDOMMozTouchEvent)
      71               0 :   NS_INTERFACE_MAP_ENTRY(nsIDOMMozTouchEvent)
      72               0 :   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozTouchEvent)
      73               0 : NS_INTERFACE_MAP_END_INHERITING(nsDOMMouseEvent)
      74                 : 
      75                 : /* readonly attribute unsigned long steramId; */
      76                 : NS_IMETHODIMP
      77               0 : nsDOMMozTouchEvent::GetStreamId(PRUint32 *aStreamId)
      78                 : {
      79               0 :   NS_ENSURE_ARG_POINTER(aStreamId);
      80               0 :   *aStreamId = static_cast<nsMozTouchEvent*>(mEvent)->streamId;
      81               0 :   return NS_OK;
      82                 : }
      83                 : 
      84                 : NS_IMETHODIMP
      85               0 : nsDOMMozTouchEvent::InitMozTouchEvent(const nsAString& aTypeArg,
      86                 :                                       bool aCanBubbleArg,
      87                 :                                       bool aCancelableArg,
      88                 :                                       nsIDOMWindow* aViewArg,
      89                 :                                       PRInt32 aDetailArg,
      90                 :                                       PRInt32 aScreenX,
      91                 :                                       PRInt32 aScreenY,
      92                 :                                       PRInt32 aClientX,
      93                 :                                       PRInt32 aClientY,
      94                 :                                       bool aCtrlKeyArg,
      95                 :                                       bool aAltKeyArg,
      96                 :                                       bool aShiftKeyArg,
      97                 :                                       bool aMetaKeyArg,
      98                 :                                       PRUint16 aButton,
      99                 :                                       nsIDOMEventTarget* aRelatedTarget,
     100                 :                                       PRUint32 aStreamId)
     101                 : {
     102                 :   nsresult rv = nsDOMMouseEvent::InitMouseEvent(aTypeArg,
     103                 :                                                 aCanBubbleArg,
     104                 :                                                 aCancelableArg,
     105                 :                                                 aViewArg,
     106                 :                                                 aDetailArg,
     107                 :                                                 aScreenX,
     108                 :                                                 aScreenY,
     109                 :                                                 aClientX,
     110                 :                                                 aClientY,
     111                 :                                                 aCtrlKeyArg,
     112                 :                                                 aAltKeyArg,
     113                 :                                                 aShiftKeyArg,
     114                 :                                                 aMetaKeyArg,
     115                 :                                                 aButton,
     116               0 :                                                 aRelatedTarget);
     117               0 :   NS_ENSURE_SUCCESS(rv, rv);
     118                 : 
     119               0 :   nsMozTouchEvent* mozTouchEvent = static_cast<nsMozTouchEvent*>(mEvent);
     120               0 :   mozTouchEvent->streamId = aStreamId;
     121                 : 
     122               0 :   return NS_OK;
     123                 : }
     124                 : 
     125               0 : nsresult NS_NewDOMMozTouchEvent(nsIDOMEvent** aInstancePtrResult,
     126                 :                                      nsPresContext* aPresContext,
     127                 :                                      nsMozTouchEvent *aEvent)
     128                 : {
     129               0 :   nsDOMMozTouchEvent *it = new nsDOMMozTouchEvent(aPresContext, aEvent);
     130               0 :   return CallQueryInterface(it, aInstancePtrResult);
     131                 : }

Generated by: LCOV version 1.7