Line data Source code
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/. */
6 :
7 : #ifndef mozilla_dom_SVGFilterElement_h
8 : #define mozilla_dom_SVGFilterElement_h
9 :
10 : #include "nsSVGEnum.h"
11 : #include "nsSVGElement.h"
12 : #include "nsSVGIntegerPair.h"
13 : #include "nsSVGLength2.h"
14 : #include "nsSVGString.h"
15 :
16 : typedef nsSVGElement SVGFilterElementBase;
17 :
18 : class nsSVGFilterFrame;
19 : class nsSVGFilterInstance;
20 :
21 : nsresult NS_NewSVGFilterElement(nsIContent **aResult,
22 : already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
23 :
24 : namespace mozilla {
25 : namespace dom {
26 : class SVGAnimatedLength;
27 :
28 0 : class SVGFilterElement : public SVGFilterElementBase
29 : {
30 : friend class ::nsSVGFilterFrame;
31 : friend class ::nsSVGFilterInstance;
32 :
33 : protected:
34 : friend nsresult (::NS_NewSVGFilterElement(nsIContent **aResult,
35 : already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
36 : explicit SVGFilterElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
37 : virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
38 :
39 : public:
40 : // nsIContent
41 : virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
42 : bool aPreallocateChildren) const override;
43 : NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
44 :
45 : // Invalidate users of this filter
46 : void Invalidate();
47 :
48 : // nsSVGSVGElement methods:
49 : virtual bool HasValidDimensions() const override;
50 :
51 : // WebIDL
52 : already_AddRefed<SVGAnimatedLength> X();
53 : already_AddRefed<SVGAnimatedLength> Y();
54 : already_AddRefed<SVGAnimatedLength> Width();
55 : already_AddRefed<SVGAnimatedLength> Height();
56 : already_AddRefed<SVGAnimatedEnumeration> FilterUnits();
57 : already_AddRefed<SVGAnimatedEnumeration> PrimitiveUnits();
58 : already_AddRefed<SVGAnimatedString> Href();
59 :
60 : protected:
61 :
62 : virtual LengthAttributesInfo GetLengthInfo() override;
63 : virtual EnumAttributesInfo GetEnumInfo() override;
64 : virtual StringAttributesInfo GetStringInfo() override;
65 :
66 : enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
67 : nsSVGLength2 mLengthAttributes[4];
68 : static LengthInfo sLengthInfo[4];
69 :
70 : enum { FILTERUNITS, PRIMITIVEUNITS };
71 : nsSVGEnum mEnumAttributes[2];
72 : static EnumInfo sEnumInfo[2];
73 :
74 : enum { HREF, XLINK_HREF };
75 : nsSVGString mStringAttributes[2];
76 : static StringInfo sStringInfo[2];
77 : };
78 :
79 : } // namespace dom
80 : } // namespace mozilla
81 :
82 : #endif // mozilla_dom_SVGFilterElement_h
|