SVGFEOffsetElement.h (2379B)
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_SVGFEOFFSETELEMENT_H_ 8 #define DOM_SVG_SVGFEOFFSETELEMENT_H_ 9 10 #include "SVGAnimatedNumber.h" 11 #include "SVGAnimatedString.h" 12 #include "mozilla/dom/SVGFilters.h" 13 14 nsresult NS_NewSVGFEOffsetElement( 15 nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 16 17 namespace mozilla::dom { 18 19 using SVGFEOffsetElementBase = SVGFilterPrimitiveElement; 20 21 class SVGFEOffsetElement final : public SVGFEOffsetElementBase { 22 friend nsresult(::NS_NewSVGFEOffsetElement( 23 nsIContent** aResult, 24 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)); 25 26 protected: 27 explicit SVGFEOffsetElement( 28 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) 29 : SVGFEOffsetElementBase(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&, nsINode& aParent) override; 48 49 // WebIDL 50 already_AddRefed<DOMSVGAnimatedString> In1(); 51 already_AddRefed<DOMSVGAnimatedNumber> Dx(); 52 already_AddRefed<DOMSVGAnimatedNumber> Dy(); 53 54 protected: 55 NumberAttributesInfo GetNumberInfo() override; 56 StringAttributesInfo GetStringInfo() override; 57 58 enum { DX, DY }; 59 SVGAnimatedNumber mNumberAttributes[2]; 60 static NumberInfo sNumberInfo[2]; 61 62 enum { RESULT, IN1 }; 63 SVGAnimatedString mStringAttributes[2]; 64 static StringInfo sStringInfo[2]; 65 }; 66 67 } // namespace mozilla::dom 68 69 #endif // DOM_SVG_SVGFEOFFSETELEMENT_H_