dom/smil/nsSMILMappedAttribute.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/smil/nsSMILMappedAttribute.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     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 +/* representation of a SMIL-animatable mapped attribute on an element */
    1.10 +
    1.11 +#ifndef NS_SMILMAPPEDATTRIBUTE_H_
    1.12 +#define NS_SMILMAPPEDATTRIBUTE_H_
    1.13 +
    1.14 +#include "mozilla/Attributes.h"
    1.15 +#include "nsSMILCSSProperty.h"
    1.16 +
    1.17 +/* We'll use the empty-string atom |nsGkAtoms::_empty| as the key for storing
    1.18 + * an element's animated content style rule in its Property Table, under the
    1.19 + * property-category SMIL_MAPPED_ATTR_ANIMVAL.  Everything else stored in that
    1.20 + * category is keyed off of the XML attribute name, so the empty string is a
    1.21 + * good "reserved" key to use for storing the style rule (since XML attributes
    1.22 + * all have nonempty names).
    1.23 + */
    1.24 +#define SMIL_MAPPED_ATTR_STYLERULE_ATOM nsGkAtoms::_empty
    1.25 +
    1.26 +/**
    1.27 + * nsSMILMappedAttribute: Implements the nsISMILAttr interface for SMIL
    1.28 + * animations whose targets are attributes that map to CSS properties.  An
    1.29 + * instance of this class represents a particular animation-targeted mapped
    1.30 + * attribute on a particular element.
    1.31 + */
    1.32 +class nsSMILMappedAttribute : public nsSMILCSSProperty {
    1.33 +public:
    1.34 +  /**
    1.35 +   * Constructs a new nsSMILMappedAttribute.
    1.36 +   *
    1.37 +   * @param  aPropID   The CSS property for the mapped attribute we're
    1.38 +   *                   interested in animating.
    1.39 +   * @param  aElement  The element whose attribute is being animated.
    1.40 +   */
    1.41 +  nsSMILMappedAttribute(nsCSSProperty aPropID, mozilla::dom::Element* aElement) :
    1.42 +    nsSMILCSSProperty(aPropID, aElement) {}
    1.43 +
    1.44 +  // nsISMILAttr methods
    1.45 +  virtual nsresult ValueFromString(const nsAString& aStr,
    1.46 +                                   const mozilla::dom::SVGAnimationElement* aSrcElement,
    1.47 +                                   nsSMILValue& aValue,
    1.48 +                                   bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE;
    1.49 +  virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE;
    1.50 +  virtual nsresult    SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE;
    1.51 +  virtual void        ClearAnimValue() MOZ_OVERRIDE;
    1.52 +
    1.53 +protected:
    1.54 +  // Helper Methods
    1.55 +  void FlushChangesToTargetAttr() const;
    1.56 +  already_AddRefed<nsIAtom> GetAttrNameAtom() const;
    1.57 +};
    1.58 +#endif // NS_SMILMAPPEDATTRIBUTE_H_

mercurial