LCOV - code coverage report
Current view: top level - dom/svg - SVGMotionSMILAnimationFunction.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 2 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef MOZILLA_SVGMOTIONSMILANIMATIONFUNCTION_H_
       8             : #define MOZILLA_SVGMOTIONSMILANIMATIONFUNCTION_H_
       9             : 
      10             : #include "mozilla/gfx/2D.h"
      11             : #include "mozilla/RefPtr.h"
      12             : #include "nsSMILAnimationFunction.h"
      13             : #include "nsTArray.h"
      14             : #include "SVGMotionSMILType.h"  // for RotateType
      15             : 
      16             : class nsAttrValue;
      17             : class nsIAtom;
      18             : class nsIContent;
      19             : class nsISMILAttr;
      20             : class nsSMILValue;
      21             : 
      22             : namespace mozilla {
      23             : 
      24             : namespace dom {
      25             : class SVGMPathElement;
      26             : } // namespace dom
      27             : 
      28             : //----------------------------------------------------------------------
      29             : // SVGMotionSMILAnimationFunction
      30             : //
      31             : // Subclass of nsSMILAnimationFunction to support a few extra features offered
      32             : // by the <animateMotion> element.
      33             : //
      34           0 : class SVGMotionSMILAnimationFunction final : public nsSMILAnimationFunction
      35             : {
      36             :   typedef mozilla::gfx::Path Path;
      37             : 
      38             : public:
      39             :   SVGMotionSMILAnimationFunction();
      40             :   virtual bool SetAttr(nsIAtom* aAttribute,
      41             :                        const nsAString& aValue,
      42             :                        nsAttrValue& aResult,
      43             :                        nsresult* aParseResult = nullptr) override;
      44             :   virtual bool UnsetAttr(nsIAtom* aAttribute) override;
      45             : 
      46             :   // Method to allow our owner-element to signal us when our <mpath>
      47             :   // has changed or been added/removed.  When that happens, we need to
      48             :   // mark ourselves as changed so we'll get recomposed, and mark our path data
      49             :   // as stale so it'll get regenerated (regardless of mPathSourceType, since
      50             :   // <mpath> trumps all the other sources of path data)
      51           0 :   void MpathChanged() { mIsPathStale = mHasChanged = true; }
      52             : 
      53             : protected:
      54             :   enum PathSourceType {
      55             :     // NOTE: Ordering matters here. Higher-priority path-descriptors should
      56             :     // have higher enumerated values
      57             :     ePathSourceType_None,      // uninitialized or not applicable
      58             :     ePathSourceType_ByAttr,    // by or from-by animation
      59             :     ePathSourceType_ToAttr,    // to or from-to animation
      60             :     ePathSourceType_ValuesAttr,
      61             :     ePathSourceType_PathAttr,
      62             :     ePathSourceType_Mpath
      63             :   };
      64             : 
      65             :   virtual nsSMILCalcMode GetCalcMode() const override;
      66             :   virtual nsresult GetValues(const nsISMILAttr& aSMILAttr,
      67             :                              nsSMILValueArray& aResult) override;
      68             :   virtual void CheckValueListDependentAttrs(uint32_t aNumValues) override;
      69             : 
      70             :   virtual bool IsToAnimation() const override;
      71             : 
      72             :   void     CheckKeyPoints();
      73             :   nsresult SetKeyPoints(const nsAString& aKeyPoints, nsAttrValue& aResult);
      74             :   void     UnsetKeyPoints();
      75             :   nsresult SetRotate(const nsAString& aRotate, nsAttrValue& aResult);
      76             :   void     UnsetRotate();
      77             : 
      78             :   // Helpers for GetValues
      79             :   void     MarkStaleIfAttributeAffectsPath(nsIAtom* aAttribute);
      80             :   void     RebuildPathAndVertices(const nsIContent* aContextElem);
      81             :   void     RebuildPathAndVerticesFromMpathElem(dom::SVGMPathElement* aMpathElem);
      82             :   void     RebuildPathAndVerticesFromPathAttr();
      83             :   void     RebuildPathAndVerticesFromBasicAttrs(const nsIContent* aContextElem);
      84             :   bool     GenerateValuesForPathAndPoints(Path* aPath,
      85             :                                           bool aIsKeyPoints,
      86             :                                           FallibleTArray<double>& aPointDistances,
      87             :                                           nsSMILValueArray& aResult);
      88             : 
      89             :   // Members
      90             :   // -------
      91             :   FallibleTArray<double>     mKeyPoints; // parsed from "keyPoints" attribute.
      92             : 
      93             :   RotateType                 mRotateType;  // auto, auto-reverse, or explicit.
      94             :   float                      mRotateAngle; // the angle value, if explicit.
      95             : 
      96             :   PathSourceType             mPathSourceType; // source of our Path.
      97             :   RefPtr<Path>               mPath;           // representation of motion path.
      98             :   FallibleTArray<double>     mPathVertices; // distances of vertices along path.
      99             : 
     100             :   bool                       mIsPathStale;
     101             : };
     102             : 
     103             : } // namespace mozilla
     104             : 
     105             : #endif // MOZILLA_SVGMOTIONSMILANIMATIONFUNCTION_H_

Generated by: LCOV version 1.13