1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is the Mozilla SMIL module.
16 : *
17 : * The Initial Developer of the Original Code is Brian Birtles.
18 : * Portions created by the Initial Developer are Copyright (C) 2009
19 : * the Initial Developer. All Rights Reserved.
20 : *
21 : * Contributor(s):
22 : * Brian Birtles <birtles@gmail.com>
23 : *
24 : * Alternatively, the contents of this file may be used under the terms of
25 : * either of the GNU General Public License Version 2 or later (the "GPL"),
26 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 : * in which case the provisions of the GPL or the LGPL are applicable instead
28 : * of those above. If you wish to allow use of your version of this file only
29 : * under the terms of either the GPL or the LGPL, and not to allow others to
30 : * use your version of this file under the terms of the MPL, indicate your
31 : * decision by deleting the provisions above and replace them with the notice
32 : * and other provisions required by the GPL or the LGPL. If you do not delete
33 : * the provisions above, a recipient may use your version of this file under
34 : * the terms of any one of the MPL, the GPL or the LGPL.
35 : *
36 : * ***** END LICENSE BLOCK ***** */
37 :
38 : #ifndef NS_SMILSETANIMATIONFUNCTION_H_
39 : #define NS_SMILSETANIMATIONFUNCTION_H_
40 :
41 : #include "nsSMILAnimationFunction.h"
42 :
43 : //----------------------------------------------------------------------
44 : // nsSMILSetAnimationFunction
45 : //
46 : // Subclass of nsSMILAnimationFunction that limits the behaviour to that offered
47 : // by a <set> element.
48 : //
49 : class nsSMILSetAnimationFunction : public nsSMILAnimationFunction
50 0 : {
51 : public:
52 : /*
53 : * Sets animation-specific attributes (or marks them dirty, in the case
54 : * of from/to/by/values).
55 : *
56 : * @param aAttribute The attribute being set
57 : * @param aValue The updated value of the attribute.
58 : * @param aResult The nsAttrValue object that may be used for storing the
59 : * parsed result.
60 : * @param aParseResult Outparam used for reporting parse errors. Will be set
61 : * to NS_OK if everything succeeds.
62 : * @returns true if aAttribute is a recognized animation-related
63 : * attribute; false otherwise.
64 : */
65 : virtual bool SetAttr(nsIAtom* aAttribute, const nsAString& aValue,
66 : nsAttrValue& aResult, nsresult* aParseResult = nsnull);
67 :
68 : /*
69 : * Unsets the given attribute.
70 : *
71 : * @returns true if aAttribute is a recognized animation-related
72 : * attribute; false otherwise.
73 : */
74 : NS_OVERRIDE virtual bool UnsetAttr(nsIAtom* aAttribute);
75 :
76 : protected:
77 : // Although <set> animation might look like to-animation, unlike to-animation,
78 : // it never interpolates values.
79 : // Returning false here will mean this animation function gets treated as
80 : // a single-valued function and no interpolation will be attempted.
81 0 : NS_OVERRIDE virtual bool IsToAnimation() const {
82 0 : return false;
83 : }
84 :
85 : // <set> applies the exact same value across the simple duration.
86 0 : NS_OVERRIDE virtual bool IsValueFixedForSimpleDuration() const {
87 0 : return true;
88 : }
89 : NS_OVERRIDE virtual bool HasAttr(nsIAtom* aAttName) const;
90 : NS_OVERRIDE virtual const nsAttrValue* GetAttr(nsIAtom* aAttName) const;
91 : NS_OVERRIDE virtual bool GetAttr(nsIAtom* aAttName,
92 : nsAString& aResult) const;
93 : NS_OVERRIDE virtual bool WillReplace() const;
94 :
95 : bool IsDisallowedAttribute(const nsIAtom* aAttribute) const;
96 : };
97 :
98 : #endif // NS_SMILSETANIMATIONFUNCTION_H_
|