LCOV - code coverage report
Current view: directory - content/svg/content/src - nsSVGAnimationElement.h (source / functions) Found Hit Coverage
Test: app.info Lines: 10 1 10.0 %
Date: 2012-06-02 Functions: 8 1 12.5 %

       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 SVG project.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is Brian Birtles.
      18                 :  * Portions created by the Initial Developer are Copyright (C) 2005
      19                 :  * the Initial Developer. All Rights Reserved.
      20                 :  *
      21                 :  * Contributor(s):
      22                 :  *   Brian Birtles <birtles@gmail.com>
      23                 :  *   Chris Double  <chris.double@double.co.nz>
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      27                 :  * or 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                 : #ifndef NS_SVGANIMATIONELEMENT_H_
      40                 : #define NS_SVGANIMATIONELEMENT_H_
      41                 : 
      42                 : #include "DOMSVGTests.h"
      43                 : #include "nsIDOMElementTimeControl.h"
      44                 : #include "nsIDOMSVGAnimationElement.h"
      45                 : #include "nsISMILAnimationElement.h"
      46                 : #include "nsReferencedElement.h"
      47                 : #include "nsSMILTimedElement.h"
      48                 : #include "nsSVGElement.h"
      49                 : 
      50                 : typedef nsSVGElement nsSVGAnimationElementBase;
      51                 : 
      52                 : class nsSVGAnimationElement : public nsSVGAnimationElementBase,
      53                 :                               public DOMSVGTests,
      54                 :                               public nsISMILAnimationElement,
      55                 :                               public nsIDOMElementTimeControl
      56               0 : {
      57                 : protected:
      58                 :   nsSVGAnimationElement(already_AddRefed<nsINodeInfo> aNodeInfo);
      59                 :   nsresult Init();
      60                 : 
      61                 : public:
      62                 :   // interfaces:
      63                 :   NS_DECL_ISUPPORTS_INHERITED
      64                 : 
      65            1464 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsSVGAnimationElement,
      66                 :                                            nsSVGAnimationElementBase)
      67                 :   NS_DECL_NSIDOMSVGANIMATIONELEMENT
      68                 :   NS_DECL_NSIDOMELEMENTTIMECONTROL
      69                 : 
      70                 :   // nsIContent specializations
      71                 :   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
      72                 :                               nsIContent* aBindingParent,
      73                 :                               bool aCompileEventHandlers);
      74                 :   virtual void UnbindFromTree(bool aDeep, bool aNullParent);
      75                 : 
      76                 :   virtual nsresult UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aAttribute,
      77                 :                              bool aNotify);
      78                 : 
      79                 :   virtual bool IsNodeOfType(PRUint32 aFlags) const;
      80                 : 
      81                 :   // nsGenericElement specializations
      82                 :   virtual bool ParseAttribute(PRInt32 aNamespaceID,
      83                 :                                 nsIAtom* aAttribute,
      84                 :                                 const nsAString& aValue,
      85                 :                                 nsAttrValue& aResult);
      86                 :   virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
      87                 :                                 const nsAttrValue* aValue, bool aNotify);
      88                 : 
      89                 :   // nsISMILAnimationElement interface
      90                 :   virtual const Element& AsElement() const;
      91                 :   virtual Element& AsElement();
      92                 :   virtual bool PassesConditionalProcessingTests();
      93                 :   virtual const nsAttrValue* GetAnimAttr(nsIAtom* aName) const;
      94                 :   virtual bool GetAnimAttr(nsIAtom* aAttName, nsAString& aResult) const;
      95                 :   virtual bool HasAnimAttr(nsIAtom* aAttName) const;
      96                 :   virtual Element* GetTargetElementContent();
      97                 :   virtual bool GetTargetAttributeName(PRInt32* aNamespaceID,
      98                 :                                         nsIAtom** aLocalName) const;
      99                 :   virtual nsSMILTargetAttrType GetTargetAttributeType() const;
     100                 :   virtual nsSMILTimedElement& TimedElement();
     101                 :   virtual nsSMILTimeContainer* GetTimeContainer();
     102                 : 
     103                 : protected:
     104                 :   // nsSVGElement overrides
     105                 :   bool IsEventName(nsIAtom* aName);
     106                 : 
     107                 :   void UpdateHrefTarget(nsIContent* aNodeForContext,
     108                 :                         const nsAString& aHrefStr);
     109                 :   void AnimationTargetChanged();
     110                 : 
     111               0 :   class TargetReference : public nsReferencedElement {
     112                 :   public:
     113               0 :     TargetReference(nsSVGAnimationElement* aAnimationElement) :
     114               0 :       mAnimationElement(aAnimationElement) {}
     115                 :   protected:
     116                 :     // We need to be notified when target changes, in order to request a
     117                 :     // sample (which will clear animation effects from old target and apply
     118                 :     // them to the new target) and update any event registrations.
     119               0 :     virtual void ElementChanged(Element* aFrom, Element* aTo) {
     120               0 :       nsReferencedElement::ElementChanged(aFrom, aTo);
     121               0 :       mAnimationElement->AnimationTargetChanged();
     122               0 :     }
     123                 : 
     124                 :     // We need to override IsPersistent to get persistent tracking (beyond the
     125                 :     // first time the target changes)
     126               0 :     virtual bool IsPersistent() { return true; }
     127                 :   private:
     128                 :     nsSVGAnimationElement* const mAnimationElement;
     129                 :   };
     130                 : 
     131                 :   TargetReference      mHrefTarget;
     132                 :   nsSMILTimedElement   mTimedElement;
     133                 : };
     134                 : 
     135                 : #endif // NS_SVGANIMATIONELEMENT_H_

Generated by: LCOV version 1.7