LCOV - code coverage report
Current view: top level - dom/svg - SVGPathElement.h (source / functions) Hit Total Coverage
Test: output.info Lines: 4 5 80.0 %
Date: 2017-07-14 16:53:18 Functions: 2 4 50.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_dom_SVGPathElement_h
       8             : #define mozilla_dom_SVGPathElement_h
       9             : 
      10             : #include "mozilla/gfx/2D.h"
      11             : #include "mozilla/RefPtr.h"
      12             : #include "SVGAnimatedPathSegList.h"
      13             : #include "SVGGeometryElement.h"
      14             : #include "DOMSVGPathSeg.h"
      15             : 
      16             : nsresult NS_NewSVGPathElement(nsIContent **aResult,
      17             :                               already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
      18             : 
      19             : namespace mozilla {
      20             : 
      21             : class nsISVGPoint;
      22             : 
      23             : namespace dom {
      24             : 
      25             : typedef SVGGeometryElement SVGPathElementBase;
      26             : 
      27           0 : class SVGPathElement final : public SVGPathElementBase
      28             : {
      29             :   typedef mozilla::gfx::Path Path;
      30             : 
      31             : protected:
      32             :   friend nsresult (::NS_NewSVGPathElement(nsIContent **aResult,
      33             :                                           already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
      34             :   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
      35             :   explicit SVGPathElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
      36             : 
      37             : public:
      38             :   // DOM memory reporter participant
      39             :   NS_DECL_SIZEOF_EXCLUDING_THIS
      40             : 
      41             :   // nsIContent interface
      42             :   NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const override;
      43             : 
      44             :   // nsSVGSVGElement methods:
      45             :   virtual bool HasValidDimensions() const override;
      46             : 
      47             :   // SVGGeometryElement methods:
      48             :   virtual bool AttributeDefinesGeometry(const nsIAtom *aName) override;
      49             :   virtual bool IsMarkable() override;
      50             :   virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) override;
      51             :   virtual already_AddRefed<Path> BuildPath(PathBuilder* aBuilder) override;
      52             : 
      53             :   /**
      54             :    * This returns a path without the extra little line segments that
      55             :    * ApproximateZeroLengthSubpathSquareCaps can insert if we have square-caps.
      56             :    * See the comment for that function for more info on that.
      57             :    */
      58             :   virtual already_AddRefed<Path> GetOrBuildPathForMeasuring() override;
      59             : 
      60             :   // nsIContent interface
      61             :   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
      62             :                          bool aPreallocateChildren) const override;
      63             : 
      64          44 :   virtual SVGAnimatedPathSegList* GetAnimPathSegList() override {
      65          44 :     return &mD;
      66             :   }
      67             : 
      68          83 :   virtual nsIAtom* GetPathDataAttrName() const override {
      69          83 :     return nsGkAtoms::d;
      70             :   }
      71             : 
      72             :   enum PathLengthScaleForType {
      73             :     eForTextPath,
      74             :     eForStroking
      75             :   };
      76             : 
      77             :   /**
      78             :    * Gets the ratio of the actual path length to the content author's estimated
      79             :    * length (as provided by the <path> element's 'pathLength' attribute). This
      80             :    * is used to scale stroke dashing, and to scale offsets along a textPath.
      81             :    */
      82             :   float GetPathLengthScale(PathLengthScaleForType aFor);
      83             : 
      84             :   // WebIDL
      85             :   uint32_t GetPathSegAtLength(float distance);
      86             :   already_AddRefed<DOMSVGPathSegClosePath> CreateSVGPathSegClosePath();
      87             :   already_AddRefed<DOMSVGPathSegMovetoAbs> CreateSVGPathSegMovetoAbs(float x, float y);
      88             :   already_AddRefed<DOMSVGPathSegMovetoRel> CreateSVGPathSegMovetoRel(float x, float y);
      89             :   already_AddRefed<DOMSVGPathSegLinetoAbs> CreateSVGPathSegLinetoAbs(float x, float y);
      90             :   already_AddRefed<DOMSVGPathSegLinetoRel> CreateSVGPathSegLinetoRel(float x, float y);
      91             :   already_AddRefed<DOMSVGPathSegCurvetoCubicAbs>
      92             :     CreateSVGPathSegCurvetoCubicAbs(float x, float y, float x1, float y1, float x2, float y2);
      93             :   already_AddRefed<DOMSVGPathSegCurvetoCubicRel>
      94             :     CreateSVGPathSegCurvetoCubicRel(float x, float y, float x1, float y1, float x2, float y2);
      95             :   already_AddRefed<DOMSVGPathSegCurvetoQuadraticAbs>
      96             :     CreateSVGPathSegCurvetoQuadraticAbs(float x, float y, float x1, float y1);
      97             :   already_AddRefed<DOMSVGPathSegCurvetoQuadraticRel>
      98             :     CreateSVGPathSegCurvetoQuadraticRel(float x, float y, float x1, float y1);
      99             :   already_AddRefed<DOMSVGPathSegArcAbs>
     100             :     CreateSVGPathSegArcAbs(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag);
     101             :   already_AddRefed<DOMSVGPathSegArcRel>
     102             :     CreateSVGPathSegArcRel(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag);
     103             :   already_AddRefed<DOMSVGPathSegLinetoHorizontalAbs> CreateSVGPathSegLinetoHorizontalAbs(float x);
     104             :   already_AddRefed<DOMSVGPathSegLinetoHorizontalRel> CreateSVGPathSegLinetoHorizontalRel(float x);
     105             :   already_AddRefed<DOMSVGPathSegLinetoVerticalAbs> CreateSVGPathSegLinetoVerticalAbs(float y);
     106             :   already_AddRefed<DOMSVGPathSegLinetoVerticalRel> CreateSVGPathSegLinetoVerticalRel(float y);
     107             :   already_AddRefed<DOMSVGPathSegCurvetoCubicSmoothAbs>
     108             :     CreateSVGPathSegCurvetoCubicSmoothAbs(float x, float y, float x2, float y2);
     109             :   already_AddRefed<DOMSVGPathSegCurvetoCubicSmoothRel>
     110             :     CreateSVGPathSegCurvetoCubicSmoothRel(float x, float y, float x2, float y2);
     111             :   already_AddRefed<DOMSVGPathSegCurvetoQuadraticSmoothAbs>
     112             :     CreateSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y);
     113             :   already_AddRefed<DOMSVGPathSegCurvetoQuadraticSmoothRel>
     114             :     CreateSVGPathSegCurvetoQuadraticSmoothRel(float x, float y);
     115             :   already_AddRefed<DOMSVGPathSegList> PathSegList();
     116             :   already_AddRefed<DOMSVGPathSegList> AnimatedPathSegList();
     117             : 
     118             : protected:
     119             : 
     120             :   SVGAnimatedPathSegList mD;
     121             : };
     122             : 
     123             : } // namespace dom
     124             : } // namespace mozilla
     125             : 
     126             : #endif // mozilla_dom_SVGPathElement_h

Generated by: LCOV version 1.13