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 DOM_SVG_SVGPATTERNELEMENT_H_
8 #define DOM_SVG_SVGPATTERNELEMENT_H_
10 #include "SVGAnimatedEnumeration.h"
11 #include "SVGAnimatedLength.h"
12 #include "SVGAnimatedPreserveAspectRatio.h"
13 #include "SVGAnimatedString.h"
14 #include "SVGAnimatedTransformList.h"
15 #include "SVGAnimatedViewBox.h"
16 #include "mozilla/dom/SVGElement.h"
17 #include "mozilla/UniquePtr.h"
19 nsresult
NS_NewSVGPatternElement(
20 nsIContent
** aResult
, already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
);
23 class SVGPatternFrame
;
26 class DOMSVGAnimatedTransformList
;
28 using SVGPatternElementBase
= SVGElement
;
30 class SVGPatternElement final
: public SVGPatternElementBase
{
31 friend class mozilla::SVGPatternFrame
;
34 friend nsresult(::NS_NewSVGPatternElement(
36 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
));
37 explicit SVGPatternElement(
38 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
);
39 JSObject
* WrapNode(JSContext
* cx
, JS::Handle
<JSObject
*> aGivenProto
) override
;
42 // nsIContent interface
43 nsresult
Clone(dom::NodeInfo
*, nsINode
** aResult
) const override
;
44 NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom
* aAttribute
) const override
;
46 // SVGSVGElement methods:
47 bool HasValidDimensions() const override
;
49 SVGAnimatedTransformList
* GetAnimatedTransformList(
50 uint32_t aFlags
= 0) override
;
51 nsStaticAtom
* GetTransformListAttrName() const override
{
52 return nsGkAtoms::patternTransform
;
56 already_AddRefed
<SVGAnimatedRect
> ViewBox();
57 already_AddRefed
<DOMSVGAnimatedPreserveAspectRatio
> PreserveAspectRatio();
58 already_AddRefed
<DOMSVGAnimatedEnumeration
> PatternUnits();
59 already_AddRefed
<DOMSVGAnimatedEnumeration
> PatternContentUnits();
60 already_AddRefed
<DOMSVGAnimatedTransformList
> PatternTransform();
61 already_AddRefed
<DOMSVGAnimatedLength
> X();
62 already_AddRefed
<DOMSVGAnimatedLength
> Y();
63 already_AddRefed
<DOMSVGAnimatedLength
> Width();
64 already_AddRefed
<DOMSVGAnimatedLength
> Height();
65 already_AddRefed
<DOMSVGAnimatedString
> Href();
68 LengthAttributesInfo
GetLengthInfo() override
;
69 EnumAttributesInfo
GetEnumInfo() override
;
70 StringAttributesInfo
GetStringInfo() override
;
71 SVGAnimatedPreserveAspectRatio
* GetAnimatedPreserveAspectRatio() override
;
72 SVGAnimatedViewBox
* GetAnimatedViewBox() override
;
74 enum { ATTR_X
, ATTR_Y
, ATTR_WIDTH
, ATTR_HEIGHT
};
75 SVGAnimatedLength mLengthAttributes
[4];
76 static LengthInfo sLengthInfo
[4];
78 enum { PATTERNUNITS
, PATTERNCONTENTUNITS
};
79 SVGAnimatedEnumeration mEnumAttributes
[2];
80 static EnumInfo sEnumInfo
[2];
82 UniquePtr
<SVGAnimatedTransformList
> mPatternTransform
;
84 enum { HREF
, XLINK_HREF
};
85 SVGAnimatedString mStringAttributes
[2];
86 static StringInfo sStringInfo
[2];
88 // SVGFitToViewbox properties
89 SVGAnimatedViewBox mViewBox
;
90 SVGAnimatedPreserveAspectRatio mPreserveAspectRatio
;
94 } // namespace mozilla
96 #endif // DOM_SVG_SVGPATTERNELEMENT_H_