SVGFEDropShadowElement.h (2903B)
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_SVGFEDROPSHADOWELEMENT_H_ 8 #define DOM_SVG_SVGFEDROPSHADOWELEMENT_H_ 9 10 #include "SVGAnimatedNumber.h" 11 #include "SVGAnimatedNumberPair.h" 12 #include "SVGAnimatedString.h" 13 #include "mozilla/dom/SVGFilters.h" 14 15 nsresult NS_NewSVGFEDropShadowElement( 16 nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 17 18 namespace mozilla::dom { 19 20 using SVGFEDropShadowElementBase = SVGFilterPrimitiveElement; 21 22 class SVGFEDropShadowElement final : public SVGFEDropShadowElementBase { 23 friend nsresult(::NS_NewSVGFEDropShadowElement( 24 nsIContent** aResult, 25 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)); 26 27 protected: 28 explicit SVGFEDropShadowElement( 29 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) 30 : SVGFEDropShadowElementBase(std::move(aNodeInfo)) {} 31 JSObject* WrapNode(JSContext* aCx, 32 JS::Handle<JSObject*> aGivenProto) override; 33 34 public: 35 FilterPrimitiveDescription GetPrimitiveDescription( 36 SVGFilterInstance* aInstance, const IntRect& aFilterSubregion, 37 const nsTArray<bool>& aInputsAreTainted, 38 nsTArray<RefPtr<SourceSurface>>& aInputImages) override; 39 bool AttributeAffectsRendering(int32_t aNameSpaceID, 40 nsAtom* aAttribute) const override; 41 SVGAnimatedString& GetResultImageName() override { 42 return mStringAttributes[RESULT]; 43 } 44 45 bool OutputIsTainted(const nsTArray<bool>& aInputsAreTainted, 46 nsIPrincipal* aReferencePrincipal) override; 47 48 void GetSourceImageNames(nsTArray<SVGStringInfo>& aSources) override; 49 50 // nsIContent interface 51 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; 52 53 // WebIDL 54 already_AddRefed<DOMSVGAnimatedString> In1(); 55 already_AddRefed<DOMSVGAnimatedNumber> Dx(); 56 already_AddRefed<DOMSVGAnimatedNumber> Dy(); 57 already_AddRefed<DOMSVGAnimatedNumber> StdDeviationX(); 58 already_AddRefed<DOMSVGAnimatedNumber> StdDeviationY(); 59 void SetStdDeviation(float stdDeviationX, float stdDeviationY); 60 61 protected: 62 NumberAttributesInfo GetNumberInfo() override; 63 NumberPairAttributesInfo GetNumberPairInfo() override; 64 StringAttributesInfo GetStringInfo() override; 65 66 enum { DX, DY }; 67 SVGAnimatedNumber mNumberAttributes[2]; 68 static NumberInfo sNumberInfo[2]; 69 70 enum { STD_DEV }; 71 SVGAnimatedNumberPair mNumberPairAttributes[1]; 72 static NumberPairInfo sNumberPairInfo[1]; 73 74 enum { RESULT, IN1 }; 75 SVGAnimatedString mStringAttributes[2]; 76 static StringInfo sStringInfo[2]; 77 }; 78 79 } // namespace mozilla::dom 80 81 #endif // DOM_SVG_SVGFEDROPSHADOWELEMENT_H_