2011-01-23 17:08:17 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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/. */
|
2011-01-23 17:08:17 +00:00
|
|
|
|
|
|
|
#ifndef __NS_SVGCLASS_H__
|
|
|
|
#define __NS_SVGCLASS_H__
|
|
|
|
|
2011-10-18 12:43:57 +00:00
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2012-07-27 14:03:27 +00:00
|
|
|
#include "nsError.h"
|
2011-11-01 19:22:30 +00:00
|
|
|
#include "nsISMILAttr.h"
|
2012-01-26 09:57:21 +00:00
|
|
|
#include "nsString.h"
|
2012-06-19 02:30:09 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2011-11-01 19:22:30 +00:00
|
|
|
|
2012-12-23 08:22:22 +00:00
|
|
|
class nsSVGElement;
|
2011-10-18 12:43:57 +00:00
|
|
|
|
2013-06-14 22:37:27 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class SVGAnimatedString;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-23 17:08:17 +00:00
|
|
|
class nsSVGClass
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
void Init() {
|
2012-07-30 14:20:58 +00:00
|
|
|
mAnimVal = nullptr;
|
2011-01-23 17:08:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SetBaseValue(const nsAString& aValue,
|
2012-12-23 08:22:22 +00:00
|
|
|
nsSVGElement *aSVGElement,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aDoSetAttr);
|
2012-12-23 08:22:22 +00:00
|
|
|
void GetBaseValue(nsAString& aValue, const nsSVGElement *aSVGElement) const;
|
2011-01-23 17:08:17 +00:00
|
|
|
|
2012-12-23 08:22:22 +00:00
|
|
|
void SetAnimValue(const nsAString& aValue, nsSVGElement *aSVGElement);
|
|
|
|
void GetAnimValue(nsAString& aValue, const nsSVGElement *aSVGElement) const;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool IsAnimated() const
|
2011-01-23 17:08:17 +00:00
|
|
|
{ return !!mAnimVal; }
|
|
|
|
|
2013-06-14 22:37:27 +00:00
|
|
|
already_AddRefed<mozilla::dom::SVGAnimatedString>
|
|
|
|
ToDOMAnimatedString(nsSVGElement* aSVGElement);
|
2013-02-07 08:08:56 +00:00
|
|
|
|
2011-01-23 17:08:17 +00:00
|
|
|
// Returns a new nsISMILAttr object that the caller must delete
|
2012-12-23 08:22:22 +00:00
|
|
|
nsISMILAttr* ToSMILAttr(nsSVGElement *aSVGElement);
|
2011-01-23 17:08:17 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
nsAutoPtr<nsString> mAnimVal;
|
|
|
|
|
|
|
|
public:
|
|
|
|
struct SMILString : public nsISMILAttr
|
|
|
|
{
|
|
|
|
public:
|
2012-12-23 08:22:22 +00:00
|
|
|
SMILString(nsSVGClass *aVal, nsSVGElement *aSVGElement)
|
2011-01-23 17:08:17 +00:00
|
|
|
: mVal(aVal), mSVGElement(aSVGElement) {}
|
|
|
|
|
|
|
|
// 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.
|
|
|
|
nsSVGClass* mVal;
|
2012-12-23 08:22:22 +00:00
|
|
|
nsSVGElement* mSVGElement;
|
2011-01-23 17:08:17 +00:00
|
|
|
|
|
|
|
// nsISMILAttr methods
|
|
|
|
virtual nsresult ValueFromString(const nsAString& aStr,
|
2013-03-19 03:18:45 +00:00
|
|
|
const mozilla::dom::SVGAnimationElement *aSrcElement,
|
2011-01-23 17:08:17 +00:00
|
|
|
nsSMILValue& aValue,
|
2013-05-29 20:43:41 +00: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;
|
2011-01-23 17:08:17 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
#endif //__NS_SVGCLASS_H__
|