Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/SVGPathElement.h
Line
Count
Source (jump to first uncovered line)
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
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
  NS_DECL_ADDSIZEOFEXCLUDINGTHIS
39
40
  // nsIContent interface
41
  NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* name) const override;
42
43
  // nsSVGSVGElement methods:
44
  virtual bool HasValidDimensions() const override;
45
46
  // SVGGeometryElement methods:
47
  virtual bool AttributeDefinesGeometry(const nsAtom *aName) override;
48
  virtual bool IsMarkable() override;
49
  virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) override;
50
  virtual already_AddRefed<Path> BuildPath(PathBuilder* aBuilder) override;
51
52
  /**
53
   * This returns a path without the extra little line segments that
54
   * ApproximateZeroLengthSubpathSquareCaps can insert if we have square-caps.
55
   * See the comment for that function for more info on that.
56
   */
57
  virtual already_AddRefed<Path> GetOrBuildPathForMeasuring() override;
58
59
  // nsIContent interface
60
  virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
61
62
0
  virtual SVGAnimatedPathSegList* GetAnimPathSegList() override {
63
0
    return &mD;
64
0
  }
65
66
0
  virtual nsAtom* GetPathDataAttrName() const override {
67
0
    return nsGkAtoms::d;
68
0
  }
69
70
  // WebIDL
71
  uint32_t GetPathSegAtLength(float distance);
72
  already_AddRefed<DOMSVGPathSegClosePath> CreateSVGPathSegClosePath();
73
  already_AddRefed<DOMSVGPathSegMovetoAbs> CreateSVGPathSegMovetoAbs(float x, float y);
74
  already_AddRefed<DOMSVGPathSegMovetoRel> CreateSVGPathSegMovetoRel(float x, float y);
75
  already_AddRefed<DOMSVGPathSegLinetoAbs> CreateSVGPathSegLinetoAbs(float x, float y);
76
  already_AddRefed<DOMSVGPathSegLinetoRel> CreateSVGPathSegLinetoRel(float x, float y);
77
  already_AddRefed<DOMSVGPathSegCurvetoCubicAbs>
78
    CreateSVGPathSegCurvetoCubicAbs(float x, float y, float x1, float y1, float x2, float y2);
79
  already_AddRefed<DOMSVGPathSegCurvetoCubicRel>
80
    CreateSVGPathSegCurvetoCubicRel(float x, float y, float x1, float y1, float x2, float y2);
81
  already_AddRefed<DOMSVGPathSegCurvetoQuadraticAbs>
82
    CreateSVGPathSegCurvetoQuadraticAbs(float x, float y, float x1, float y1);
83
  already_AddRefed<DOMSVGPathSegCurvetoQuadraticRel>
84
    CreateSVGPathSegCurvetoQuadraticRel(float x, float y, float x1, float y1);
85
  already_AddRefed<DOMSVGPathSegArcAbs>
86
    CreateSVGPathSegArcAbs(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag);
87
  already_AddRefed<DOMSVGPathSegArcRel>
88
    CreateSVGPathSegArcRel(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag);
89
  already_AddRefed<DOMSVGPathSegLinetoHorizontalAbs> CreateSVGPathSegLinetoHorizontalAbs(float x);
90
  already_AddRefed<DOMSVGPathSegLinetoHorizontalRel> CreateSVGPathSegLinetoHorizontalRel(float x);
91
  already_AddRefed<DOMSVGPathSegLinetoVerticalAbs> CreateSVGPathSegLinetoVerticalAbs(float y);
92
  already_AddRefed<DOMSVGPathSegLinetoVerticalRel> CreateSVGPathSegLinetoVerticalRel(float y);
93
  already_AddRefed<DOMSVGPathSegCurvetoCubicSmoothAbs>
94
    CreateSVGPathSegCurvetoCubicSmoothAbs(float x, float y, float x2, float y2);
95
  already_AddRefed<DOMSVGPathSegCurvetoCubicSmoothRel>
96
    CreateSVGPathSegCurvetoCubicSmoothRel(float x, float y, float x2, float y2);
97
  already_AddRefed<DOMSVGPathSegCurvetoQuadraticSmoothAbs>
98
    CreateSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y);
99
  already_AddRefed<DOMSVGPathSegCurvetoQuadraticSmoothRel>
100
    CreateSVGPathSegCurvetoQuadraticSmoothRel(float x, float y);
101
  already_AddRefed<DOMSVGPathSegList> PathSegList();
102
  already_AddRefed<DOMSVGPathSegList> AnimatedPathSegList();
103
104
protected:
105
106
  SVGAnimatedPathSegList mD;
107
};
108
109
} // namespace dom
110
} // namespace mozilla
111
112
#endif // mozilla_dom_SVGPathElement_h