Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/SVGGradientElement.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 __NS_SVGGRADIENTELEMENT_H__
8
#define __NS_SVGGRADIENTELEMENT_H__
9
10
#include "nsAutoPtr.h"
11
#include "nsSVGAnimatedTransformList.h"
12
#include "nsSVGElement.h"
13
#include "nsSVGLength2.h"
14
#include "nsSVGEnum.h"
15
#include "nsSVGString.h"
16
17
class nsSVGGradientFrame;
18
class nsSVGLinearGradientFrame;
19
class nsSVGRadialGradientFrame;
20
21
nsresult
22
NS_NewSVGLinearGradientElement(nsIContent** aResult,
23
                               already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
24
nsresult
25
NS_NewSVGRadialGradientElement(nsIContent** aResult,
26
                               already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
27
28
namespace mozilla {
29
namespace dom {
30
31
class SVGAnimatedTransformList;
32
33
//--------------------- Gradients------------------------
34
35
typedef nsSVGElement SVGGradientElementBase;
36
37
class SVGGradientElement : public SVGGradientElementBase
38
{
39
  friend class ::nsSVGGradientFrame;
40
41
protected:
42
  explicit SVGGradientElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
43
  virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override = 0;
44
45
public:
46
  virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override = 0;
47
48
  // nsIContent
49
  NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
50
51
  virtual nsSVGAnimatedTransformList*
52
    GetAnimatedTransformList(uint32_t aFlags = 0) override;
53
0
  virtual nsAtom* GetTransformListAttrName() const override {
54
0
    return nsGkAtoms::gradientTransform;
55
0
  }
56
57
  // WebIDL
58
  already_AddRefed<SVGAnimatedEnumeration> GradientUnits();
59
  already_AddRefed<SVGAnimatedTransformList> GradientTransform();
60
  already_AddRefed<SVGAnimatedEnumeration> SpreadMethod();
61
  already_AddRefed<SVGAnimatedString> Href();
62
63
protected:
64
  virtual EnumAttributesInfo GetEnumInfo() override;
65
  virtual StringAttributesInfo GetStringInfo() override;
66
67
  enum { GRADIENTUNITS, SPREADMETHOD };
68
  nsSVGEnum mEnumAttributes[2];
69
  static nsSVGEnumMapping sSpreadMethodMap[];
70
  static EnumInfo sEnumInfo[2];
71
72
  enum { HREF, XLINK_HREF };
73
  nsSVGString mStringAttributes[2];
74
  static StringInfo sStringInfo[2];
75
76
  // SVGGradientElement values
77
  nsAutoPtr<nsSVGAnimatedTransformList> mGradientTransform;
78
};
79
80
//---------------------Linear Gradients------------------------
81
82
typedef SVGGradientElement SVGLinearGradientElementBase;
83
84
class SVGLinearGradientElement : public SVGLinearGradientElementBase
85
{
86
  friend class ::nsSVGLinearGradientFrame;
87
  friend nsresult
88
    (::NS_NewSVGLinearGradientElement(nsIContent** aResult,
89
                                      already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
90
91
protected:
92
  explicit SVGLinearGradientElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
93
  virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
94
95
public:
96
  virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
97
98
  // WebIDL
99
  already_AddRefed<SVGAnimatedLength> X1();
100
  already_AddRefed<SVGAnimatedLength> Y1();
101
  already_AddRefed<SVGAnimatedLength> X2();
102
  already_AddRefed<SVGAnimatedLength> Y2();
103
104
protected:
105
106
  virtual LengthAttributesInfo GetLengthInfo() override;
107
108
  enum { ATTR_X1, ATTR_Y1, ATTR_X2, ATTR_Y2 };
109
  nsSVGLength2 mLengthAttributes[4];
110
  static LengthInfo sLengthInfo[4];
111
};
112
113
//-------------------------- Radial Gradients ----------------------------
114
115
typedef SVGGradientElement SVGRadialGradientElementBase;
116
117
class SVGRadialGradientElement : public SVGRadialGradientElementBase
118
{
119
  friend class ::nsSVGRadialGradientFrame;
120
  friend nsresult
121
    (::NS_NewSVGRadialGradientElement(nsIContent** aResult,
122
                                      already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
123
124
protected:
125
  explicit SVGRadialGradientElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
126
  virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
127
128
public:
129
  virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
130
131
  // WebIDL
132
  already_AddRefed<SVGAnimatedLength> Cx();
133
  already_AddRefed<SVGAnimatedLength> Cy();
134
  already_AddRefed<SVGAnimatedLength> R();
135
  already_AddRefed<SVGAnimatedLength> Fx();
136
  already_AddRefed<SVGAnimatedLength> Fy();
137
  already_AddRefed<SVGAnimatedLength> Fr();
138
protected:
139
140
  virtual LengthAttributesInfo GetLengthInfo() override;
141
142
  enum { ATTR_CX, ATTR_CY, ATTR_R, ATTR_FX, ATTR_FY, ATTR_FR };
143
  nsSVGLength2 mLengthAttributes[6];
144
  static LengthInfo sLengthInfo[6];
145
};
146
147
} // namespace dom
148
} // namespace mozilla
149
150
#endif