dom/smil/nsSMILSetAnimationFunction.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/smil/nsSMILSetAnimationFunction.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,67 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef NS_SMILSETANIMATIONFUNCTION_H_
    1.10 +#define NS_SMILSETANIMATIONFUNCTION_H_
    1.11 +
    1.12 +#include "mozilla/Attributes.h"
    1.13 +#include "nsSMILAnimationFunction.h"
    1.14 +
    1.15 +//----------------------------------------------------------------------
    1.16 +// nsSMILSetAnimationFunction
    1.17 +//
    1.18 +// Subclass of nsSMILAnimationFunction that limits the behaviour to that offered
    1.19 +// by a <set> element.
    1.20 +//
    1.21 +class nsSMILSetAnimationFunction : public nsSMILAnimationFunction
    1.22 +{
    1.23 +public:
    1.24 +  /*
    1.25 +   * Sets animation-specific attributes (or marks them dirty, in the case
    1.26 +   * of from/to/by/values).
    1.27 +   *
    1.28 +   * @param aAttribute The attribute being set
    1.29 +   * @param aValue     The updated value of the attribute.
    1.30 +   * @param aResult    The nsAttrValue object that may be used for storing the
    1.31 +   *                   parsed result.
    1.32 +   * @param aParseResult  Outparam used for reporting parse errors. Will be set
    1.33 +   *                      to NS_OK if everything succeeds.
    1.34 +   * @returns true if aAttribute is a recognized animation-related
    1.35 +   *          attribute; false otherwise.
    1.36 +   */
    1.37 +  virtual bool SetAttr(nsIAtom* aAttribute, const nsAString& aValue,
    1.38 +                         nsAttrValue& aResult, nsresult* aParseResult = nullptr) MOZ_OVERRIDE;
    1.39 +
    1.40 +  /*
    1.41 +   * Unsets the given attribute.
    1.42 +   *
    1.43 +   * @returns true if aAttribute is a recognized animation-related
    1.44 +   *          attribute; false otherwise.
    1.45 +   */
    1.46 +  virtual bool UnsetAttr(nsIAtom* aAttribute) MOZ_OVERRIDE;
    1.47 +
    1.48 +protected:
    1.49 +  // Although <set> animation might look like to-animation, unlike to-animation,
    1.50 +  // it never interpolates values.
    1.51 +  // Returning false here will mean this animation function gets treated as
    1.52 +  // a single-valued function and no interpolation will be attempted.
    1.53 +  virtual bool IsToAnimation() const MOZ_OVERRIDE {
    1.54 +    return false;
    1.55 +  }
    1.56 +
    1.57 +  // <set> applies the exact same value across the simple duration.
    1.58 +  virtual bool IsValueFixedForSimpleDuration() const MOZ_OVERRIDE {
    1.59 +    return true;
    1.60 +  }
    1.61 +  virtual bool               HasAttr(nsIAtom* aAttName) const MOZ_OVERRIDE;
    1.62 +  virtual const nsAttrValue* GetAttr(nsIAtom* aAttName) const MOZ_OVERRIDE;
    1.63 +  virtual bool               GetAttr(nsIAtom* aAttName,
    1.64 +                                     nsAString& aResult) const MOZ_OVERRIDE;
    1.65 +  virtual bool WillReplace() const MOZ_OVERRIDE;
    1.66 +
    1.67 +  bool IsDisallowedAttribute(const nsIAtom* aAttribute) const;
    1.68 +};
    1.69 +
    1.70 +#endif // NS_SMILSETANIMATIONFUNCTION_H_

mercurial