SVGFEColorMatrixElement.h (2691B)
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_SVGFECOLORMATRIXELEMENT_H_ 8 #define DOM_SVG_SVGFECOLORMATRIXELEMENT_H_ 9 10 #include "SVGAnimatedEnumeration.h" 11 #include "SVGAnimatedNumberList.h" 12 #include "mozilla/dom/SVGFilters.h" 13 14 nsresult NS_NewSVGFEColorMatrixElement( 15 nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 16 17 namespace mozilla::dom { 18 19 class DOMSVGAnimatedNumberList; 20 21 using SVGFEColorMatrixElementBase = SVGFilterPrimitiveElement; 22 23 class SVGFEColorMatrixElement final : public SVGFEColorMatrixElementBase { 24 friend nsresult(::NS_NewSVGFEColorMatrixElement( 25 nsIContent** aResult, 26 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)); 27 28 protected: 29 explicit SVGFEColorMatrixElement( 30 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) 31 : SVGFEColorMatrixElementBase(std::move(aNodeInfo)) {} 32 JSObject* WrapNode(JSContext* aCx, 33 JS::Handle<JSObject*> aGivenProto) override; 34 35 public: 36 FilterPrimitiveDescription GetPrimitiveDescription( 37 SVGFilterInstance* aInstance, const IntRect& aFilterSubregion, 38 const nsTArray<bool>& aInputsAreTainted, 39 nsTArray<RefPtr<SourceSurface>>& aInputImages) override; 40 bool AttributeAffectsRendering(int32_t aNameSpaceID, 41 nsAtom* aAttribute) const override; 42 SVGAnimatedString& GetResultImageName() override { 43 return mStringAttributes[RESULT]; 44 } 45 void GetSourceImageNames(nsTArray<SVGStringInfo>& aSources) override; 46 47 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; 48 49 nsresult BindToTree(BindContext& aCtx, nsINode& aParent) override; 50 51 // WebIDL 52 already_AddRefed<DOMSVGAnimatedString> In1(); 53 already_AddRefed<DOMSVGAnimatedEnumeration> Type(); 54 already_AddRefed<DOMSVGAnimatedNumberList> Values(); 55 56 protected: 57 EnumAttributesInfo GetEnumInfo() override; 58 StringAttributesInfo GetStringInfo() override; 59 NumberListAttributesInfo GetNumberListInfo() override; 60 61 enum { TYPE }; 62 SVGAnimatedEnumeration mEnumAttributes[1]; 63 static SVGEnumMapping sTypeMap[]; 64 static EnumInfo sEnumInfo[1]; 65 66 enum { RESULT, IN1 }; 67 SVGAnimatedString mStringAttributes[2]; 68 static StringInfo sStringInfo[2]; 69 70 enum { VALUES }; 71 SVGAnimatedNumberList mNumberListAttributes[1]; 72 static NumberListInfo sNumberListInfo[1]; 73 }; 74 75 } // namespace mozilla::dom 76 77 #endif // DOM_SVG_SVGFECOLORMATRIXELEMENT_H_