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"
|
2019-01-23 16:48:08 +03:00
|
|
|
|
2013-03-19 07:18:45 +04:00
|
|
|
#include "mozilla/dom/SVGAnimationElement.h"
|
2019-01-23 16:48:08 +03:00
|
|
|
#include "mozilla/dom/SVGElement.h"
|
|
|
|
#include "mozilla/SMILValue.h"
|
|
|
|
#include "SVGMotionSMILType.h"
|
2010-04-29 03:00:54 +04:00
|
|
|
#include "nsDebug.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(
|
2013-03-19 07:18:45 +04:00
|
|
|
const nsAString& aStr, const dom::SVGAnimationElement* aSrcElement,
|
2019-01-23 16:48:08 +03:00
|
|
|
SMILValue& aValue, bool& aPreventCachingOfSandwich) const {
|
2018-06-18 08:43:11 +03:00
|
|
|
MOZ_ASSERT_UNREACHABLE(
|
2019-01-25 06:24:01 +03:00
|
|
|
"Shouldn't using SMILAttr::ValueFromString for "
|
2018-06-18 08:43:11 +03:00
|
|
|
"parsing animateMotion's SMIL values.");
|
2010-04-29 03:00:54 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2019-01-23 16:48:08 +03:00
|
|
|
SMILValue SVGMotionSMILAttr::GetBaseValue() const {
|
|
|
|
return SMILValue(&SVGMotionSMILType::sSingleton);
|
2010-04-29 03:00:54 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SVGMotionSMILAttr::ClearAnimValue() {
|
2012-07-30 18:20:58 +04:00
|
|
|
mSVGElement->SetAnimateMotionTransform(nullptr);
|
2010-04-29 03:00:54 +04:00
|
|
|
}
|
|
|
|
|
2019-01-23 16:48:08 +03:00
|
|
|
nsresult SVGMotionSMILAttr::SetAnimValue(const SMILValue& 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
|