SVGFETurbulenceElement.h (3253B)
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_SVGFETURBULENCEELEMENT_H_ 8 #define DOM_SVG_SVGFETURBULENCEELEMENT_H_ 9 10 #include "SVGAnimatedEnumeration.h" 11 #include "SVGAnimatedInteger.h" 12 #include "SVGAnimatedNumber.h" 13 #include "SVGAnimatedString.h" 14 #include "mozilla/dom/SVGFilters.h" 15 16 nsresult NS_NewSVGFETurbulenceElement( 17 nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 18 19 namespace mozilla::dom { 20 21 using SVGFETurbulenceElementBase = SVGFilterPrimitiveElement; 22 23 class SVGFETurbulenceElement final : public SVGFETurbulenceElementBase { 24 friend nsresult(::NS_NewSVGFETurbulenceElement( 25 nsIContent** aResult, 26 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)); 27 28 protected: 29 explicit SVGFETurbulenceElement( 30 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) 31 : SVGFETurbulenceElementBase(std::move(aNodeInfo)) {} 32 JSObject* WrapNode(JSContext* aCx, 33 JS::Handle<JSObject*> aGivenProto) override; 34 35 public: 36 bool SubregionIsUnionOfRegions() override { return false; } 37 38 FilterPrimitiveDescription GetPrimitiveDescription( 39 SVGFilterInstance* aInstance, const IntRect& aFilterSubregion, 40 const nsTArray<bool>& aInputsAreTainted, 41 nsTArray<RefPtr<SourceSurface>>& aInputImages) override; 42 bool AttributeAffectsRendering(int32_t aNameSpaceID, 43 nsAtom* aAttribute) const override; 44 SVGAnimatedString& GetResultImageName() override { 45 return mStringAttributes[RESULT]; 46 } 47 48 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; 49 50 nsresult BindToTree(BindContext&, nsINode& aParent) override; 51 52 // WebIDL 53 already_AddRefed<DOMSVGAnimatedNumber> BaseFrequencyX(); 54 already_AddRefed<DOMSVGAnimatedNumber> BaseFrequencyY(); 55 already_AddRefed<DOMSVGAnimatedInteger> NumOctaves(); 56 already_AddRefed<DOMSVGAnimatedNumber> Seed(); 57 already_AddRefed<DOMSVGAnimatedEnumeration> StitchTiles(); 58 already_AddRefed<DOMSVGAnimatedEnumeration> Type(); 59 60 protected: 61 NumberAttributesInfo GetNumberInfo() override; 62 NumberPairAttributesInfo GetNumberPairInfo() override; 63 IntegerAttributesInfo GetIntegerInfo() override; 64 EnumAttributesInfo GetEnumInfo() override; 65 StringAttributesInfo GetStringInfo() override; 66 67 enum { SEED }; // floating point seed?! 68 SVGAnimatedNumber mNumberAttributes[1]; 69 static NumberInfo sNumberInfo[1]; 70 71 enum { BASE_FREQ }; 72 SVGAnimatedNumberPair mNumberPairAttributes[1]; 73 static NumberPairInfo sNumberPairInfo[1]; 74 75 enum { OCTAVES }; 76 SVGAnimatedInteger mIntegerAttributes[1]; 77 static IntegerInfo sIntegerInfo[1]; 78 79 enum { TYPE, STITCHTILES }; 80 SVGAnimatedEnumeration mEnumAttributes[2]; 81 static SVGEnumMapping sTypeMap[]; 82 static SVGEnumMapping sStitchTilesMap[]; 83 static EnumInfo sEnumInfo[2]; 84 85 enum { RESULT }; 86 SVGAnimatedString mStringAttributes[1]; 87 static StringInfo sStringInfo[1]; 88 }; 89 90 } // namespace mozilla::dom 91 92 #endif // DOM_SVG_SVGFETURBULENCEELEMENT_H_