2015-05-03 19:32:37 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2013-01-11 08:43:01 +00:00
|
|
|
/* 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 22:56:34 +00:00
|
|
|
#include "nsSVGAnimatedTransformList.h"
|
2013-01-11 08:43:01 +00:00
|
|
|
#include "nsSVGElement.h"
|
|
|
|
#include "nsSVGLength2.h"
|
|
|
|
#include "nsSVGEnum.h"
|
|
|
|
#include "nsSVGString.h"
|
|
|
|
|
2013-02-02 20:23:16 +00: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 08:43:01 +00:00
|
|
|
class nsSVGGradientFrame;
|
|
|
|
class nsSVGLinearGradientFrame;
|
|
|
|
class nsSVGRadialGradientFrame;
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
NS_NewSVGLinearGradientElement(nsIContent** aResult,
|
2014-06-20 02:01:40 +00:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
2013-01-11 08:43:01 +00:00
|
|
|
nsresult
|
|
|
|
NS_NewSVGRadialGradientElement(nsIContent** aResult,
|
2014-06-20 02:01:40 +00:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
2013-01-11 08:43:01 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
2013-03-20 03:20:38 +00:00
|
|
|
namespace dom {
|
2013-03-20 02:31:44 +00:00
|
|
|
|
2013-04-14 22:56:34 +00:00
|
|
|
class SVGAnimatedTransformList;
|
|
|
|
|
2013-01-11 08:43:01 +00:00
|
|
|
//--------------------- Gradients------------------------
|
|
|
|
|
|
|
|
typedef nsSVGElement SVGGradientElementBase;
|
|
|
|
|
|
|
|
class SVGGradientElement : public SVGGradientElementBase
|
|
|
|
{
|
|
|
|
friend class ::nsSVGGradientFrame;
|
|
|
|
|
|
|
|
protected:
|
2014-09-01 01:08:04 +00:00
|
|
|
explicit SVGGradientElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override = 0;
|
2013-01-11 08:43:01 +00:00
|
|
|
|
|
|
|
public:
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override = 0;
|
2013-03-31 02:27:27 +00:00
|
|
|
|
2013-01-11 08:43:01 +00:00
|
|
|
// nsIContent
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
|
2013-01-11 08:43:01 +00:00
|
|
|
|
2013-04-14 22:56:34 +00:00
|
|
|
virtual nsSVGAnimatedTransformList*
|
2015-03-21 16:28:04 +00:00
|
|
|
GetAnimatedTransformList(uint32_t aFlags = 0) override;
|
|
|
|
virtual nsIAtom* GetTransformListAttrName() const override {
|
2013-01-11 08:43:01 +00:00
|
|
|
return nsGkAtoms::gradientTransform;
|
|
|
|
}
|
|
|
|
|
|
|
|
// WebIDL
|
2013-07-01 07:02:46 +00:00
|
|
|
already_AddRefed<SVGAnimatedEnumeration> GradientUnits();
|
2013-04-14 22:56:34 +00:00
|
|
|
already_AddRefed<SVGAnimatedTransformList> GradientTransform();
|
2013-07-01 07:02:46 +00:00
|
|
|
already_AddRefed<SVGAnimatedEnumeration> SpreadMethod();
|
2013-06-14 22:37:27 +00:00
|
|
|
already_AddRefed<SVGAnimatedString> Href();
|
2013-01-11 08:43:01 +00:00
|
|
|
|
|
|
|
protected:
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual EnumAttributesInfo GetEnumInfo() override;
|
|
|
|
virtual StringAttributesInfo GetStringInfo() override;
|
2013-01-11 08:43:01 +00: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 20:23:16 +00:00
|
|
|
// SVGGradientElement values
|
2013-04-14 22:56:34 +00:00
|
|
|
nsAutoPtr<nsSVGAnimatedTransformList> mGradientTransform;
|
2013-01-11 08:43:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------Linear Gradients------------------------
|
|
|
|
|
|
|
|
typedef SVGGradientElement SVGLinearGradientElementBase;
|
|
|
|
|
|
|
|
class SVGLinearGradientElement : public SVGLinearGradientElementBase
|
|
|
|
{
|
|
|
|
friend class ::nsSVGLinearGradientFrame;
|
|
|
|
friend nsresult
|
|
|
|
(::NS_NewSVGLinearGradientElement(nsIContent** aResult,
|
2014-06-20 02:01:40 +00:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
|
2013-01-11 08:43:01 +00:00
|
|
|
|
|
|
|
protected:
|
2014-09-01 01:08:04 +00:00
|
|
|
explicit SVGLinearGradientElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-01-11 08:43:01 +00:00
|
|
|
|
|
|
|
public:
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
|
2013-01-11 08:43:01 +00:00
|
|
|
|
|
|
|
// WebIDL
|
2013-01-19 20:56:00 +00:00
|
|
|
already_AddRefed<SVGAnimatedLength> X1();
|
|
|
|
already_AddRefed<SVGAnimatedLength> Y1();
|
|
|
|
already_AddRefed<SVGAnimatedLength> X2();
|
|
|
|
already_AddRefed<SVGAnimatedLength> Y2();
|
2013-01-11 08:43:01 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual LengthAttributesInfo GetLengthInfo() override;
|
2013-01-11 08:43:01 +00: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-20 02:01:40 +00:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
|
2013-01-11 08:43:01 +00:00
|
|
|
|
|
|
|
protected:
|
2014-09-01 01:08:04 +00:00
|
|
|
explicit SVGRadialGradientElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-01-11 08:43:01 +00:00
|
|
|
|
|
|
|
public:
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
|
2013-01-11 08:43:01 +00:00
|
|
|
|
|
|
|
// WebIDL
|
2013-01-19 20:56:00 +00:00
|
|
|
already_AddRefed<SVGAnimatedLength> Cx();
|
|
|
|
already_AddRefed<SVGAnimatedLength> Cy();
|
|
|
|
already_AddRefed<SVGAnimatedLength> R();
|
|
|
|
already_AddRefed<SVGAnimatedLength> Fx();
|
|
|
|
already_AddRefed<SVGAnimatedLength> Fy();
|
2013-01-11 08:43:01 +00:00
|
|
|
protected:
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual LengthAttributesInfo GetLengthInfo() override;
|
2013-01-11 08:43:01 +00:00
|
|
|
|
|
|
|
enum { ATTR_CX, ATTR_CY, ATTR_R, ATTR_FX, ATTR_FY };
|
|
|
|
nsSVGLength2 mLengthAttributes[5];
|
|
|
|
static LengthInfo sLengthInfo[5];
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|