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/. */
7 #ifndef DOM_SVG_SVGFECOMPOSITEELEMENT_H_
8 #define DOM_SVG_SVGFECOMPOSITEELEMENT_H_
10 #include "SVGAnimatedEnumeration.h"
11 #include "SVGAnimatedNumber.h"
12 #include "mozilla/dom/SVGFilters.h"
14 nsresult
NS_NewSVGFECompositeElement(
15 nsIContent
** aResult
, already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
);
17 namespace mozilla::dom
{
19 using SVGFECompositeElementBase
= SVGFilterPrimitiveElement
;
21 class SVGFECompositeElement final
: public SVGFECompositeElementBase
{
22 friend nsresult(::NS_NewSVGFECompositeElement(
24 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
));
27 explicit SVGFECompositeElement(
28 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
)
29 : SVGFECompositeElementBase(std::move(aNodeInfo
)) {}
30 JSObject
* WrapNode(JSContext
* aCx
,
31 JS::Handle
<JSObject
*> aGivenProto
) override
;
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
];
43 void GetSourceImageNames(nsTArray
<SVGStringInfo
>& aSources
) override
;
45 nsresult
Clone(dom::NodeInfo
*, nsINode
** aResult
) const override
;
47 nsresult
BindToTree(BindContext
& aCtx
, nsINode
& aParent
) override
;
50 already_AddRefed
<DOMSVGAnimatedString
> In1();
51 already_AddRefed
<DOMSVGAnimatedString
> In2();
52 already_AddRefed
<DOMSVGAnimatedEnumeration
> Operator();
53 already_AddRefed
<DOMSVGAnimatedNumber
> K1();
54 already_AddRefed
<DOMSVGAnimatedNumber
> K2();
55 already_AddRefed
<DOMSVGAnimatedNumber
> K3();
56 already_AddRefed
<DOMSVGAnimatedNumber
> K4();
57 void SetK(float k1
, float k2
, float k3
, float k4
);
60 NumberAttributesInfo
GetNumberInfo() override
;
61 EnumAttributesInfo
GetEnumInfo() override
;
62 StringAttributesInfo
GetStringInfo() override
;
64 enum { ATTR_K1
, ATTR_K2
, ATTR_K3
, ATTR_K4
};
65 SVGAnimatedNumber mNumberAttributes
[4];
66 static NumberInfo sNumberInfo
[4];
69 SVGAnimatedEnumeration mEnumAttributes
[1];
70 static SVGEnumMapping sOperatorMap
[];
71 static EnumInfo sEnumInfo
[1];
73 enum { RESULT
, IN1
, IN2
};
74 SVGAnimatedString mStringAttributes
[3];
75 static StringInfo sStringInfo
[3];
78 } // namespace mozilla::dom
80 #endif // DOM_SVG_SVGFECOMPOSITEELEMENT_H_