LCOV - code coverage report
Current view: directory - content/svg/content/src - SVGMotionSMILAnimationFunction.h (source / functions) Found Hit Coverage
Test: app.info Lines: 2 0 0.0 %
Date: 2012-06-02 Functions: 2 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 the Mozilla SVG project.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is the 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                 :  *   Daniel Holbert <dholbert@mozilla.com>
      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                 : #ifndef MOZILLA_SVGMOTIONSMILANIMATIONFUNCTION_H_
      39                 : #define MOZILLA_SVGMOTIONSMILANIMATIONFUNCTION_H_
      40                 : 
      41                 : #include "gfxPath.h"  // for gfxFlattenedPath
      42                 : #include "nsAutoPtr.h"
      43                 : #include "nsSMILAnimationFunction.h"
      44                 : #include "nsTArray.h"
      45                 : #include "SVGMotionSMILType.h"  // for RotateType
      46                 : 
      47                 : class nsAttrValue;
      48                 : class nsIAtom;
      49                 : class nsIContent;
      50                 : class nsISMILAttr;
      51                 : class nsSMILValue;
      52                 : class nsSVGMpathElement;
      53                 : 
      54                 : namespace mozilla {
      55                 : 
      56                 : //----------------------------------------------------------------------
      57                 : // SVGMotionSMILAnimationFunction
      58                 : //
      59                 : // Subclass of nsSMILAnimationFunction to support a few extra features offered
      60                 : // by the <animateMotion> element.
      61                 : //
      62                 : class SVGMotionSMILAnimationFunction : public nsSMILAnimationFunction
      63               0 : {
      64                 : public:
      65                 :   SVGMotionSMILAnimationFunction();
      66                 :   NS_OVERRIDE virtual bool SetAttr(nsIAtom* aAttribute,
      67                 :                                      const nsAString& aValue,
      68                 :                                      nsAttrValue& aResult,
      69                 :                                      nsresult* aParseResult = nsnull);
      70                 :   NS_OVERRIDE virtual bool UnsetAttr(nsIAtom* aAttribute);
      71                 : 
      72                 :   // Method to allow our owner-element to signal us when our <mpath>
      73                 :   // has changed or been added/removed.  When that happens, we need to
      74                 :   // mark ourselves as changed so we'll get recomposed, and mark our path data
      75                 :   // as stale so it'll get regenerated (regardless of mPathSourceType, since
      76                 :   // <mpath> trumps all the other sources of path data)
      77               0 :   void MpathChanged() { mIsPathStale = mHasChanged = true; }
      78                 : 
      79                 : protected:
      80                 :   enum PathSourceType {
      81                 :     // NOTE: Ordering matters here. Higher-priority path-descriptors should
      82                 :     // have higher enumerated values
      83                 :     ePathSourceType_None,      // uninitialized or not applicable
      84                 :     ePathSourceType_ByAttr,    // by or from-by animation
      85                 :     ePathSourceType_ToAttr,    // to or from-to animation
      86                 :     ePathSourceType_ValuesAttr,
      87                 :     ePathSourceType_PathAttr,
      88                 :     ePathSourceType_Mpath
      89                 :   };
      90                 : 
      91                 :   NS_OVERRIDE virtual nsSMILCalcMode GetCalcMode() const;
      92                 :   NS_OVERRIDE virtual nsresult GetValues(const nsISMILAttr& aSMILAttr,
      93                 :                                          nsSMILValueArray& aResult);
      94                 :   NS_OVERRIDE virtual void CheckValueListDependentAttrs(PRUint32 aNumValues);
      95                 : 
      96                 :   NS_OVERRIDE virtual bool IsToAnimation() const;
      97                 : 
      98                 :   void     CheckKeyPoints();
      99                 :   nsresult SetKeyPoints(const nsAString& aKeyPoints, nsAttrValue& aResult);
     100                 :   void     UnsetKeyPoints();
     101                 :   nsresult SetRotate(const nsAString& aRotate, nsAttrValue& aResult);
     102                 :   void     UnsetRotate();
     103                 : 
     104                 :   // Helpers for GetValues
     105                 :   void     MarkStaleIfAttributeAffectsPath(nsIAtom* aAttribute);
     106                 :   void     RebuildPathAndVertices(const nsIContent* aContextElem);
     107                 :   void     RebuildPathAndVerticesFromMpathElem(nsSVGMpathElement* aMpathElem);
     108                 :   void     RebuildPathAndVerticesFromPathAttr();
     109                 :   void     RebuildPathAndVerticesFromBasicAttrs(const nsIContent* aContextElem);
     110                 :   bool     GenerateValuesForPathAndPoints(gfxFlattenedPath* aPath,
     111                 :                                           bool aIsKeyPoints,
     112                 :                                           nsTArray<double>& aPointDistances,
     113                 :                                           nsTArray<nsSMILValue>& aResult);
     114                 : 
     115                 :   // Members
     116                 :   // -------
     117                 :   nsTArray<double>           mKeyPoints; // parsed from "keyPoints" attribute.
     118                 : 
     119                 :   RotateType                 mRotateType;  // auto, auto-reverse, or explicit.
     120                 :   float                      mRotateAngle; // the angle value, if explicit.
     121                 : 
     122                 :   PathSourceType             mPathSourceType; // source of our gfxFlattenedPath.
     123                 :   nsRefPtr<gfxFlattenedPath> mPath;           // representation of motion path.
     124                 :   nsTArray<double>           mPathVertices; // distances of vertices along path.
     125                 : 
     126                 :   bool                       mIsPathStale;
     127                 : };
     128                 : 
     129                 : } // namespace mozilla
     130                 : 
     131                 : #endif // MOZILLA_SVGMOTIONSMILANIMATIONFUNCTION_H_

Generated by: LCOV version 1.7