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/SVGAnimateTransformElement.h"
8 #include "mozilla/dom/SVGAnimateTransformElementBinding.h"
10 NS_IMPL_NS_NEW_SVG_ELEMENT(AnimateTransform
)
12 namespace mozilla::dom
{
14 JSObject
* SVGAnimateTransformElement::WrapNode(
15 JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
) {
16 return SVGAnimateTransformElement_Binding::Wrap(aCx
, this, aGivenProto
);
19 //----------------------------------------------------------------------
22 SVGAnimateTransformElement::SVGAnimateTransformElement(
23 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
)
24 : SVGAnimationElement(std::move(aNodeInfo
)) {}
26 bool SVGAnimateTransformElement::ParseAttribute(
27 int32_t aNamespaceID
, nsAtom
* aAttribute
, const nsAString
& aValue
,
28 nsIPrincipal
* aMaybeScriptedPrincipal
, nsAttrValue
& aResult
) {
29 // 'type' is an <animateTransform>-specific attribute, and we'll handle it
31 if (aNamespaceID
== kNameSpaceID_None
&& aAttribute
== nsGkAtoms::type
) {
32 aResult
.ParseAtom(aValue
);
33 nsAtom
* atom
= aResult
.GetAtomValue();
34 if (atom
!= nsGkAtoms::translate
&& atom
!= nsGkAtoms::scale
&&
35 atom
!= nsGkAtoms::rotate
&& atom
!= nsGkAtoms::skewX
&&
36 atom
!= nsGkAtoms::skewY
) {
37 ReportAttributeParseFailure(OwnerDoc(), aAttribute
, aValue
);
42 return SVGAnimationElement::ParseAttribute(aNamespaceID
, aAttribute
, aValue
,
43 aMaybeScriptedPrincipal
, aResult
);
46 //----------------------------------------------------------------------
49 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAnimateTransformElement
)
51 //----------------------------------------------------------------------
53 SMILAnimationFunction
& SVGAnimateTransformElement::AnimationFunction() {
54 return mAnimationFunction
;
57 } // namespace mozilla::dom