2007-09-26 13:22:08 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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 13:22:08 +04:00
|
|
|
|
|
|
|
#ifndef __NS_SVGBOOLEAN_H__
|
|
|
|
#define __NS_SVGBOOLEAN_H__
|
|
|
|
|
2013-03-25 10:26:06 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2012-01-26 13:57:21 +04:00
|
|
|
#include "nsError.h"
|
|
|
|
#include "nsISMILAttr.h"
|
2012-06-19 06:30:09 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-01-26 13:57:21 +04:00
|
|
|
|
2013-03-12 02:05:58 +04:00
|
|
|
class nsIAtom;
|
|
|
|
class nsISupports;
|
2012-01-26 13:57:21 +04:00
|
|
|
class nsSMILValue;
|
2013-03-12 02:05:58 +04:00
|
|
|
class nsSVGElement;
|
2007-09-26 13:22:08 +04:00
|
|
|
|
2013-03-19 07:18:45 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class SVGAnimationElement;
|
2013-03-25 10:26:06 +04:00
|
|
|
class SVGAnimatedBoolean;
|
2013-03-19 07:18:45 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-26 13:22:08 +04:00
|
|
|
class nsSVGBoolean
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
2012-08-22 19:56:38 +04:00
|
|
|
void Init(uint8_t aAttrEnum = 0xff, bool aValue = false) {
|
2007-09-26 13:22:08 +04:00
|
|
|
mAnimVal = mBaseVal = aValue;
|
|
|
|
mAttrEnum = aAttrEnum;
|
2011-10-17 18:59:28 +04:00
|
|
|
mIsAnimated = false;
|
2007-09-26 13:22:08 +04:00
|
|
|
}
|
|
|
|
|
2012-02-16 03:40:45 +04:00
|
|
|
nsresult SetBaseValueAtom(const nsIAtom* aValue, nsSVGElement *aSVGElement);
|
|
|
|
nsIAtom* GetBaseValueAtom() const;
|
2007-09-26 13:22:08 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetBaseValue(bool aValue, nsSVGElement *aSVGElement);
|
|
|
|
bool GetBaseValue() const
|
2007-09-26 13:22:08 +04:00
|
|
|
{ return mBaseVal; }
|
2010-01-24 19:42:08 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetAnimValue(bool aValue, nsSVGElement *aSVGElement);
|
|
|
|
bool GetAnimValue() const
|
2010-02-25 21:20:43 +03:00
|
|
|
{ return mAnimVal; }
|
2007-09-26 13:22:08 +04:00
|
|
|
|
2013-03-25 10:26:06 +04:00
|
|
|
already_AddRefed<mozilla::dom::SVGAnimatedBoolean>
|
|
|
|
ToDOMAnimatedBoolean(nsSVGElement* aSVGElement);
|
2010-01-24 19:42:08 +03:00
|
|
|
// Returns a new nsISMILAttr object that the caller must delete
|
|
|
|
nsISMILAttr* ToSMILAttr(nsSVGElement* aSVGElement);
|
2007-09-26 13:22:08 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mAnimVal;
|
|
|
|
bool mBaseVal;
|
|
|
|
bool mIsAnimated;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mAttrEnum; // element specified tracking for attribute
|
2007-09-26 13:22:08 +04:00
|
|
|
|
2010-01-12 16:08:43 +03:00
|
|
|
public:
|
2010-01-24 19:42:08 +03:00
|
|
|
struct SMILBool : public nsISMILAttr
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SMILBool(nsSVGBoolean* aVal, nsSVGElement* aSVGElement)
|
|
|
|
: mVal(aVal), mSVGElement(aSVGElement) {}
|
2012-12-23 08:54:22 +04:00
|
|
|
|
2010-01-24 19:42:08 +03: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-23 08:54:22 +04:00
|
|
|
|
2010-01-24 19:42:08 +03:00
|
|
|
// nsISMILAttr methods
|
|
|
|
virtual nsresult ValueFromString(const nsAString& aStr,
|
2013-03-19 07:18:45 +04:00
|
|
|
const mozilla::dom::SVGAnimationElement* aSrcElement,
|
2010-02-21 00:13:11 +03:00
|
|
|
nsSMILValue& aValue,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool& aPreventCachingOfSandwich) const override;
|
|
|
|
virtual nsSMILValue GetBaseValue() const override;
|
|
|
|
virtual void ClearAnimValue() override;
|
|
|
|
virtual nsresult SetAnimValue(const nsSMILValue& aValue) override;
|
2010-01-24 19:42:08 +03:00
|
|
|
};
|
2007-09-26 13:22:08 +04:00
|
|
|
};
|
|
|
|
#endif //__NS_SVGBOOLEAN_H__
|