2013-01-11 00:43:01 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef __NS_SVGGRADIENTELEMENT_H__
|
|
|
|
#define __NS_SVGGRADIENTELEMENT_H__
|
|
|
|
|
2013-04-14 15:56:34 -07:00
|
|
|
#include "nsSVGAnimatedTransformList.h"
|
2013-01-11 00:43:01 -08:00
|
|
|
#include "nsSVGElement.h"
|
|
|
|
#include "nsSVGLength2.h"
|
|
|
|
#include "nsSVGEnum.h"
|
|
|
|
#include "nsSVGString.h"
|
|
|
|
|
2013-02-02 12:23:16 -08:00
|
|
|
static const unsigned short SVG_SPREADMETHOD_UNKNOWN = 0;
|
|
|
|
static const unsigned short SVG_SPREADMETHOD_PAD = 1;
|
|
|
|
static const unsigned short SVG_SPREADMETHOD_REFLECT = 2;
|
|
|
|
static const unsigned short SVG_SPREADMETHOD_REPEAT = 3;
|
|
|
|
|
2013-01-11 00:43:01 -08:00
|
|
|
class nsSVGGradientFrame;
|
|
|
|
class nsSVGLinearGradientFrame;
|
|
|
|
class nsSVGRadialGradientFrame;
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
NS_NewSVGLinearGradientElement(nsIContent** aResult,
|
2014-06-19 19:01:40 -07:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
2013-01-11 00:43:01 -08:00
|
|
|
nsresult
|
|
|
|
NS_NewSVGRadialGradientElement(nsIContent** aResult,
|
2014-06-19 19:01:40 -07:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
2013-01-11 00:43:01 -08:00
|
|
|
|
|
|
|
namespace mozilla {
|
2013-03-19 20:20:38 -07:00
|
|
|
namespace dom {
|
2013-03-19 19:31:44 -07:00
|
|
|
|
2013-04-14 15:56:34 -07:00
|
|
|
class SVGAnimatedTransformList;
|
|
|
|
|
2013-01-11 00:43:01 -08:00
|
|
|
//--------------------- Gradients------------------------
|
|
|
|
|
|
|
|
typedef nsSVGElement SVGGradientElementBase;
|
|
|
|
|
|
|
|
class SVGGradientElement : public SVGGradientElementBase
|
|
|
|
{
|
|
|
|
friend class ::nsSVGGradientFrame;
|
|
|
|
|
|
|
|
protected:
|
2014-08-31 18:08:04 -07:00
|
|
|
explicit SVGGradientElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
2014-04-08 15:27:17 -07:00
|
|
|
virtual JSObject* WrapNode(JSContext* aCx) MOZ_OVERRIDE = 0;
|
2013-01-11 00:43:01 -08:00
|
|
|
|
|
|
|
public:
|
2014-06-19 19:01:40 -07:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE = 0;
|
2013-03-30 19:27:27 -07:00
|
|
|
|
2013-01-11 00:43:01 -08:00
|
|
|
// nsIContent
|
2013-05-07 22:11:24 -07:00
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
|
2013-01-11 00:43:01 -08:00
|
|
|
|
2013-04-14 15:56:34 -07:00
|
|
|
virtual nsSVGAnimatedTransformList*
|
2013-05-07 22:11:24 -07:00
|
|
|
GetAnimatedTransformList(uint32_t aFlags = 0) MOZ_OVERRIDE;
|
|
|
|
virtual nsIAtom* GetTransformListAttrName() const MOZ_OVERRIDE {
|
2013-01-11 00:43:01 -08:00
|
|
|
return nsGkAtoms::gradientTransform;
|
|
|
|
}
|
|
|
|
|
|
|
|
// WebIDL
|
2013-07-01 00:02:46 -07:00
|
|
|
already_AddRefed<SVGAnimatedEnumeration> GradientUnits();
|
2013-04-14 15:56:34 -07:00
|
|
|
already_AddRefed<SVGAnimatedTransformList> GradientTransform();
|
2013-07-01 00:02:46 -07:00
|
|
|
already_AddRefed<SVGAnimatedEnumeration> SpreadMethod();
|
2013-06-14 15:37:27 -07:00
|
|
|
already_AddRefed<SVGAnimatedString> Href();
|
2013-01-11 00:43:01 -08:00
|
|
|
|
|
|
|
protected:
|
2013-05-07 22:11:24 -07:00
|
|
|
virtual EnumAttributesInfo GetEnumInfo() MOZ_OVERRIDE;
|
|
|
|
virtual StringAttributesInfo GetStringInfo() MOZ_OVERRIDE;
|
2013-01-11 00:43:01 -08:00
|
|
|
|
|
|
|
enum { GRADIENTUNITS, SPREADMETHOD };
|
|
|
|
nsSVGEnum mEnumAttributes[2];
|
|
|
|
static nsSVGEnumMapping sSpreadMethodMap[];
|
|
|
|
static EnumInfo sEnumInfo[2];
|
|
|
|
|
|
|
|
enum { HREF };
|
|
|
|
nsSVGString mStringAttributes[1];
|
|
|
|
static StringInfo sStringInfo[1];
|
|
|
|
|
2013-02-02 12:23:16 -08:00
|
|
|
// SVGGradientElement values
|
2013-04-14 15:56:34 -07:00
|
|
|
nsAutoPtr<nsSVGAnimatedTransformList> mGradientTransform;
|
2013-01-11 00:43:01 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------Linear Gradients------------------------
|
|
|
|
|
|
|
|
typedef SVGGradientElement SVGLinearGradientElementBase;
|
|
|
|
|
|
|
|
class SVGLinearGradientElement : public SVGLinearGradientElementBase
|
|
|
|
{
|
|
|
|
friend class ::nsSVGLinearGradientFrame;
|
|
|
|
friend nsresult
|
|
|
|
(::NS_NewSVGLinearGradientElement(nsIContent** aResult,
|
2014-06-19 19:01:40 -07:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
|
2013-01-11 00:43:01 -08:00
|
|
|
|
|
|
|
protected:
|
2014-08-31 18:08:04 -07:00
|
|
|
explicit SVGLinearGradientElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
2014-04-08 15:27:17 -07:00
|
|
|
virtual JSObject* WrapNode(JSContext* aCx) MOZ_OVERRIDE;
|
2013-01-11 00:43:01 -08:00
|
|
|
|
|
|
|
public:
|
2014-06-19 19:01:40 -07:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
|
2013-01-11 00:43:01 -08:00
|
|
|
|
|
|
|
// WebIDL
|
2013-01-19 12:56:00 -08:00
|
|
|
already_AddRefed<SVGAnimatedLength> X1();
|
|
|
|
already_AddRefed<SVGAnimatedLength> Y1();
|
|
|
|
already_AddRefed<SVGAnimatedLength> X2();
|
|
|
|
already_AddRefed<SVGAnimatedLength> Y2();
|
2013-01-11 00:43:01 -08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2013-05-07 22:11:24 -07:00
|
|
|
virtual LengthAttributesInfo GetLengthInfo() MOZ_OVERRIDE;
|
2013-01-11 00:43:01 -08:00
|
|
|
|
|
|
|
enum { ATTR_X1, ATTR_Y1, ATTR_X2, ATTR_Y2 };
|
|
|
|
nsSVGLength2 mLengthAttributes[4];
|
|
|
|
static LengthInfo sLengthInfo[4];
|
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------- Radial Gradients ----------------------------
|
|
|
|
|
|
|
|
typedef SVGGradientElement SVGRadialGradientElementBase;
|
|
|
|
|
|
|
|
class SVGRadialGradientElement : public SVGRadialGradientElementBase
|
|
|
|
{
|
|
|
|
friend class ::nsSVGRadialGradientFrame;
|
|
|
|
friend nsresult
|
|
|
|
(::NS_NewSVGRadialGradientElement(nsIContent** aResult,
|
2014-06-19 19:01:40 -07:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
|
2013-01-11 00:43:01 -08:00
|
|
|
|
|
|
|
protected:
|
2014-08-31 18:08:04 -07:00
|
|
|
explicit SVGRadialGradientElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
2014-04-08 15:27:17 -07:00
|
|
|
virtual JSObject* WrapNode(JSContext* aCx) MOZ_OVERRIDE;
|
2013-01-11 00:43:01 -08:00
|
|
|
|
|
|
|
public:
|
2014-06-19 19:01:40 -07:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
|
2013-01-11 00:43:01 -08:00
|
|
|
|
|
|
|
// WebIDL
|
2013-01-19 12:56:00 -08:00
|
|
|
already_AddRefed<SVGAnimatedLength> Cx();
|
|
|
|
already_AddRefed<SVGAnimatedLength> Cy();
|
|
|
|
already_AddRefed<SVGAnimatedLength> R();
|
|
|
|
already_AddRefed<SVGAnimatedLength> Fx();
|
|
|
|
already_AddRefed<SVGAnimatedLength> Fy();
|
2013-01-11 00:43:01 -08:00
|
|
|
protected:
|
|
|
|
|
2013-05-07 22:11:24 -07:00
|
|
|
virtual LengthAttributesInfo GetLengthInfo() MOZ_OVERRIDE;
|
2013-01-11 00:43:01 -08:00
|
|
|
|
|
|
|
enum { ATTR_CX, ATTR_CY, ATTR_R, ATTR_FX, ATTR_FY };
|
|
|
|
nsSVGLength2 mLengthAttributes[5];
|
|
|
|
static LengthInfo sLengthInfo[5];
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|