2007-09-26 02:22:08 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-09-26 02:22:08 -07:00
|
|
|
|
|
|
|
#ifndef __NS_SVGBOOLEAN_H__
|
|
|
|
#define __NS_SVGBOOLEAN_H__
|
|
|
|
|
2013-03-24 23:26:06 -07:00
|
|
|
#include "nsCOMPtr.h"
|
2012-01-26 01:57:21 -08:00
|
|
|
#include "nsError.h"
|
|
|
|
#include "nsISMILAttr.h"
|
2012-06-18 19:30:09 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-01-26 01:57:21 -08:00
|
|
|
|
2013-03-11 15:05:58 -07:00
|
|
|
class nsIAtom;
|
|
|
|
class nsISupports;
|
2012-01-26 01:57:21 -08:00
|
|
|
class nsSMILValue;
|
2013-03-11 15:05:58 -07:00
|
|
|
class nsSVGElement;
|
2007-09-26 02:22:08 -07:00
|
|
|
|
2013-03-18 20:18:45 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class SVGAnimationElement;
|
2013-03-24 23:26:06 -07:00
|
|
|
class SVGAnimatedBoolean;
|
2013-03-18 20:18:45 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-26 02:22:08 -07:00
|
|
|
class nsSVGBoolean
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
2012-08-22 08:56:38 -07:00
|
|
|
void Init(uint8_t aAttrEnum = 0xff, bool aValue = false) {
|
2007-09-26 02:22:08 -07:00
|
|
|
mAnimVal = mBaseVal = aValue;
|
|
|
|
mAttrEnum = aAttrEnum;
|
2011-10-17 07:59:28 -07:00
|
|
|
mIsAnimated = false;
|
2007-09-26 02:22:08 -07:00
|
|
|
}
|
|
|
|
|
2012-02-15 15:40:45 -08:00
|
|
|
nsresult SetBaseValueAtom(const nsIAtom* aValue, nsSVGElement *aSVGElement);
|
|
|
|
nsIAtom* GetBaseValueAtom() const;
|
2007-09-26 02:22:08 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
void SetBaseValue(bool aValue, nsSVGElement *aSVGElement);
|
|
|
|
bool GetBaseValue() const
|
2007-09-26 02:22:08 -07:00
|
|
|
{ return mBaseVal; }
|
2010-01-24 08:42:08 -08:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
void SetAnimValue(bool aValue, nsSVGElement *aSVGElement);
|
|
|
|
bool GetAnimValue() const
|
2010-02-25 10:20:43 -08:00
|
|
|
{ return mAnimVal; }
|
2007-09-26 02:22:08 -07:00
|
|
|
|
2013-03-24 23:26:06 -07:00
|
|
|
already_AddRefed<mozilla::dom::SVGAnimatedBoolean>
|
|
|
|
ToDOMAnimatedBoolean(nsSVGElement* aSVGElement);
|
2010-01-24 08:42:08 -08:00
|
|
|
// Returns a new nsISMILAttr object that the caller must delete
|
|
|
|
nsISMILAttr* ToSMILAttr(nsSVGElement* aSVGElement);
|
2007-09-26 02:22:08 -07:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mAnimVal;
|
|
|
|
bool mBaseVal;
|
|
|
|
bool mIsAnimated;
|
2012-08-22 08:56:38 -07:00
|
|
|
uint8_t mAttrEnum; // element specified tracking for attribute
|
2007-09-26 02:22:08 -07:00
|
|
|
|
2010-01-12 05:08:43 -08:00
|
|
|
public:
|
2010-01-24 08:42:08 -08:00
|
|
|
struct SMILBool : public nsISMILAttr
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SMILBool(nsSVGBoolean* aVal, nsSVGElement* aSVGElement)
|
|
|
|
: mVal(aVal), mSVGElement(aSVGElement) {}
|
2012-12-22 20:54:22 -08:00
|
|
|
|
2010-01-24 08:42:08 -08:00
|
|
|
// These will stay alive because a nsISMILAttr only lives as long
|
|
|
|
// as the Compositing step, and DOM elements don't get a chance to
|
|
|
|
// die during that.
|
|
|
|
nsSVGBoolean* mVal;
|
|
|
|
nsSVGElement* mSVGElement;
|
2012-12-22 20:54:22 -08:00
|
|
|
|
2010-01-24 08:42:08 -08:00
|
|
|
// nsISMILAttr methods
|
|
|
|
virtual nsresult ValueFromString(const nsAString& aStr,
|
2013-03-18 20:18:45 -07:00
|
|
|
const mozilla::dom::SVGAnimationElement* aSrcElement,
|
2010-02-20 13:13:11 -08:00
|
|
|
nsSMILValue& aValue,
|
2013-05-29 13:43:41 -07:00
|
|
|
bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE;
|
|
|
|
virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE;
|
|
|
|
virtual void ClearAnimValue() MOZ_OVERRIDE;
|
|
|
|
virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE;
|
2010-01-24 08:42:08 -08:00
|
|
|
};
|
2007-09-26 02:22:08 -07:00
|
|
|
};
|
|
|
|
#endif //__NS_SVGBOOLEAN_H__
|