/src/mozilla-central/dom/smil/nsSMILSetAnimationFunction.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #include "nsSMILSetAnimationFunction.h" |
8 | | |
9 | | inline bool |
10 | | nsSMILSetAnimationFunction::IsDisallowedAttribute( |
11 | | const nsAtom* aAttribute) const |
12 | 0 | { |
13 | 0 | // |
14 | 0 | // A <set> element is similar to <animate> but lacks: |
15 | 0 | // AnimationValue.attrib(calcMode, values, keyTimes, keySplines, from, to, |
16 | 0 | // by) -- BUT has 'to' |
17 | 0 | // AnimationAddition.attrib(additive, accumulate) |
18 | 0 | // |
19 | 0 | if (aAttribute == nsGkAtoms::calcMode || |
20 | 0 | aAttribute == nsGkAtoms::values || |
21 | 0 | aAttribute == nsGkAtoms::keyTimes || |
22 | 0 | aAttribute == nsGkAtoms::keySplines || |
23 | 0 | aAttribute == nsGkAtoms::from || |
24 | 0 | aAttribute == nsGkAtoms::by || |
25 | 0 | aAttribute == nsGkAtoms::additive || |
26 | 0 | aAttribute == nsGkAtoms::accumulate) { |
27 | 0 | return true; |
28 | 0 | } |
29 | 0 | |
30 | 0 | return false; |
31 | 0 | } |
32 | | |
33 | | bool |
34 | | nsSMILSetAnimationFunction::SetAttr(nsAtom* aAttribute, |
35 | | const nsAString& aValue, |
36 | | nsAttrValue& aResult, |
37 | | nsresult* aParseResult) |
38 | 0 | { |
39 | 0 | if (IsDisallowedAttribute(aAttribute)) { |
40 | 0 | aResult.SetTo(aValue); |
41 | 0 | if (aParseResult) { |
42 | 0 | // SMILANIM 4.2 says: |
43 | 0 | // |
44 | 0 | // The additive and accumulate attributes are not allowed, and will be |
45 | 0 | // ignored if specified. |
46 | 0 | // |
47 | 0 | // So at least for those two attributes we shouldn't report an error even |
48 | 0 | // if they're present. For now we'll also just silently ignore other |
49 | 0 | // attribute types too. |
50 | 0 | *aParseResult = NS_OK; |
51 | 0 | } |
52 | 0 | return true; |
53 | 0 | } |
54 | 0 |
|
55 | 0 | return nsSMILAnimationFunction::SetAttr(aAttribute, aValue, |
56 | 0 | aResult, aParseResult); |
57 | 0 | } |
58 | | |
59 | | bool |
60 | | nsSMILSetAnimationFunction::UnsetAttr(nsAtom* aAttribute) |
61 | 0 | { |
62 | 0 | if (IsDisallowedAttribute(aAttribute)) { |
63 | 0 | return true; |
64 | 0 | } |
65 | 0 | |
66 | 0 | return nsSMILAnimationFunction::UnsetAttr(aAttribute); |
67 | 0 | } |
68 | | |
69 | | bool |
70 | | nsSMILSetAnimationFunction::HasAttr(nsAtom* aAttName) const |
71 | 0 | { |
72 | 0 | if (IsDisallowedAttribute(aAttName)) |
73 | 0 | return false; |
74 | 0 | |
75 | 0 | return nsSMILAnimationFunction::HasAttr(aAttName); |
76 | 0 | } |
77 | | |
78 | | const nsAttrValue* |
79 | | nsSMILSetAnimationFunction::GetAttr(nsAtom* aAttName) const |
80 | 0 | { |
81 | 0 | if (IsDisallowedAttribute(aAttName)) |
82 | 0 | return nullptr; |
83 | 0 | |
84 | 0 | return nsSMILAnimationFunction::GetAttr(aAttName); |
85 | 0 | } |
86 | | |
87 | | bool |
88 | | nsSMILSetAnimationFunction::GetAttr(nsAtom* aAttName, |
89 | | nsAString& aResult) const |
90 | 0 | { |
91 | 0 | if (IsDisallowedAttribute(aAttName)) |
92 | 0 | return false; |
93 | 0 | |
94 | 0 | return nsSMILAnimationFunction::GetAttr(aAttName, aResult); |
95 | 0 | } |
96 | | |
97 | | bool |
98 | | nsSMILSetAnimationFunction::WillReplace() const |
99 | 0 | { |
100 | 0 | return true; |
101 | 0 | } |