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__
|
|
|
|
|
2012-01-26 09:57:21 +00:00
|
|
|
#include "nsError.h"
|
2019-01-25 03:24:01 +00:00
|
|
|
#include "mozilla/SMILAttr.h"
|
2019-01-24 23:40:25 +00:00
|
|
|
#include "mozilla/AlreadyAddRefed.h"
|
2012-06-19 02:30:09 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2017-03-30 04:10:07 +00:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2012-01-26 09:57:21 +00:00
|
|
|
|
2017-10-02 22:05:19 +00:00
|
|
|
class nsAtom;
|
2007-09-26 09:22:08 +00:00
|
|
|
|
2013-03-19 03:18:45 +00:00
|
|
|
namespace mozilla {
|
2019-01-23 13:48:08 +00:00
|
|
|
|
|
|
|
class SMILValue;
|
|
|
|
|
2013-03-19 03:18:45 +00:00
|
|
|
namespace dom {
|
2019-03-19 00:01:03 +00:00
|
|
|
class DOMSVGAnimatedBoolean;
|
2013-03-19 03:18:45 +00:00
|
|
|
class SVGAnimationElement;
|
2018-12-21 08:58:14 +00:00
|
|
|
class SVGElement;
|
2018-11-30 10:46:48 +00:00
|
|
|
} // namespace dom
|
2013-03-19 03:18:45 +00:00
|
|
|
|
2019-04-04 17:40:56 +00:00
|
|
|
class SVGAnimatedBoolean {
|
2018-11-30 10:46:48 +00:00
|
|
|
public:
|
2018-12-21 08:58:14 +00:00
|
|
|
typedef mozilla::dom::SVGElement SVGElement;
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2018-12-21 08:58:14 +00:00
|
|
|
nsresult SetBaseValueAtom(const nsAtom* aValue, SVGElement* aSVGElement);
|
2017-10-02 22:05:19 +00:00
|
|
|
nsAtom* GetBaseValueAtom() const;
|
2007-09-26 09:22:08 +00:00
|
|
|
|
2018-12-21 08:58:14 +00:00
|
|
|
void SetBaseValue(bool aValue, SVGElement* aSVGElement);
|
2018-11-30 10:46:48 +00:00
|
|
|
bool GetBaseValue() const { return mBaseVal; }
|
2010-01-24 16:42:08 +00:00
|
|
|
|
2018-12-21 08:58:14 +00:00
|
|
|
void SetAnimValue(bool aValue, SVGElement* aSVGElement);
|
2018-11-30 10:46:48 +00:00
|
|
|
bool GetAnimValue() const { return mAnimVal; }
|
2007-09-26 09:22:08 +00:00
|
|
|
|
2019-03-19 00:01:03 +00:00
|
|
|
already_AddRefed<mozilla::dom::DOMSVGAnimatedBoolean> ToDOMAnimatedBoolean(
|
2018-12-21 08:58:14 +00:00
|
|
|
SVGElement* aSVGElement);
|
2019-09-21 14:38:56 +00:00
|
|
|
UniquePtr<SMILAttr> ToSMILAttr(SVGElement* aSVGElement);
|
2007-09-26 09:22:08 +00:00
|
|
|
|
2018-11-30 10:46:48 +00:00
|
|
|
private:
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mAnimVal;
|
|
|
|
bool mBaseVal;
|
|
|
|
bool mIsAnimated;
|
2018-11-30 10:46:48 +00:00
|
|
|
uint8_t mAttrEnum; // element specified tracking for attribute
|
2007-09-26 09:22:08 +00:00
|
|
|
|
2018-11-30 10:46:48 +00:00
|
|
|
public:
|
2019-01-25 03:24:01 +00:00
|
|
|
struct SMILBool : public SMILAttr {
|
2018-11-30 10:46:48 +00:00
|
|
|
public:
|
2019-04-04 17:40:56 +00:00
|
|
|
SMILBool(SVGAnimatedBoolean* aVal, SVGElement* aSVGElement)
|
2018-11-30 10:46:48 +00:00
|
|
|
: mVal(aVal), mSVGElement(aSVGElement) {}
|
2012-12-23 04:54:22 +00:00
|
|
|
|
2019-01-25 03:24:01 +00:00
|
|
|
// These will stay alive because a SMILAttr only lives as long
|
2010-01-24 16:42:08 +00:00
|
|
|
// as the Compositing step, and DOM elements don't get a chance to
|
|
|
|
// die during that.
|
2019-04-04 17:40:56 +00:00
|
|
|
SVGAnimatedBoolean* mVal;
|
2018-12-21 08:58:14 +00:00
|
|
|
SVGElement* mSVGElement;
|
2012-12-23 04:54:22 +00:00
|
|
|
|
2019-01-25 03:24:01 +00:00
|
|
|
// SMILAttr methods
|
2018-11-30 10:46:48 +00:00
|
|
|
virtual nsresult ValueFromString(
|
2019-09-21 14:38:56 +00:00
|
|
|
const nsAString& aStr, const dom::SVGAnimationElement* aSrcElement,
|
|
|
|
SMILValue& aValue, bool& aPreventCachingOfSandwich) const override;
|
2019-01-23 13:48:08 +00:00
|
|
|
virtual SMILValue GetBaseValue() const override;
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void ClearAnimValue() override;
|
2019-01-23 13:48:08 +00:00
|
|
|
virtual nsresult SetAnimValue(const SMILValue& aValue) override;
|
2010-01-24 16:42:08 +00:00
|
|
|
};
|
2007-09-26 09:22:08 +00:00
|
|
|
};
|
2019-01-07 19:23:13 +00:00
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2018-11-30 10:46:48 +00:00
|
|
|
#endif //__NS_SVGBOOLEAN_H__
|