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 #include "mozilla/dom/SVGFETileElement.h"
8 #include "mozilla/dom/SVGFETileElementBinding.h"
9 #include "mozilla/SVGFilterInstance.h"
10 #include "mozilla/dom/Document.h"
11 #include "mozilla/dom/BindContext.h"
13 NS_IMPL_NS_NEW_SVG_ELEMENT(FETile
)
15 using namespace mozilla::gfx
;
17 namespace mozilla::dom
{
19 JSObject
* SVGFETileElement::WrapNode(JSContext
* aCx
,
20 JS::Handle
<JSObject
*> aGivenProto
) {
21 return SVGFETileElement_Binding::Wrap(aCx
, this, aGivenProto
);
24 SVGElement::StringInfo
SVGFETileElement::sStringInfo
[2] = {
25 {nsGkAtoms::result
, kNameSpaceID_None
, true},
26 {nsGkAtoms::in
, kNameSpaceID_None
, true}};
28 //----------------------------------------------------------------------
31 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFETileElement
)
33 already_AddRefed
<DOMSVGAnimatedString
> SVGFETileElement::In1() {
34 return mStringAttributes
[IN1
].ToDOMAnimatedString(this);
37 void SVGFETileElement::GetSourceImageNames(nsTArray
<SVGStringInfo
>& aSources
) {
38 aSources
.AppendElement(SVGStringInfo(&mStringAttributes
[IN1
], this));
41 //----------------------------------------------------------------------
44 FilterPrimitiveDescription
SVGFETileElement::GetPrimitiveDescription(
45 SVGFilterInstance
* aInstance
, const IntRect
& aFilterSubregion
,
46 const nsTArray
<bool>& aInputsAreTainted
,
47 nsTArray
<RefPtr
<SourceSurface
>>& aInputImages
) {
48 return FilterPrimitiveDescription(AsVariant(TileAttributes()));
51 bool SVGFETileElement::AttributeAffectsRendering(int32_t aNameSpaceID
,
52 nsAtom
* aAttribute
) const {
53 return SVGFETileElementBase::AttributeAffectsRendering(aNameSpaceID
,
55 (aNameSpaceID
== kNameSpaceID_None
&& aAttribute
== nsGkAtoms::in
);
58 //----------------------------------------------------------------------
61 SVGElement::StringAttributesInfo
SVGFETileElement::GetStringInfo() {
62 return StringAttributesInfo(mStringAttributes
, sStringInfo
,
63 std::size(sStringInfo
));
66 nsresult
SVGFETileElement::BindToTree(BindContext
& aCtx
, nsINode
& aParent
) {
67 if (aCtx
.InComposedDoc()) {
68 aCtx
.OwnerDoc().SetUseCounter(eUseCounter_custom_feTile
);
71 return SVGFETileElementBase::BindToTree(aCtx
, aParent
);
74 } // namespace mozilla::dom