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
;
45 // SVGSVGElement methods:
46 bool HasValidDimensions() const override
;
48 SVGAnimatedTransformList
* GetAnimatedTransformList(
49 uint32_t aFlags
= 0) override
;
50 nsStaticAtom
* GetTransformListAttrName() const override
{
51 return nsGkAtoms::patternTransform
;
55 already_AddRefed
<SVGAnimatedRect
> ViewBox();
56 already_AddRefed
<DOMSVGAnimatedPreserveAspectRatio
> PreserveAspectRatio();
57 already_AddRefed
<DOMSVGAnimatedEnumeration
> PatternUnits();
58 already_AddRefed
<DOMSVGAnimatedEnumeration
> PatternContentUnits();
59 already_AddRefed
<DOMSVGAnimatedTransformList
> PatternTransform();
60 already_AddRefed
<DOMSVGAnimatedLength
> X();
61 already_AddRefed
<DOMSVGAnimatedLength
> Y();
62 already_AddRefed
<DOMSVGAnimatedLength
> Width();
63 already_AddRefed
<DOMSVGAnimatedLength
> Height();
64 already_AddRefed
<DOMSVGAnimatedString
> Href();
67 LengthAttributesInfo
GetLengthInfo() override
;
68 EnumAttributesInfo
GetEnumInfo() override
;
69 StringAttributesInfo
GetStringInfo() override
;
70 SVGAnimatedPreserveAspectRatio
* GetAnimatedPreserveAspectRatio() override
;
71 SVGAnimatedViewBox
* GetAnimatedViewBox() override
;
73 enum { ATTR_X
, ATTR_Y
, ATTR_WIDTH
, ATTR_HEIGHT
};
74 SVGAnimatedLength mLengthAttributes
[4];
75 static LengthInfo sLengthInfo
[4];
77 enum { PATTERNUNITS
, PATTERNCONTENTUNITS
};
78 SVGAnimatedEnumeration mEnumAttributes
[2];
79 static EnumInfo sEnumInfo
[2];
81 UniquePtr
<SVGAnimatedTransformList
> mPatternTransform
;
83 enum { HREF
, XLINK_HREF
};
84 SVGAnimatedString mStringAttributes
[2];
85 static StringInfo sStringInfo
[2];
87 // SVGFitToViewbox properties
88 SVGAnimatedViewBox mViewBox
;
89 SVGAnimatedPreserveAspectRatio mPreserveAspectRatio
;
93 } // namespace mozilla
95 #endif // DOM_SVG_SVGPATTERNELEMENT_H_