SVGFEBlendElement.h (2362B)
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_SVGFEBLENDELEMENT_H_ 8 #define DOM_SVG_SVGFEBLENDELEMENT_H_ 9 10 #include "SVGAnimatedEnumeration.h" 11 #include "mozilla/dom/SVGFilters.h" 12 13 nsresult NS_NewSVGFEBlendElement( 14 nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 15 namespace mozilla::dom { 16 17 using SVGFEBlendElementBase = SVGFilterPrimitiveElement; 18 19 class SVGFEBlendElement final : public SVGFEBlendElementBase { 20 friend nsresult(::NS_NewSVGFEBlendElement( 21 nsIContent** aResult, 22 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)); 23 24 protected: 25 explicit SVGFEBlendElement( 26 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) 27 : SVGFEBlendElementBase(std::move(aNodeInfo)) {} 28 JSObject* WrapNode(JSContext* cx, JS::Handle<JSObject*> aGivenProto) override; 29 30 public: 31 FilterPrimitiveDescription GetPrimitiveDescription( 32 SVGFilterInstance* aInstance, const IntRect& aFilterSubregion, 33 const nsTArray<bool>& aInputsAreTainted, 34 nsTArray<RefPtr<SourceSurface>>& aInputImages) override; 35 bool AttributeAffectsRendering(int32_t aNameSpaceID, 36 nsAtom* aAttribute) const override; 37 SVGAnimatedString& GetResultImageName() override { 38 return mStringAttributes[RESULT]; 39 } 40 void GetSourceImageNames(nsTArray<SVGStringInfo>& aSources) override; 41 42 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; 43 44 nsresult BindToTree(BindContext&, nsINode& aParent) override; 45 46 // WebIDL 47 already_AddRefed<DOMSVGAnimatedString> In1(); 48 already_AddRefed<DOMSVGAnimatedString> In2(); 49 already_AddRefed<DOMSVGAnimatedEnumeration> Mode(); 50 51 protected: 52 EnumAttributesInfo GetEnumInfo() override; 53 StringAttributesInfo GetStringInfo() override; 54 55 enum { MODE }; 56 SVGAnimatedEnumeration mEnumAttributes[1]; 57 static SVGEnumMapping sModeMap[]; 58 static EnumInfo sEnumInfo[1]; 59 60 enum { RESULT, IN1, IN2 }; 61 SVGAnimatedString mStringAttributes[3]; 62 static StringInfo sStringInfo[3]; 63 }; 64 65 } // namespace mozilla::dom 66 67 #endif // DOM_SVG_SVGFEBLENDELEMENT_H_