SVGMotionSMILAttr.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. /* representation of a dummy attribute targeted by <animateMotion> element */
  6. #ifndef MOZILLA_SVGMOTIONSMILATTR_H_
  7. #define MOZILLA_SVGMOTIONSMILATTR_H_
  8. #include "mozilla/Attributes.h"
  9. #include "nsISMILAttr.h"
  10. class nsIContent;
  11. class nsSMILValue;
  12. class nsSVGElement;
  13. namespace mozilla {
  14. namespace dom {
  15. class SVGAnimationElement;
  16. } // namespace dom
  17. /**
  18. * SVGMotionSMILAttr: Implements the nsISMILAttr interface for SMIL animations
  19. * from <animateMotion>.
  20. *
  21. * NOTE: Even though there's technically no "motion" attribute, we behave in
  22. * many ways as if there were, for simplicity.
  23. */
  24. class SVGMotionSMILAttr : public nsISMILAttr
  25. {
  26. public:
  27. explicit SVGMotionSMILAttr(nsSVGElement* aSVGElement)
  28. : mSVGElement(aSVGElement) {}
  29. // nsISMILAttr methods
  30. virtual nsresult ValueFromString(const nsAString& aStr,
  31. const dom::SVGAnimationElement* aSrcElement,
  32. nsSMILValue& aValue,
  33. bool& aPreventCachingOfSandwich) const override;
  34. virtual nsSMILValue GetBaseValue() const override;
  35. virtual nsresult SetAnimValue(const nsSMILValue& aValue) override;
  36. virtual void ClearAnimValue() override;
  37. virtual const nsIContent* GetTargetNode() const override;
  38. protected:
  39. // Raw pointers are OK here because this SVGMotionSMILAttr is both
  40. // created & destroyed during a SMIL sample-step, during which time the DOM
  41. // isn't modified.
  42. nsSVGElement* mSVGElement;
  43. };
  44. } // namespace mozilla
  45. #endif // MOZILLA_SVGMOTIONSMILATTR_H_