2015-05-03 22:32:37 +03: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 15:12:37 +04: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-29 03:00:54 +04:00
|
|
|
|
|
|
|
/* representation of a dummy attribute targeted by <animateMotion> element */
|
|
|
|
|
|
|
|
#include "SVGMotionSMILAttr.h"
|
|
|
|
#include "SVGMotionSMILType.h"
|
2013-03-19 07:18:45 +04:00
|
|
|
#include "mozilla/dom/SVGAnimationElement.h"
|
2010-04-29 03:00:54 +04:00
|
|
|
#include "nsSMILValue.h"
|
|
|
|
#include "nsDebug.h"
|
2013-03-12 02:05:58 +04:00
|
|
|
#include "nsSVGElement.h"
|
2013-12-29 01:37:40 +04:00
|
|
|
#include "gfx2DGlue.h"
|
2010-04-29 03:00:54 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
SVGMotionSMILAttr::ValueFromString(const nsAString& aStr,
|
2013-03-19 07:18:45 +04:00
|
|
|
const dom::SVGAnimationElement* aSrcElement,
|
2010-04-29 03:00:54 +04:00
|
|
|
nsSMILValue& aValue,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool& aPreventCachingOfSandwich) const
|
2010-04-29 03:00:54 +04: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 18:20:58 +04:00
|
|
|
mSVGElement->SetAnimateMotionTransform(nullptr);
|
2010-04-29 03:00:54 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
SVGMotionSMILAttr::SetAnimValue(const nsSMILValue& aValue)
|
|
|
|
{
|
2014-01-21 01:52:04 +04:00
|
|
|
gfx::Matrix matrix = SVGMotionSMILType::CreateMatrix(aValue);
|
2010-04-29 03:00:54 +04:00
|
|
|
mSVGElement->SetAnimateMotionTransform(&matrix);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsIContent*
|
|
|
|
SVGMotionSMILAttr::GetTargetNode() const
|
|
|
|
{
|
|
|
|
return mSVGElement;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace mozilla
|