dom/smil/nsISMILAttr.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/smil/nsISMILAttr.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,98 @@
     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_ISMILATTR_H_
    1.10 +#define NS_ISMILATTR_H_
    1.11 +
    1.12 +#include "nscore.h"
    1.13 +
    1.14 +class nsSMILValue;
    1.15 +class nsISMILType;
    1.16 +class nsIContent;
    1.17 +class nsAString;
    1.18 +
    1.19 +namespace mozilla {
    1.20 +namespace dom {
    1.21 +class SVGAnimationElement;
    1.22 +}
    1.23 +}
    1.24 +
    1.25 +////////////////////////////////////////////////////////////////////////
    1.26 +// nsISMILAttr: A variable targeted by SMIL for animation and can therefore have
    1.27 +// an underlying (base) value and an animated value For example, an attribute of
    1.28 +// a particular SVG element.
    1.29 +//
    1.30 +// These objects only exist during the compositing phase of SMIL animation
    1.31 +// calculations. They have a single owner who is responsible for deleting the
    1.32 +// object.
    1.33 +
    1.34 +class nsISMILAttr
    1.35 +{
    1.36 +public:
    1.37 +  /**
    1.38 +   * Creates a new nsSMILValue for this attribute from a string. The string is
    1.39 +   * parsed in the context of this attribute so that context-dependent values
    1.40 +   * such as em-based units can be resolved into a canonical form suitable for
    1.41 +   * animation (including interpolation etc.).
    1.42 +   *
    1.43 +   * @param aStr        A string defining the new value to be created.
    1.44 +   * @param aSrcElement The source animation element. This may be needed to
    1.45 +   *                    provided additional context data such as for
    1.46 +   *                    animateTransform where the 'type' attribute is needed to
    1.47 +   *                    parse the value.
    1.48 +   * @param[out] aValue Outparam for storing the parsed value.
    1.49 +   * @param[out] aPreventCachingOfSandwich
    1.50 +   *                    Outparam to indicate whether the attribute contains
    1.51 +   *                    dependencies on its context that should prevent the
    1.52 +   *                    result of the animation sandwich from being cached and
    1.53 +   *                    reused in future samples.
    1.54 +   * @return NS_OK on success or an error code if creation failed.
    1.55 +   */
    1.56 +  virtual nsresult ValueFromString(const nsAString& aStr,
    1.57 +                                   const mozilla::dom::SVGAnimationElement* aSrcElement,
    1.58 +                                   nsSMILValue& aValue,
    1.59 +                                   bool& aPreventCachingOfSandwich) const = 0;
    1.60 +
    1.61 +  /**
    1.62 +   * Gets the underlying value of this attribute.
    1.63 +   *
    1.64 +   * @return an nsSMILValue object. returned_object.IsNull() will be true if an
    1.65 +   * error occurred.
    1.66 +   */
    1.67 +  virtual nsSMILValue GetBaseValue() const = 0;
    1.68 +
    1.69 +  /**
    1.70 +   * Clears the animated value of this attribute.
    1.71 +   *
    1.72 +   * NOTE: The animation target is not guaranteed to be in a document when this
    1.73 +   * method is called. (See bug 523188)
    1.74 +   */
    1.75 +  virtual void ClearAnimValue() = 0;
    1.76 +
    1.77 +  /**
    1.78 +   * Sets the presentation value of this attribute.
    1.79 +   *
    1.80 +   * @param aValue  The value to set.
    1.81 +   * @return NS_OK on success or an error code if setting failed.
    1.82 +   */
    1.83 +  virtual nsresult SetAnimValue(const nsSMILValue& aValue) = 0;
    1.84 +
    1.85 +  /**
    1.86 +   * Returns the targeted content node, for any nsISMILAttr implementations
    1.87 +   * that want to expose that to the animation logic.  Otherwise, returns
    1.88 +   * null.
    1.89 +   *
    1.90 +   * @return the targeted content node, if this nsISMILAttr implementation
    1.91 +   * wishes to make it avaiable.  Otherwise, nullptr.
    1.92 +   */
    1.93 +  virtual const nsIContent* GetTargetNode() const { return nullptr; }
    1.94 +
    1.95 +  /**
    1.96 +   * Virtual destructor, to make sure subclasses can clean themselves up.
    1.97 +   */
    1.98 +  virtual ~nsISMILAttr() {}
    1.99 +};
   1.100 +
   1.101 +#endif // NS_ISMILATTR_H_

mercurial