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