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