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