Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / dom / smil / nsSMILSetAnimationFunction.cpp
blobe01c96b2e06ee4366fcdcd3862ca7596950780a4
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "nsSMILSetAnimationFunction.h"
8 inline bool
9 nsSMILSetAnimationFunction::IsDisallowedAttribute(
10 const nsIAtom* aAttribute) const
13 // A <set> element is similar to <animate> but lacks:
14 // AnimationValue.attrib(calcMode, values, keyTimes, keySplines, from, to,
15 // by) -- BUT has 'to'
16 // AnimationAddition.attrib(additive, accumulate)
18 if (aAttribute == nsGkAtoms::calcMode ||
19 aAttribute == nsGkAtoms::values ||
20 aAttribute == nsGkAtoms::keyTimes ||
21 aAttribute == nsGkAtoms::keySplines ||
22 aAttribute == nsGkAtoms::from ||
23 aAttribute == nsGkAtoms::by ||
24 aAttribute == nsGkAtoms::additive ||
25 aAttribute == nsGkAtoms::accumulate) {
26 return true;
29 return false;
32 bool
33 nsSMILSetAnimationFunction::SetAttr(nsIAtom* aAttribute,
34 const nsAString& aValue,
35 nsAttrValue& aResult,
36 nsresult* aParseResult)
38 if (IsDisallowedAttribute(aAttribute)) {
39 aResult.SetTo(aValue);
40 if (aParseResult) {
41 // SMILANIM 4.2 says:
43 // The additive and accumulate attributes are not allowed, and will be
44 // ignored if specified.
46 // So at least for those two attributes we shouldn't report an error even
47 // if they're present. For now we'll also just silently ignore other
48 // attribute types too.
49 *aParseResult = NS_OK;
51 return true;
54 return nsSMILAnimationFunction::SetAttr(aAttribute, aValue,
55 aResult, aParseResult);
58 bool
59 nsSMILSetAnimationFunction::UnsetAttr(nsIAtom* aAttribute)
61 if (IsDisallowedAttribute(aAttribute)) {
62 return true;
65 return nsSMILAnimationFunction::UnsetAttr(aAttribute);
68 bool
69 nsSMILSetAnimationFunction::HasAttr(nsIAtom* aAttName) const
71 if (IsDisallowedAttribute(aAttName))
72 return false;
74 return nsSMILAnimationFunction::HasAttr(aAttName);
77 const nsAttrValue*
78 nsSMILSetAnimationFunction::GetAttr(nsIAtom* aAttName) const
80 if (IsDisallowedAttribute(aAttName))
81 return nullptr;
83 return nsSMILAnimationFunction::GetAttr(aAttName);
86 bool
87 nsSMILSetAnimationFunction::GetAttr(nsIAtom* aAttName,
88 nsAString& aResult) const
90 if (IsDisallowedAttribute(aAttName))
91 return false;
93 return nsSMILAnimationFunction::GetAttr(aAttName, aResult);
96 bool
97 nsSMILSetAnimationFunction::WillReplace() const
99 return true;