SVGAnimateMotionElement.cpp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "mozilla/dom/SVGAnimateMotionElement.h"
  6. #include "mozilla/dom/SVGAnimateMotionElementBinding.h"
  7. NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(AnimateMotion)
  8. namespace mozilla {
  9. namespace dom {
  10. JSObject*
  11. SVGAnimateMotionElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
  12. {
  13. return SVGAnimateMotionElementBinding::Wrap(aCx, this, aGivenProto);
  14. }
  15. //----------------------------------------------------------------------
  16. // Implementation
  17. SVGAnimateMotionElement::SVGAnimateMotionElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
  18. : SVGAnimationElement(aNodeInfo)
  19. {
  20. }
  21. //----------------------------------------------------------------------
  22. // nsIDOMNode methods
  23. NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAnimateMotionElement)
  24. //----------------------------------------------------------------------
  25. nsSMILAnimationFunction&
  26. SVGAnimateMotionElement::AnimationFunction()
  27. {
  28. return mAnimationFunction;
  29. }
  30. bool
  31. SVGAnimateMotionElement::GetTargetAttributeName(int32_t *aNamespaceID,
  32. nsIAtom **aLocalName) const
  33. {
  34. // <animateMotion> doesn't take an attributeName, since it doesn't target an
  35. // 'attribute' per se. We'll use a unique dummy attribute-name so that our
  36. // nsSMILTargetIdentifier logic (which requires a attribute name) still works.
  37. *aNamespaceID = kNameSpaceID_None;
  38. *aLocalName = nsGkAtoms::mozAnimateMotionDummyAttr;
  39. return true;
  40. }
  41. nsSMILTargetAttrType
  42. SVGAnimateMotionElement::GetTargetAttributeType() const
  43. {
  44. // <animateMotion> doesn't take an attributeType, since it doesn't target an
  45. // 'attribute' per se. We'll just return 'XML' for simplicity. (This just
  46. // needs to match what we expect in nsSVGElement::GetAnimAttr.)
  47. return eSMILTargetAttrType_XML;
  48. }
  49. } // namespace dom
  50. } // namespace mozilla