2015-05-03 22:32:37 +03: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 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/. */
|
2011-01-23 20:08:17 +03:00
|
|
|
|
|
|
|
#ifndef __NS_SVGCLASS_H__
|
|
|
|
#define __NS_SVGCLASS_H__
|
|
|
|
|
2011-10-18 16:43:57 +04:00
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2012-07-27 18:03:27 +04:00
|
|
|
#include "nsError.h"
|
2011-11-01 23:22:30 +04:00
|
|
|
#include "nsISMILAttr.h"
|
2012-01-26 13:57:21 +04:00
|
|
|
#include "nsString.h"
|
2012-06-19 06:30:09 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2017-03-30 07:10:07 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2011-11-01 23:22:30 +04:00
|
|
|
|
2012-12-23 12:22:22 +04:00
|
|
|
class nsSVGElement;
|
2011-10-18 16:43:57 +04:00
|
|
|
|
2013-06-15 02:37:27 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class SVGAnimatedString;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2013-06-15 02:37:27 +04:00
|
|
|
|
2011-01-23 20:08:17 +03:00
|
|
|
class nsSVGClass
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
void Init() {
|
2012-07-30 18:20:58 +04:00
|
|
|
mAnimVal = nullptr;
|
2011-01-23 20:08:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void SetBaseValue(const nsAString& aValue,
|
2012-12-23 12:22:22 +04:00
|
|
|
nsSVGElement *aSVGElement,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aDoSetAttr);
|
2012-12-23 12:22:22 +04:00
|
|
|
void GetBaseValue(nsAString& aValue, const nsSVGElement *aSVGElement) const;
|
2011-01-23 20:08:17 +03:00
|
|
|
|
2012-12-23 12:22:22 +04:00
|
|
|
void SetAnimValue(const nsAString& aValue, nsSVGElement *aSVGElement);
|
|
|
|
void GetAnimValue(nsAString& aValue, const nsSVGElement *aSVGElement) const;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsAnimated() const
|
2011-01-23 20:08:17 +03:00
|
|
|
{ return !!mAnimVal; }
|
|
|
|
|
2013-06-15 02:37:27 +04:00
|
|
|
already_AddRefed<mozilla::dom::SVGAnimatedString>
|
|
|
|
ToDOMAnimatedString(nsSVGElement* aSVGElement);
|
2013-02-07 12:08:56 +04:00
|
|
|
|
2017-03-30 07:10:07 +03:00
|
|
|
mozilla::UniquePtr<nsISMILAttr> ToSMILAttr(nsSVGElement *aSVGElement);
|
2011-01-23 20:08:17 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
nsAutoPtr<nsString> mAnimVal;
|
|
|
|
|
|
|
|
public:
|
|
|
|
struct SMILString : public nsISMILAttr
|
|
|
|
{
|
|
|
|
public:
|
2012-12-23 12:22:22 +04:00
|
|
|
SMILString(nsSVGClass *aVal, nsSVGElement *aSVGElement)
|
2011-01-23 20:08:17 +03: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 12:22:22 +04:00
|
|
|
nsSVGElement* mSVGElement;
|
2011-01-23 20:08:17 +03:00
|
|
|
|
|
|
|
// nsISMILAttr methods
|
|
|
|
virtual nsresult ValueFromString(const nsAString& aStr,
|
2013-03-19 07:18:45 +04:00
|
|
|
const mozilla::dom::SVGAnimationElement *aSrcElement,
|
2011-01-23 20:08:17 +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;
|
2011-01-23 20:08:17 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
#endif //__NS_SVGCLASS_H__
|