SVGAnimateTransformElement.cpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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/SVGAnimateTransformElement.h"
  6. #include "mozilla/dom/SVGAnimateTransformElementBinding.h"
  7. NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(AnimateTransform)
  8. namespace mozilla {
  9. namespace dom {
  10. JSObject*
  11. SVGAnimateTransformElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
  12. {
  13. return SVGAnimateTransformElementBinding::Wrap(aCx, this, aGivenProto);
  14. }
  15. //----------------------------------------------------------------------
  16. // Implementation
  17. SVGAnimateTransformElement::SVGAnimateTransformElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
  18. : SVGAnimationElement(aNodeInfo)
  19. {
  20. }
  21. bool
  22. SVGAnimateTransformElement::ParseAttribute(int32_t aNamespaceID,
  23. nsIAtom* aAttribute,
  24. const nsAString& aValue,
  25. nsAttrValue& aResult)
  26. {
  27. // 'type' is an <animateTransform>-specific attribute, and we'll handle it
  28. // specially.
  29. if (aNamespaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::type) {
  30. aResult.ParseAtom(aValue);
  31. nsIAtom* atom = aResult.GetAtomValue();
  32. if (atom != nsGkAtoms::translate &&
  33. atom != nsGkAtoms::scale &&
  34. atom != nsGkAtoms::rotate &&
  35. atom != nsGkAtoms::skewX &&
  36. atom != nsGkAtoms::skewY) {
  37. ReportAttributeParseFailure(OwnerDoc(), aAttribute, aValue);
  38. }
  39. return true;
  40. }
  41. return SVGAnimationElement::ParseAttribute(aNamespaceID,
  42. aAttribute, aValue,
  43. aResult);
  44. }
  45. //----------------------------------------------------------------------
  46. // nsIDOMNode methods
  47. NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAnimateTransformElement)
  48. //----------------------------------------------------------------------
  49. nsSMILAnimationFunction&
  50. SVGAnimateTransformElement::AnimationFunction()
  51. {
  52. return mAnimationFunction;
  53. }
  54. } // namespace dom
  55. } // namespace mozilla