LCOV - code coverage report
Current view: directory - content/smil - nsDOMTimeEvent.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 48 2 4.2 %
Date: 2012-06-02 Functions: 13 2 15.4 %

       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 the Mozilla SMIL Module.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is Mozilla Foundation.
      18                 :  * Portions created by the Initial Developer are Copyright (C) 2010
      19                 :  * the Initial Developer. All Rights Reserved.
      20                 :  *
      21                 :  * Contributor(s):
      22                 :  *   Brian Birtles <birtles@gmail.com>
      23                 :  *
      24                 :  * Alternatively, the contents of this file may be used under the terms of
      25                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      26                 :  * 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 "nsDOMTimeEvent.h"
      39                 : #include "nsGUIEvent.h"
      40                 : #include "nsPresContext.h"
      41                 : #include "nsIInterfaceRequestorUtils.h"
      42                 : #include "nsDOMClassInfoID.h"
      43                 : 
      44               0 : nsDOMTimeEvent::nsDOMTimeEvent(nsPresContext* aPresContext, nsEvent* aEvent)
      45               0 :   : nsDOMEvent(aPresContext, aEvent ? aEvent : new nsUIEvent(false, 0, 0)),
      46               0 :     mDetail(0)
      47                 : {
      48               0 :   if (aEvent) {
      49               0 :     mEventIsInternal = false;
      50                 :   } else {
      51               0 :     mEventIsInternal = true;
      52               0 :     mEvent->eventStructType = NS_SMIL_TIME_EVENT;
      53                 :   }
      54                 : 
      55               0 :   if (mEvent->eventStructType == NS_SMIL_TIME_EVENT) {
      56               0 :     nsUIEvent* event = static_cast<nsUIEvent*>(mEvent);
      57               0 :     mDetail = event->detail;
      58                 :   }
      59                 : 
      60                 :   mEvent->flags |= NS_EVENT_FLAG_CANT_BUBBLE |
      61               0 :                    NS_EVENT_FLAG_CANT_CANCEL;
      62                 : 
      63               0 :   if (mPresContext) {
      64               0 :     nsCOMPtr<nsISupports> container = mPresContext->GetContainer();
      65               0 :     if (container) {
      66               0 :       nsCOMPtr<nsIDOMWindow> window = do_GetInterface(container);
      67               0 :       if (window) {
      68               0 :         mView = do_QueryInterface(window);
      69                 :       }
      70                 :     }
      71                 :   }
      72               0 : }
      73                 : 
      74            1464 : NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMTimeEvent)
      75                 : 
      76               0 : NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMTimeEvent, nsDOMEvent)
      77               0 :   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mView)
      78               0 : NS_IMPL_CYCLE_COLLECTION_UNLINK_END
      79                 : 
      80               0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMTimeEvent, nsDOMEvent)
      81               0 :   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mView)
      82               0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
      83                 : 
      84               0 : NS_IMPL_ADDREF_INHERITED(nsDOMTimeEvent, nsDOMEvent)
      85               0 : NS_IMPL_RELEASE_INHERITED(nsDOMTimeEvent, nsDOMEvent)
      86                 : 
      87                 : DOMCI_DATA(TimeEvent, nsDOMTimeEvent)
      88                 : 
      89               0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMTimeEvent)
      90               0 :   NS_INTERFACE_MAP_ENTRY(nsIDOMTimeEvent)
      91               0 :   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(TimeEvent)
      92               0 : NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
      93                 : 
      94                 : NS_IMETHODIMP
      95               0 : nsDOMTimeEvent::GetView(nsIDOMWindow** aView)
      96                 : {
      97               0 :   *aView = mView;
      98               0 :   NS_IF_ADDREF(*aView);
      99               0 :   return NS_OK;
     100                 : }
     101                 : 
     102                 : NS_IMETHODIMP
     103               0 : nsDOMTimeEvent::GetDetail(PRInt32* aDetail)
     104                 : {
     105               0 :   *aDetail = mDetail;
     106               0 :   return NS_OK;
     107                 : }
     108                 : 
     109                 : NS_IMETHODIMP
     110               0 : nsDOMTimeEvent::InitTimeEvent(const nsAString& aTypeArg,
     111                 :                               nsIDOMWindow* aViewArg,
     112                 :                               PRInt32 aDetailArg)
     113                 : {
     114                 :   nsresult rv = nsDOMEvent::InitEvent(aTypeArg, false /*doesn't bubble*/,
     115               0 :                                                 false /*can't cancel*/);
     116               0 :   NS_ENSURE_SUCCESS(rv, rv);
     117                 : 
     118               0 :   mDetail = aDetailArg;
     119               0 :   mView = aViewArg;
     120                 : 
     121               0 :   return NS_OK;
     122                 : }
     123                 : 
     124               0 : nsresult NS_NewDOMTimeEvent(nsIDOMEvent** aInstancePtrResult,
     125                 :                             nsPresContext* aPresContext,
     126                 :                             nsEvent* aEvent)
     127                 : {
     128               0 :   nsDOMTimeEvent* it = new nsDOMTimeEvent(aPresContext, aEvent);
     129               0 :   return CallQueryInterface(it, aInstancePtrResult);
     130            4392 : }

Generated by: LCOV version 1.7