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
)
15 JSObject
* SVGAnimateTransformElement::WrapNode(
16 JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
) {
17 return SVGAnimateTransformElement_Binding::Wrap(aCx
, this, aGivenProto
);
20 //----------------------------------------------------------------------
23 SVGAnimateTransformElement::SVGAnimateTransformElement(
24 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
)
25 : SVGAnimationElement(std::move(aNodeInfo
)) {}
27 bool SVGAnimateTransformElement::ParseAttribute(
28 int32_t aNamespaceID
, nsAtom
* aAttribute
, const nsAString
& aValue
,
29 nsIPrincipal
* aMaybeScriptedPrincipal
, nsAttrValue
& aResult
) {
30 // 'type' is an <animateTransform>-specific attribute, and we'll handle it
32 if (aNamespaceID
== kNameSpaceID_None
&& aAttribute
== nsGkAtoms::type
) {
33 aResult
.ParseAtom(aValue
);
34 nsAtom
* atom
= aResult
.GetAtomValue();
35 if (atom
!= nsGkAtoms::translate
&& atom
!= nsGkAtoms::scale
&&
36 atom
!= nsGkAtoms::rotate
&& atom
!= nsGkAtoms::skewX
&&
37 atom
!= nsGkAtoms::skewY
) {
38 ReportAttributeParseFailure(OwnerDoc(), aAttribute
, aValue
);
43 return SVGAnimationElement::ParseAttribute(aNamespaceID
, aAttribute
, aValue
,
44 aMaybeScriptedPrincipal
, aResult
);
47 //----------------------------------------------------------------------
50 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAnimateTransformElement
)
52 //----------------------------------------------------------------------
54 SMILAnimationFunction
& SVGAnimateTransformElement::AnimationFunction() {
55 return mAnimationFunction
;
59 } // namespace mozilla