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