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/. */
|
2009-01-15 07:38:07 +03:00
|
|
|
|
|
|
|
#include "nsSMILSetAnimationFunction.h"
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline bool
|
2009-01-15 07:38:07 +03:00
|
|
|
nsSMILSetAnimationFunction::IsDisallowedAttribute(
|
2017-10-03 01:05:19 +03:00
|
|
|
const nsAtom* aAttribute) const
|
2009-01-15 07:38:07 +03:00
|
|
|
{
|
|
|
|
//
|
|
|
|
// A <set> element is similar to <animate> but lacks:
|
|
|
|
// AnimationValue.attrib(calcMode, values, keyTimes, keySplines, from, to,
|
|
|
|
// by) -- BUT has 'to'
|
|
|
|
// AnimationAddition.attrib(additive, accumulate)
|
|
|
|
//
|
|
|
|
if (aAttribute == nsGkAtoms::calcMode ||
|
|
|
|
aAttribute == nsGkAtoms::values ||
|
|
|
|
aAttribute == nsGkAtoms::keyTimes ||
|
|
|
|
aAttribute == nsGkAtoms::keySplines ||
|
|
|
|
aAttribute == nsGkAtoms::from ||
|
|
|
|
aAttribute == nsGkAtoms::by ||
|
|
|
|
aAttribute == nsGkAtoms::additive ||
|
|
|
|
aAttribute == nsGkAtoms::accumulate) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2017-10-03 01:05:19 +03:00
|
|
|
nsSMILSetAnimationFunction::SetAttr(nsAtom* aAttribute,
|
2009-01-15 07:38:07 +03:00
|
|
|
const nsAString& aValue,
|
|
|
|
nsAttrValue& aResult,
|
|
|
|
nsresult* aParseResult)
|
|
|
|
{
|
|
|
|
if (IsDisallowedAttribute(aAttribute)) {
|
|
|
|
aResult.SetTo(aValue);
|
|
|
|
if (aParseResult) {
|
|
|
|
// SMILANIM 4.2 says:
|
|
|
|
//
|
|
|
|
// The additive and accumulate attributes are not allowed, and will be
|
|
|
|
// ignored if specified.
|
|
|
|
//
|
|
|
|
// So at least for those two attributes we shouldn't report an error even
|
|
|
|
// if they're present. For now we'll also just silently ignore other
|
|
|
|
// attribute types too.
|
|
|
|
*aParseResult = NS_OK;
|
|
|
|
}
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return nsSMILAnimationFunction::SetAttr(aAttribute, aValue,
|
|
|
|
aResult, aParseResult);
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2017-10-03 01:05:19 +03:00
|
|
|
nsSMILSetAnimationFunction::UnsetAttr(nsAtom* aAttribute)
|
2009-01-15 07:38:07 +03:00
|
|
|
{
|
|
|
|
if (IsDisallowedAttribute(aAttribute)) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2009-01-15 07:38:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return nsSMILAnimationFunction::UnsetAttr(aAttribute);
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2017-10-03 01:05:19 +03:00
|
|
|
nsSMILSetAnimationFunction::HasAttr(nsAtom* aAttName) const
|
2009-01-15 07:38:07 +03:00
|
|
|
{
|
|
|
|
if (IsDisallowedAttribute(aAttName))
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2009-01-15 07:38:07 +03:00
|
|
|
|
|
|
|
return nsSMILAnimationFunction::HasAttr(aAttName);
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsAttrValue*
|
2017-10-03 01:05:19 +03:00
|
|
|
nsSMILSetAnimationFunction::GetAttr(nsAtom* aAttName) const
|
2009-01-15 07:38:07 +03:00
|
|
|
{
|
|
|
|
if (IsDisallowedAttribute(aAttName))
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2009-01-15 07:38:07 +03:00
|
|
|
|
|
|
|
return nsSMILAnimationFunction::GetAttr(aAttName);
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2017-10-03 01:05:19 +03:00
|
|
|
nsSMILSetAnimationFunction::GetAttr(nsAtom* aAttName,
|
2009-01-15 07:38:07 +03:00
|
|
|
nsAString& aResult) const
|
|
|
|
{
|
|
|
|
if (IsDisallowedAttribute(aAttName))
|
2012-09-11 22:00:37 +04:00
|
|
|
return false;
|
2009-01-15 07:38:07 +03:00
|
|
|
|
|
|
|
return nsSMILAnimationFunction::GetAttr(aAttName, aResult);
|
|
|
|
}
|
2010-11-10 02:21:04 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2010-11-10 02:21:04 +03:00
|
|
|
nsSMILSetAnimationFunction::WillReplace() const
|
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2010-11-10 02:21:04 +03:00
|
|
|
}
|