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/. */
7 #ifndef mozilla_dom_SVGMaskElement_h
8 #define mozilla_dom_SVGMaskElement_h
10 #include "nsSVGEnum.h"
11 #include "nsSVGLength2.h"
12 #include "nsSVGElement.h"
16 nsresult
NS_NewSVGMaskElement(nsIContent
**aResult
,
17 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
);
22 //--------------------- Masks ------------------------
24 typedef nsSVGElement SVGMaskElementBase
;
26 class SVGMaskElement final
: public SVGMaskElementBase
28 friend class ::nsSVGMaskFrame
;
31 friend nsresult (::NS_NewSVGMaskElement(nsIContent
**aResult
,
32 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
));
33 explicit SVGMaskElement(already_AddRefed
<mozilla::dom::NodeInfo
>& aNodeInfo
);
34 virtual JSObject
* WrapNode(JSContext
*cx
, JS::Handle
<JSObject
*> aGivenProto
) override
;
37 // nsIContent interface
38 virtual nsresult
Clone(mozilla::dom::NodeInfo
*aNodeInfo
, nsINode
**aResult
,
39 bool aPreallocateChildren
) const override
;
40 NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom
* aAttribute
) const override
;
42 // nsSVGSVGElement methods:
43 virtual bool HasValidDimensions() const override
;
46 already_AddRefed
<SVGAnimatedEnumeration
> MaskUnits();
47 already_AddRefed
<SVGAnimatedEnumeration
> MaskContentUnits();
48 already_AddRefed
<SVGAnimatedLength
> X();
49 already_AddRefed
<SVGAnimatedLength
> Y();
50 already_AddRefed
<SVGAnimatedLength
> Width();
51 already_AddRefed
<SVGAnimatedLength
> Height();
55 virtual LengthAttributesInfo
GetLengthInfo() override
;
56 virtual EnumAttributesInfo
GetEnumInfo() override
;
58 enum { ATTR_X
, ATTR_Y
, ATTR_WIDTH
, ATTR_HEIGHT
};
59 nsSVGLength2 mLengthAttributes
[4];
60 static LengthInfo sLengthInfo
[4];
62 enum { MASKUNITS
, MASKCONTENTUNITS
};
63 nsSVGEnum mEnumAttributes
[2];
64 static EnumInfo sEnumInfo
[2];
68 } // namespace mozilla
70 #endif // mozilla_dom_SVGMaskElement_h