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_SVGFEMorphologyElement_h
8 #define mozilla_dom_SVGFEMorphologyElement_h
9 
10 #include "SVGAnimatedEnumeration.h"
11 #include "SVGAnimatedNumberPair.h"
12 #include "SVGAnimatedString.h"
13 #include "SVGFilters.h"
14 
15 nsresult NS_NewSVGFEMorphologyElement(
16     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
17 
18 namespace mozilla {
19 namespace dom {
20 
21 typedef SVGFE SVGFEMorphologyElementBase;
22 
23 class SVGFEMorphologyElement : public SVGFEMorphologyElementBase {
24   friend nsresult(::NS_NewSVGFEMorphologyElement(
25       nsIContent** aResult,
26       already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
27 
28  protected:
SVGFEMorphologyElement(already_AddRefed<mozilla::dom::NodeInfo> && aNodeInfo)29   explicit SVGFEMorphologyElement(
30       already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
31       : SVGFEMorphologyElementBase(std::move(aNodeInfo)) {}
32   virtual JSObject* WrapNode(JSContext* aCx,
33                              JS::Handle<JSObject*> aGivenProto) override;
34 
35  public:
36   virtual FilterPrimitiveDescription GetPrimitiveDescription(
37       nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion,
38       const nsTArray<bool>& aInputsAreTainted,
39       nsTArray<RefPtr<SourceSurface>>& aInputImages) override;
40   virtual bool AttributeAffectsRendering(int32_t aNameSpaceID,
41                                          nsAtom* aAttribute) const override;
GetResultImageName()42   virtual SVGAnimatedString& GetResultImageName() override {
43     return mStringAttributes[RESULT];
44   }
45   virtual void GetSourceImageNames(nsTArray<SVGStringInfo>& aSources) override;
46 
47   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
48 
49   // WebIDL
50   already_AddRefed<DOMSVGAnimatedString> In1();
51   already_AddRefed<DOMSVGAnimatedEnumeration> Operator();
52   already_AddRefed<DOMSVGAnimatedNumber> RadiusX();
53   already_AddRefed<DOMSVGAnimatedNumber> RadiusY();
54   void SetRadius(float rx, float ry);
55 
56  protected:
57   void GetRXY(int32_t* aRX, int32_t* aRY, const nsSVGFilterInstance& aInstance);
58 
59   virtual NumberPairAttributesInfo GetNumberPairInfo() override;
60   virtual EnumAttributesInfo GetEnumInfo() override;
61   virtual StringAttributesInfo GetStringInfo() override;
62 
63   enum { RADIUS };
64   SVGAnimatedNumberPair mNumberPairAttributes[1];
65   static NumberPairInfo sNumberPairInfo[1];
66 
67   enum { OPERATOR };
68   SVGAnimatedEnumeration mEnumAttributes[1];
69   static SVGEnumMapping sOperatorMap[];
70   static EnumInfo sEnumInfo[1];
71 
72   enum { RESULT, IN1 };
73   SVGAnimatedString mStringAttributes[2];
74   static StringInfo sStringInfo[2];
75 };
76 
77 }  // namespace dom
78 }  // namespace mozilla
79 
80 #endif  // mozilla_dom_SVGFEMorphologyElement_h
81