2010-04-28 23:00:54 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-04-28 23:00:54 +00:00
|
|
|
|
|
|
|
/* representation of a dummy attribute targeted by <animateMotion> element */
|
|
|
|
|
|
|
|
#include "SVGMotionSMILAttr.h"
|
|
|
|
#include "SVGMotionSMILType.h"
|
2013-03-19 03:18:45 +00:00
|
|
|
#include "mozilla/dom/SVGAnimationElement.h"
|
2010-04-28 23:00:54 +00:00
|
|
|
#include "nsSMILValue.h"
|
|
|
|
#include "nsDebug.h"
|
2013-03-11 22:05:58 +00:00
|
|
|
#include "nsSVGElement.h"
|
2013-12-28 21:37:40 +00:00
|
|
|
#include "gfx2DGlue.h"
|
2010-04-28 23:00:54 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
SVGMotionSMILAttr::ValueFromString(const nsAString& aStr,
|
2013-03-19 03:18:45 +00:00
|
|
|
const dom::SVGAnimationElement* aSrcElement,
|
2010-04-28 23:00:54 +00:00
|
|
|
nsSMILValue& aValue,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool& aPreventCachingOfSandwich) const
|
2010-04-28 23:00:54 +00:00
|
|
|
{
|
|
|
|
NS_NOTREACHED("Shouldn't using nsISMILAttr::ValueFromString for parsing "
|
|
|
|
"animateMotion's SMIL values.");
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsSMILValue
|
|
|
|
SVGMotionSMILAttr::GetBaseValue() const
|
|
|
|
{
|
|
|
|
return nsSMILValue(&SVGMotionSMILType::sSingleton);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SVGMotionSMILAttr::ClearAnimValue()
|
|
|
|
{
|
2012-07-30 14:20:58 +00:00
|
|
|
mSVGElement->SetAnimateMotionTransform(nullptr);
|
2010-04-28 23:00:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
SVGMotionSMILAttr::SetAnimValue(const nsSMILValue& aValue)
|
|
|
|
{
|
2014-01-20 21:52:04 +00:00
|
|
|
gfx::Matrix matrix = SVGMotionSMILType::CreateMatrix(aValue);
|
2010-04-28 23:00:54 +00:00
|
|
|
mSVGElement->SetAnimateMotionTransform(&matrix);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsIContent*
|
|
|
|
SVGMotionSMILAttr::GetTargetNode() const
|
|
|
|
{
|
|
|
|
return mSVGElement;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace mozilla
|