2015-05-03 12:32:37 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 04:12:37 -07: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 16:00:54 -07:00
|
|
|
|
|
|
|
/* representation of a dummy attribute targeted by <animateMotion> element */
|
|
|
|
|
|
|
|
#include "SVGMotionSMILAttr.h"
|
|
|
|
#include "SVGMotionSMILType.h"
|
2013-03-18 20:18:45 -07:00
|
|
|
#include "mozilla/dom/SVGAnimationElement.h"
|
2010-04-28 16:00:54 -07:00
|
|
|
#include "nsSMILValue.h"
|
|
|
|
#include "nsDebug.h"
|
2013-03-11 15:05:58 -07:00
|
|
|
#include "nsSVGElement.h"
|
2013-12-28 13:37:40 -08:00
|
|
|
#include "gfx2DGlue.h"
|
2010-04-28 16:00:54 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
SVGMotionSMILAttr::ValueFromString(const nsAString& aStr,
|
2013-03-18 20:18:45 -07:00
|
|
|
const dom::SVGAnimationElement* aSrcElement,
|
2010-04-28 16:00:54 -07:00
|
|
|
nsSMILValue& aValue,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool& aPreventCachingOfSandwich) const
|
2010-04-28 16:00:54 -07: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 07:20:58 -07:00
|
|
|
mSVGElement->SetAnimateMotionTransform(nullptr);
|
2010-04-28 16:00:54 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
SVGMotionSMILAttr::SetAnimValue(const nsSMILValue& aValue)
|
|
|
|
{
|
2014-01-20 13:52:04 -08:00
|
|
|
gfx::Matrix matrix = SVGMotionSMILType::CreateMatrix(aValue);
|
2010-04-28 16:00:54 -07:00
|
|
|
mSVGElement->SetAnimateMotionTransform(&matrix);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsIContent*
|
|
|
|
SVGMotionSMILAttr::GetTargetNode() const
|
|
|
|
{
|
|
|
|
return mSVGElement;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace mozilla
|