dom/smil/nsSMILSetAnimationFunction.h

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:2c1f27c7f181
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/. */
5
6 #ifndef NS_SMILSETANIMATIONFUNCTION_H_
7 #define NS_SMILSETANIMATIONFUNCTION_H_
8
9 #include "mozilla/Attributes.h"
10 #include "nsSMILAnimationFunction.h"
11
12 //----------------------------------------------------------------------
13 // nsSMILSetAnimationFunction
14 //
15 // Subclass of nsSMILAnimationFunction that limits the behaviour to that offered
16 // by a <set> element.
17 //
18 class nsSMILSetAnimationFunction : public nsSMILAnimationFunction
19 {
20 public:
21 /*
22 * Sets animation-specific attributes (or marks them dirty, in the case
23 * of from/to/by/values).
24 *
25 * @param aAttribute The attribute being set
26 * @param aValue The updated value of the attribute.
27 * @param aResult The nsAttrValue object that may be used for storing the
28 * parsed result.
29 * @param aParseResult Outparam used for reporting parse errors. Will be set
30 * to NS_OK if everything succeeds.
31 * @returns true if aAttribute is a recognized animation-related
32 * attribute; false otherwise.
33 */
34 virtual bool SetAttr(nsIAtom* aAttribute, const nsAString& aValue,
35 nsAttrValue& aResult, nsresult* aParseResult = nullptr) MOZ_OVERRIDE;
36
37 /*
38 * Unsets the given attribute.
39 *
40 * @returns true if aAttribute is a recognized animation-related
41 * attribute; false otherwise.
42 */
43 virtual bool UnsetAttr(nsIAtom* aAttribute) MOZ_OVERRIDE;
44
45 protected:
46 // Although <set> animation might look like to-animation, unlike to-animation,
47 // it never interpolates values.
48 // Returning false here will mean this animation function gets treated as
49 // a single-valued function and no interpolation will be attempted.
50 virtual bool IsToAnimation() const MOZ_OVERRIDE {
51 return false;
52 }
53
54 // <set> applies the exact same value across the simple duration.
55 virtual bool IsValueFixedForSimpleDuration() const MOZ_OVERRIDE {
56 return true;
57 }
58 virtual bool HasAttr(nsIAtom* aAttName) const MOZ_OVERRIDE;
59 virtual const nsAttrValue* GetAttr(nsIAtom* aAttName) const MOZ_OVERRIDE;
60 virtual bool GetAttr(nsIAtom* aAttName,
61 nsAString& aResult) const MOZ_OVERRIDE;
62 virtual bool WillReplace() const MOZ_OVERRIDE;
63
64 bool IsDisallowedAttribute(const nsIAtom* aAttribute) const;
65 };
66
67 #endif // NS_SMILSETANIMATIONFUNCTION_H_

mercurial