SVGFECompositeElement.h (2889B)
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_SVGFECOMPOSITEELEMENT_H_ 8 #define DOM_SVG_SVGFECOMPOSITEELEMENT_H_ 9 10 #include "SVGAnimatedEnumeration.h" 11 #include "SVGAnimatedNumber.h" 12 #include "mozilla/dom/SVGFilters.h" 13 14 nsresult NS_NewSVGFECompositeElement( 15 nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 16 17 namespace mozilla::dom { 18 19 using SVGFECompositeElementBase = SVGFilterPrimitiveElement; 20 21 class SVGFECompositeElement final : public SVGFECompositeElementBase { 22 friend nsresult(::NS_NewSVGFECompositeElement( 23 nsIContent** aResult, 24 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)); 25 26 protected: 27 explicit SVGFECompositeElement( 28 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) 29 : SVGFECompositeElementBase(std::move(aNodeInfo)) {} 30 JSObject* WrapNode(JSContext* aCx, 31 JS::Handle<JSObject*> aGivenProto) override; 32 33 public: 34 FilterPrimitiveDescription GetPrimitiveDescription( 35 SVGFilterInstance* aInstance, const IntRect& aFilterSubregion, 36 const nsTArray<bool>& aInputsAreTainted, 37 nsTArray<RefPtr<SourceSurface>>& aInputImages) override; 38 bool AttributeAffectsRendering(int32_t aNameSpaceID, 39 nsAtom* aAttribute) const override; 40 SVGAnimatedString& GetResultImageName() override { 41 return mStringAttributes[RESULT]; 42 } 43 void GetSourceImageNames(nsTArray<SVGStringInfo>& aSources) override; 44 45 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; 46 47 nsresult BindToTree(BindContext& aCtx, nsINode& aParent) override; 48 49 // WebIDL 50 already_AddRefed<DOMSVGAnimatedString> In1(); 51 already_AddRefed<DOMSVGAnimatedString> In2(); 52 already_AddRefed<DOMSVGAnimatedEnumeration> Operator(); 53 already_AddRefed<DOMSVGAnimatedNumber> K1(); 54 already_AddRefed<DOMSVGAnimatedNumber> K2(); 55 already_AddRefed<DOMSVGAnimatedNumber> K3(); 56 already_AddRefed<DOMSVGAnimatedNumber> K4(); 57 void SetK(float k1, float k2, float k3, float k4); 58 59 protected: 60 NumberAttributesInfo GetNumberInfo() override; 61 EnumAttributesInfo GetEnumInfo() override; 62 StringAttributesInfo GetStringInfo() override; 63 64 enum { ATTR_K1, ATTR_K2, ATTR_K3, ATTR_K4 }; 65 SVGAnimatedNumber mNumberAttributes[4]; 66 static NumberInfo sNumberInfo[4]; 67 68 enum { OPERATOR }; 69 SVGAnimatedEnumeration mEnumAttributes[1]; 70 static SVGEnumMapping sOperatorMap[]; 71 static EnumInfo sEnumInfo[1]; 72 73 enum { RESULT, IN1, IN2 }; 74 SVGAnimatedString mStringAttributes[3]; 75 static StringInfo sStringInfo[3]; 76 }; 77 78 } // namespace mozilla::dom 79 80 #endif // DOM_SVG_SVGFECOMPOSITEELEMENT_H_