Bug 1444460 [wpt PR 9948] - gyroscope: Rename LocalCoordinateSystem to GyroscopeLocal...
[gecko.git] / dom / svg / SVGMotionSMILAttr.cpp
blob278a018be2f8ceeb435685396d9bfbfb29c109a8
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 /* representation of a dummy attribute targeted by <animateMotion> element */
9 #include "SVGMotionSMILAttr.h"
10 #include "SVGMotionSMILType.h"
11 #include "mozilla/dom/SVGAnimationElement.h"
12 #include "nsSMILValue.h"
13 #include "nsDebug.h"
14 #include "nsSVGElement.h"
15 #include "gfx2DGlue.h"
17 namespace mozilla {
19 nsresult
20 SVGMotionSMILAttr::ValueFromString(const nsAString& aStr,
21 const dom::SVGAnimationElement* aSrcElement,
22 nsSMILValue& aValue,
23 bool& aPreventCachingOfSandwich) const
25 NS_NOTREACHED("Shouldn't using nsISMILAttr::ValueFromString for parsing "
26 "animateMotion's SMIL values.");
27 return NS_ERROR_FAILURE;
30 nsSMILValue
31 SVGMotionSMILAttr::GetBaseValue() const
33 return nsSMILValue(&SVGMotionSMILType::sSingleton);
36 void
37 SVGMotionSMILAttr::ClearAnimValue()
39 mSVGElement->SetAnimateMotionTransform(nullptr);
42 nsresult
43 SVGMotionSMILAttr::SetAnimValue(const nsSMILValue& aValue)
45 gfx::Matrix matrix = SVGMotionSMILType::CreateMatrix(aValue);
46 mSVGElement->SetAnimateMotionTransform(&matrix);
47 return NS_OK;
50 const nsIContent*
51 SVGMotionSMILAttr::GetTargetNode() const
53 return mSVGElement;
56 } // namespace mozilla