2001-12-12 07:59:31 +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/. */
|
2001-12-12 07:59:31 +00:00
|
|
|
|
|
|
|
#ifndef __NS_SVGELEMENT_H__
|
|
|
|
#define __NS_SVGELEMENT_H__
|
|
|
|
|
|
|
|
/*
|
|
|
|
nsSVGElement is the base class for all SVG content elements.
|
|
|
|
It implements all the common DOM interfaces and handles attributes.
|
|
|
|
*/
|
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-01-26 09:57:21 +00:00
|
|
|
#include "mozilla/css/StyleRule.h"
|
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsChangeHint.h"
|
2001-12-12 07:59:31 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2012-01-26 09:57:21 +00:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsError.h"
|
2013-09-20 10:21:03 +00:00
|
|
|
#include "mozilla/dom/DOMRect.h"
|
2013-10-02 20:09:18 +00:00
|
|
|
#include "mozilla/dom/ElementInlines.h"
|
2012-01-26 09:57:21 +00:00
|
|
|
#include "nsISupportsImpl.h"
|
2007-08-06 15:27:19 +00:00
|
|
|
#include "nsStyledElement.h"
|
2012-12-23 08:22:22 +00:00
|
|
|
#include "nsSVGClass.h"
|
2013-02-02 20:22:35 +00:00
|
|
|
#include "nsIDOMSVGElement.h"
|
2009-01-15 04:38:07 +00:00
|
|
|
|
2007-10-10 10:07:59 +00:00
|
|
|
class nsSVGAngle;
|
2007-09-26 09:22:08 +00:00
|
|
|
class nsSVGBoolean;
|
2007-08-27 23:11:14 +00:00
|
|
|
class nsSVGEnum;
|
2012-01-26 09:57:21 +00:00
|
|
|
class nsSVGInteger;
|
|
|
|
class nsSVGIntegerPair;
|
|
|
|
class nsSVGLength2;
|
|
|
|
class nsSVGNumber2;
|
|
|
|
class nsSVGNumberPair;
|
2014-10-04 11:13:30 +00:00
|
|
|
class nsSVGPathGeometryElement;
|
2008-06-14 09:01:02 +00:00
|
|
|
class nsSVGString;
|
2012-01-26 09:57:21 +00:00
|
|
|
class nsSVGViewBox;
|
|
|
|
|
2010-07-16 21:42:12 +00:00
|
|
|
namespace mozilla {
|
2012-12-23 08:22:58 +00:00
|
|
|
namespace dom {
|
|
|
|
class CSSValue;
|
2013-01-09 23:02:45 +00:00
|
|
|
class SVGSVGElement;
|
2013-02-18 02:14:02 +00:00
|
|
|
|
|
|
|
static const unsigned short SVG_UNIT_TYPE_UNKNOWN = 0;
|
|
|
|
static const unsigned short SVG_UNIT_TYPE_USERSPACEONUSE = 1;
|
|
|
|
static const unsigned short SVG_UNIT_TYPE_OBJECTBOUNDINGBOX = 2;
|
|
|
|
|
2012-12-23 08:22:58 +00:00
|
|
|
}
|
|
|
|
|
2010-12-03 16:40:23 +00:00
|
|
|
class SVGAnimatedNumberList;
|
|
|
|
class SVGNumberList;
|
2010-07-16 21:42:12 +00:00
|
|
|
class SVGAnimatedLengthList;
|
|
|
|
class SVGUserUnitList;
|
2010-12-08 12:15:53 +00:00
|
|
|
class SVGAnimatedPointList;
|
2010-11-08 15:07:00 +00:00
|
|
|
class SVGAnimatedPathSegList;
|
2010-12-20 00:45:29 +00:00
|
|
|
class SVGAnimatedPreserveAspectRatio;
|
2013-04-14 22:56:34 +00:00
|
|
|
class nsSVGAnimatedTransformList;
|
2011-12-31 09:44:03 +00:00
|
|
|
class SVGStringList;
|
|
|
|
class DOMSVGStringList;
|
2013-12-28 21:37:40 +00:00
|
|
|
|
|
|
|
namespace gfx {
|
|
|
|
class Matrix;
|
|
|
|
}
|
|
|
|
|
2010-07-16 21:42:12 +00:00
|
|
|
}
|
|
|
|
|
2014-06-25 11:59:46 +00:00
|
|
|
class gfxMatrix;
|
2012-01-26 09:57:21 +00:00
|
|
|
struct nsSVGEnumMapping;
|
|
|
|
|
2011-04-08 05:27:57 +00:00
|
|
|
typedef nsStyledElementNotElementCSSInlineStyle nsSVGElementBase;
|
2007-08-06 15:27:19 +00:00
|
|
|
|
2011-09-30 09:25:34 +00:00
|
|
|
class nsSVGElement : public nsSVGElementBase // nsIContent
|
2013-03-28 01:23:09 +00:00
|
|
|
, public nsIDOMSVGElement
|
2001-12-12 07:59:31 +00:00
|
|
|
{
|
|
|
|
protected:
|
2014-08-08 13:49:39 +00:00
|
|
|
explicit nsSVGElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
2013-12-03 14:40:11 +00:00
|
|
|
friend nsresult NS_NewSVGElement(mozilla::dom::Element **aResult,
|
2014-06-20 02:01:40 +00:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
2006-04-14 15:09:39 +00:00
|
|
|
nsresult Init();
|
2011-09-30 09:25:34 +00:00
|
|
|
virtual ~nsSVGElement(){}
|
2001-12-12 07:59:31 +00:00
|
|
|
|
|
|
|
public:
|
2013-03-28 01:23:10 +00:00
|
|
|
|
2014-06-20 02:01:40 +00:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_MUST_OVERRIDE MOZ_OVERRIDE;
|
2013-03-28 01:23:10 +00:00
|
|
|
|
2010-12-03 16:40:23 +00:00
|
|
|
typedef mozilla::SVGNumberList SVGNumberList;
|
|
|
|
typedef mozilla::SVGAnimatedNumberList SVGAnimatedNumberList;
|
2010-11-08 15:07:00 +00:00
|
|
|
typedef mozilla::SVGUserUnitList SVGUserUnitList;
|
|
|
|
typedef mozilla::SVGAnimatedLengthList SVGAnimatedLengthList;
|
2010-12-08 12:15:53 +00:00
|
|
|
typedef mozilla::SVGAnimatedPointList SVGAnimatedPointList;
|
2010-11-08 15:07:00 +00:00
|
|
|
typedef mozilla::SVGAnimatedPathSegList SVGAnimatedPathSegList;
|
2010-12-20 00:45:29 +00:00
|
|
|
typedef mozilla::SVGAnimatedPreserveAspectRatio SVGAnimatedPreserveAspectRatio;
|
2013-04-14 22:56:34 +00:00
|
|
|
typedef mozilla::nsSVGAnimatedTransformList nsSVGAnimatedTransformList;
|
2011-12-31 09:44:03 +00:00
|
|
|
typedef mozilla::SVGStringList SVGStringList;
|
2010-11-08 15:07:00 +00:00
|
|
|
|
2001-12-12 07:59:31 +00:00
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2012-12-23 08:22:22 +00:00
|
|
|
void DidAnimateClass();
|
|
|
|
|
2001-12-12 07:59:31 +00:00
|
|
|
// nsIContent interface methods
|
|
|
|
|
2008-01-01 10:51:40 +00:00
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2013-05-08 05:11:24 +00:00
|
|
|
bool aCompileEventHandlers) MOZ_OVERRIDE;
|
2008-01-01 10:51:40 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
2013-05-08 05:11:24 +00:00
|
|
|
bool aNotify) MOZ_OVERRIDE;
|
2006-07-28 18:10:48 +00:00
|
|
|
|
2008-08-05 12:01:47 +00:00
|
|
|
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
2013-05-08 05:11:24 +00:00
|
|
|
int32_t aModType) const MOZ_OVERRIDE;
|
2008-08-05 12:01:47 +00:00
|
|
|
|
2013-05-08 05:11:24 +00:00
|
|
|
virtual bool IsNodeOfType(uint32_t aFlags) const MOZ_OVERRIDE;
|
2006-07-28 18:10:48 +00:00
|
|
|
|
2013-05-08 05:11:24 +00:00
|
|
|
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) MOZ_OVERRIDE;
|
2014-09-13 13:17:35 +00:00
|
|
|
void WalkAnimatedContentStyleRules(nsRuleWalker* aRuleWalker);
|
2004-02-09 20:48:20 +00:00
|
|
|
|
2013-05-08 05:11:24 +00:00
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
|
2012-02-19 20:49:34 +00:00
|
|
|
|
2004-02-25 21:04:50 +00:00
|
|
|
static const MappedAttributeEntry sFillStrokeMap[];
|
|
|
|
static const MappedAttributeEntry sGraphicsMap[];
|
|
|
|
static const MappedAttributeEntry sTextContentElementsMap[];
|
|
|
|
static const MappedAttributeEntry sFontSpecificationMap[];
|
2004-10-14 23:02:53 +00:00
|
|
|
static const MappedAttributeEntry sGradientStopMap[];
|
2004-10-27 00:25:08 +00:00
|
|
|
static const MappedAttributeEntry sViewportsMap[];
|
2004-12-09 03:16:15 +00:00
|
|
|
static const MappedAttributeEntry sMarkersMap[];
|
2004-12-09 23:51:25 +00:00
|
|
|
static const MappedAttributeEntry sColorMap[];
|
2007-01-30 13:19:55 +00:00
|
|
|
static const MappedAttributeEntry sFiltersMap[];
|
2007-01-08 16:48:56 +00:00
|
|
|
static const MappedAttributeEntry sFEFloodMap[];
|
2007-07-26 06:57:42 +00:00
|
|
|
static const MappedAttributeEntry sLightingEffectsMap[];
|
2012-12-21 00:15:22 +00:00
|
|
|
static const MappedAttributeEntry sMaskMap[];
|
2007-07-26 06:57:42 +00:00
|
|
|
|
2013-03-28 01:23:09 +00:00
|
|
|
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
|
|
|
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
|
|
|
NS_DECL_NSIDOMSVGELEMENT
|
2001-12-12 07:59:31 +00:00
|
|
|
|
2008-01-25 20:51:13 +00:00
|
|
|
// Gets the element that establishes the rectangular viewport against which
|
|
|
|
// we should resolve percentage lengths (our "coordinate context"). Returns
|
2012-07-30 14:20:58 +00:00
|
|
|
// nullptr for outer <svg> or SVG without an <svg> parent (invalid SVG).
|
2013-01-09 23:02:45 +00:00
|
|
|
mozilla::dom::SVGSVGElement* GetCtx() const;
|
2006-04-14 15:09:39 +00:00
|
|
|
|
2012-02-17 08:12:47 +00:00
|
|
|
enum TransformTypes {
|
|
|
|
eAllTransforms
|
|
|
|
,eUserSpaceToParent
|
|
|
|
,eChildToUserSpace
|
|
|
|
};
|
2009-04-29 04:31:34 +00:00
|
|
|
/**
|
2012-02-17 08:12:47 +00:00
|
|
|
* Returns aMatrix pre-multiplied by (explicit or implicit) transforms that
|
|
|
|
* are introduced by attributes on this element.
|
|
|
|
*
|
|
|
|
* If aWhich is eAllTransforms, then all the transforms from the coordinate
|
|
|
|
* space established by this element for its children to the coordinate
|
|
|
|
* space established by this element's parent element for this element, are
|
|
|
|
* included.
|
|
|
|
*
|
|
|
|
* If aWhich is eUserSpaceToParent, then only the transforms from this
|
|
|
|
* element's userspace to the coordinate space established by its parent is
|
|
|
|
* included. This includes any transforms introduced by the 'transform'
|
|
|
|
* attribute, transform animations and animateMotion, but not any offsets
|
|
|
|
* due to e.g. 'x'/'y' attributes, or any transform due to a 'viewBox'
|
|
|
|
* attribute. (SVG userspace is defined to be the coordinate space in which
|
|
|
|
* coordinates on an element apply.)
|
|
|
|
*
|
|
|
|
* If aWhich is eChildToUserSpace, then only the transforms from the
|
|
|
|
* coordinate space established by this element for its childre to this
|
|
|
|
* elements userspace are included. This includes any offsets due to e.g.
|
|
|
|
* 'x'/'y' attributes, and any transform due to a 'viewBox' attribute, but
|
|
|
|
* does not include any transforms due to the 'transform' attribute.
|
2009-04-29 04:31:34 +00:00
|
|
|
*/
|
2013-12-26 20:13:57 +00:00
|
|
|
virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix,
|
2012-02-17 08:12:47 +00:00
|
|
|
TransformTypes aWhich = eAllTransforms) const;
|
2009-04-29 04:31:34 +00:00
|
|
|
|
2010-04-28 23:00:54 +00:00
|
|
|
// Setter for to set the current <animateMotion> transformation
|
|
|
|
// Only visible for nsSVGGraphicElement, so it's a no-op here, and that
|
|
|
|
// subclass has the useful implementation.
|
2013-12-28 21:37:40 +00:00
|
|
|
virtual void SetAnimateMotionTransform(const mozilla::gfx::Matrix* aMatrix) {/*no-op*/}
|
|
|
|
virtual const mozilla::gfx::Matrix* GetAnimateMotionTransform() const { return nullptr; }
|
2010-04-28 23:00:54 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
bool IsStringAnimatable(uint8_t aAttrEnum) {
|
2010-10-07 19:19:32 +00:00
|
|
|
return GetStringInfo().mStringInfo[aAttrEnum].mIsAnimatable;
|
|
|
|
}
|
2012-08-22 15:56:38 +00:00
|
|
|
bool NumberAttrAllowsPercentage(uint8_t aAttrEnum) {
|
2010-12-05 20:33:31 +00:00
|
|
|
return GetNumberInfo().mNumberInfo[aAttrEnum].mPercentagesAllowed;
|
|
|
|
}
|
2012-03-03 09:21:09 +00:00
|
|
|
virtual bool HasValidDimensions() const {
|
|
|
|
return true;
|
|
|
|
}
|
2011-06-20 20:15:42 +00:00
|
|
|
void SetLength(nsIAtom* aName, const nsSVGLength2 &aLength);
|
2012-02-15 23:40:45 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
nsAttrValue WillChangeLength(uint8_t aAttrEnum);
|
|
|
|
nsAttrValue WillChangeNumberPair(uint8_t aAttrEnum);
|
|
|
|
nsAttrValue WillChangeIntegerPair(uint8_t aAttrEnum);
|
|
|
|
nsAttrValue WillChangeAngle(uint8_t aAttrEnum);
|
2012-02-15 23:40:46 +00:00
|
|
|
nsAttrValue WillChangeViewBox();
|
2012-02-15 23:40:46 +00:00
|
|
|
nsAttrValue WillChangePreserveAspectRatio();
|
2012-08-22 15:56:38 +00:00
|
|
|
nsAttrValue WillChangeNumberList(uint8_t aAttrEnum);
|
|
|
|
nsAttrValue WillChangeLengthList(uint8_t aAttrEnum);
|
2012-02-15 23:40:46 +00:00
|
|
|
nsAttrValue WillChangePointList();
|
2012-02-15 23:40:46 +00:00
|
|
|
nsAttrValue WillChangePathSegList();
|
2012-02-15 23:40:46 +00:00
|
|
|
nsAttrValue WillChangeTransformList();
|
2012-02-15 23:40:46 +00:00
|
|
|
nsAttrValue WillChangeStringList(bool aIsConditionalProcessingAttribute,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t aAttrEnum);
|
2012-02-15 23:40:45 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
void DidChangeLength(uint8_t aAttrEnum, const nsAttrValue& aEmptyOrOldValue);
|
|
|
|
void DidChangeNumber(uint8_t aAttrEnum);
|
|
|
|
void DidChangeNumberPair(uint8_t aAttrEnum,
|
2012-02-15 23:40:45 +00:00
|
|
|
const nsAttrValue& aEmptyOrOldValue);
|
2012-08-22 15:56:38 +00:00
|
|
|
void DidChangeInteger(uint8_t aAttrEnum);
|
|
|
|
void DidChangeIntegerPair(uint8_t aAttrEnum,
|
2012-02-15 23:40:45 +00:00
|
|
|
const nsAttrValue& aEmptyOrOldValue);
|
2012-08-22 15:56:38 +00:00
|
|
|
void DidChangeAngle(uint8_t aAttrEnum, const nsAttrValue& aEmptyOrOldValue);
|
|
|
|
void DidChangeBoolean(uint8_t aAttrEnum);
|
|
|
|
void DidChangeEnum(uint8_t aAttrEnum);
|
2012-02-15 23:40:46 +00:00
|
|
|
void DidChangeViewBox(const nsAttrValue& aEmptyOrOldValue);
|
2012-02-15 23:40:46 +00:00
|
|
|
void DidChangePreserveAspectRatio(const nsAttrValue& aEmptyOrOldValue);
|
2012-08-22 15:56:38 +00:00
|
|
|
void DidChangeNumberList(uint8_t aAttrEnum,
|
2012-02-15 23:40:46 +00:00
|
|
|
const nsAttrValue& aEmptyOrOldValue);
|
2012-08-22 15:56:38 +00:00
|
|
|
void DidChangeLengthList(uint8_t aAttrEnum,
|
2012-02-15 23:40:45 +00:00
|
|
|
const nsAttrValue& aEmptyOrOldValue);
|
2012-02-15 23:40:46 +00:00
|
|
|
void DidChangePointList(const nsAttrValue& aEmptyOrOldValue);
|
2012-02-15 23:40:46 +00:00
|
|
|
void DidChangePathSegList(const nsAttrValue& aEmptyOrOldValue);
|
2012-02-15 23:40:46 +00:00
|
|
|
void DidChangeTransformList(const nsAttrValue& aEmptyOrOldValue);
|
2012-08-22 15:56:38 +00:00
|
|
|
void DidChangeString(uint8_t aAttrEnum) {}
|
2011-12-31 09:44:03 +00:00
|
|
|
void DidChangeStringList(bool aIsConditionalProcessingAttribute,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t aAttrEnum,
|
2012-02-15 23:40:46 +00:00
|
|
|
const nsAttrValue& aEmptyOrOldValue);
|
2006-04-14 15:09:39 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
void DidAnimateLength(uint8_t aAttrEnum);
|
|
|
|
void DidAnimateNumber(uint8_t aAttrEnum);
|
|
|
|
void DidAnimateNumberPair(uint8_t aAttrEnum);
|
|
|
|
void DidAnimateInteger(uint8_t aAttrEnum);
|
|
|
|
void DidAnimateIntegerPair(uint8_t aAttrEnum);
|
|
|
|
void DidAnimateAngle(uint8_t aAttrEnum);
|
|
|
|
void DidAnimateBoolean(uint8_t aAttrEnum);
|
|
|
|
void DidAnimateEnum(uint8_t aAttrEnum);
|
2012-02-19 09:04:06 +00:00
|
|
|
void DidAnimateViewBox();
|
|
|
|
void DidAnimatePreserveAspectRatio();
|
2012-08-22 15:56:38 +00:00
|
|
|
void DidAnimateNumberList(uint8_t aAttrEnum);
|
|
|
|
void DidAnimateLengthList(uint8_t aAttrEnum);
|
2012-02-19 09:04:06 +00:00
|
|
|
void DidAnimatePointList();
|
|
|
|
void DidAnimatePathSegList();
|
2014-04-07 19:52:12 +00:00
|
|
|
void DidAnimateTransformList(int32_t aModType);
|
2012-08-22 15:56:38 +00:00
|
|
|
void DidAnimateString(uint8_t aAttrEnum);
|
2009-01-15 04:38:07 +00:00
|
|
|
|
2012-07-30 00:35:26 +00:00
|
|
|
enum {
|
|
|
|
/**
|
|
|
|
* Flag to indicate to GetAnimatedXxx() methods that the object being
|
|
|
|
* requested should be allocated if it hasn't already been allocated, and
|
|
|
|
* that the method should not return null. Only applicable to methods that
|
|
|
|
* need to allocate the object that they return.
|
|
|
|
*/
|
|
|
|
DO_ALLOCATE = 0x1
|
|
|
|
};
|
|
|
|
|
2011-12-27 10:27:42 +00:00
|
|
|
nsSVGLength2* GetAnimatedLength(const nsIAtom *aAttrName);
|
2006-04-14 15:09:39 +00:00
|
|
|
void GetAnimatedLengthValues(float *aFirst, ...);
|
2006-07-28 18:10:48 +00:00
|
|
|
void GetAnimatedNumberValues(float *aFirst, ...);
|
2012-08-22 15:56:38 +00:00
|
|
|
void GetAnimatedIntegerValues(int32_t *aFirst, ...);
|
|
|
|
SVGAnimatedNumberList* GetAnimatedNumberList(uint8_t aAttrEnum);
|
2010-12-03 16:40:23 +00:00
|
|
|
SVGAnimatedNumberList* GetAnimatedNumberList(nsIAtom *aAttrName);
|
2010-11-08 15:07:00 +00:00
|
|
|
void GetAnimatedLengthListValues(SVGUserUnitList *aFirst, ...);
|
2012-08-22 15:56:38 +00:00
|
|
|
SVGAnimatedLengthList* GetAnimatedLengthList(uint8_t aAttrEnum);
|
2010-12-08 12:15:53 +00:00
|
|
|
virtual SVGAnimatedPointList* GetAnimatedPointList() {
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2010-12-08 12:15:53 +00:00
|
|
|
}
|
2010-11-08 15:07:00 +00:00
|
|
|
virtual SVGAnimatedPathSegList* GetAnimPathSegList() {
|
|
|
|
// DOM interface 'SVGAnimatedPathData' (*inherited* by nsSVGPathElement)
|
|
|
|
// has a member called 'animatedPathSegList' member, so we have a shorter
|
|
|
|
// name so we don't get hidden by the GetAnimatedPathSegList declared by
|
|
|
|
// NS_DECL_NSIDOMSVGANIMATEDPATHDATA.
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2010-11-08 15:07:00 +00:00
|
|
|
}
|
2012-07-30 00:35:26 +00:00
|
|
|
/**
|
2013-04-14 22:56:34 +00:00
|
|
|
* Get the nsSVGAnimatedTransformList for this element.
|
2012-07-30 00:35:26 +00:00
|
|
|
*
|
|
|
|
* Despite the fact that animated transform lists are used for a variety of
|
|
|
|
* attributes, no SVG element uses more than one.
|
|
|
|
*
|
|
|
|
* It's relatively uncommon for elements to have their transform attribute
|
2013-04-14 22:56:34 +00:00
|
|
|
* set, so to save memory the nsSVGAnimatedTransformList is not allocated until
|
2012-07-30 00:35:26 +00:00
|
|
|
* the attribute is set/animated or its DOM wrapper is created. Callers that
|
2013-04-14 22:56:34 +00:00
|
|
|
* require the nsSVGAnimatedTransformList to be allocated and for this method
|
2012-07-30 00:35:26 +00:00
|
|
|
* to return non-null must pass the DO_ALLOCATE flag.
|
|
|
|
*/
|
2013-04-14 22:56:34 +00:00
|
|
|
virtual nsSVGAnimatedTransformList* GetAnimatedTransformList(
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aFlags = 0) {
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2011-09-25 21:04:31 +00:00
|
|
|
}
|
2006-07-28 18:10:48 +00:00
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
virtual nsISMILAttr* GetAnimatedAttr(int32_t aNamespaceID, nsIAtom* aName) MOZ_OVERRIDE;
|
2009-01-22 01:00:27 +00:00
|
|
|
void AnimationNeedsResample();
|
|
|
|
void FlushAnimations();
|
2009-01-15 04:38:07 +00:00
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
virtual void RecompileScriptEventListeners() MOZ_OVERRIDE;
|
2006-10-07 10:27:45 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
void GetStringBaseValue(uint8_t aAttrEnum, nsAString& aResult) const;
|
|
|
|
void SetStringBaseValue(uint8_t aAttrEnum, const nsAString& aValue);
|
2009-01-22 00:56:51 +00:00
|
|
|
|
2010-12-08 12:15:53 +00:00
|
|
|
virtual nsIAtom* GetPointListAttrName() const {
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2010-12-08 12:15:53 +00:00
|
|
|
}
|
2010-11-08 15:07:00 +00:00
|
|
|
virtual nsIAtom* GetPathDataAttrName() const {
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2010-11-08 15:07:00 +00:00
|
|
|
}
|
2011-09-25 21:04:31 +00:00
|
|
|
virtual nsIAtom* GetTransformListAttrName() const {
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2011-09-25 21:04:31 +00:00
|
|
|
}
|
2014-05-30 07:36:53 +00:00
|
|
|
const nsAttrValue* GetAnimatedClassName() const
|
|
|
|
{
|
|
|
|
if (!mClassAttribute.IsAnimated()) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return mClassAnimAttr;
|
|
|
|
}
|
2010-11-08 15:07:00 +00:00
|
|
|
|
2014-10-04 11:13:30 +00:00
|
|
|
virtual void ClearAnyCachedPath() {}
|
2013-05-29 20:43:41 +00:00
|
|
|
virtual nsIDOMNode* AsDOMNode() MOZ_FINAL MOZ_OVERRIDE { return this; }
|
2013-03-28 01:23:09 +00:00
|
|
|
virtual bool IsTransformable() { return false; }
|
|
|
|
|
2012-12-23 08:22:58 +00:00
|
|
|
// WebIDL
|
2013-08-07 17:40:52 +00:00
|
|
|
mozilla::dom::SVGSVGElement* GetOwnerSVGElement();
|
2013-01-06 06:25:55 +00:00
|
|
|
nsSVGElement* GetViewportElement();
|
2013-06-14 22:37:27 +00:00
|
|
|
already_AddRefed<mozilla::dom::SVGAnimatedString> ClassName();
|
2001-12-12 07:59:31 +00:00
|
|
|
protected:
|
2014-04-08 22:27:17 +00:00
|
|
|
virtual JSObject* WrapNode(JSContext *cx) MOZ_OVERRIDE;
|
2012-12-23 08:22:58 +00:00
|
|
|
|
2012-02-15 23:40:45 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
// We define BeforeSetAttr here and mark it MOZ_FINAL to ensure it is NOT used
|
|
|
|
// by SVG elements.
|
|
|
|
// This is because we're not currently passing the correct value for aValue to
|
|
|
|
// BeforeSetAttr since it would involve allocating extra SVG value types.
|
|
|
|
// See the comment in nsSVGElement::WillChangeValue.
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual nsresult BeforeSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
2012-02-15 23:40:45 +00:00
|
|
|
const nsAttrValueOrString* aValue,
|
2013-05-08 05:11:24 +00:00
|
|
|
bool aNotify) MOZ_OVERRIDE MOZ_FINAL { return NS_OK; }
|
2012-02-15 23:40:45 +00:00
|
|
|
#endif // DEBUG
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
2013-05-08 05:11:24 +00:00
|
|
|
const nsAttrValue* aValue, bool aNotify) MOZ_OVERRIDE;
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
|
2013-05-08 05:11:24 +00:00
|
|
|
const nsAString& aValue, nsAttrValue& aResult) MOZ_OVERRIDE;
|
2009-01-15 04:38:07 +00:00
|
|
|
static nsresult ReportAttributeParseFailure(nsIDocument* aDocument,
|
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue);
|
2005-10-28 02:59:38 +00:00
|
|
|
|
2004-03-09 08:44:53 +00:00
|
|
|
void UpdateContentStyleRule();
|
2010-03-16 23:17:33 +00:00
|
|
|
void UpdateAnimatedContentStyleRule();
|
2011-03-11 02:48:57 +00:00
|
|
|
mozilla::css::StyleRule* GetAnimatedContentStyleRule();
|
2010-03-16 23:17:33 +00:00
|
|
|
|
2012-02-15 23:40:45 +00:00
|
|
|
nsAttrValue WillChangeValue(nsIAtom* aName);
|
|
|
|
void DidChangeValue(nsIAtom* aName, const nsAttrValue& aEmptyOrOldValue,
|
|
|
|
nsAttrValue& aNewValue);
|
|
|
|
void MaybeSerializeAttrBeforeRemoval(nsIAtom* aName, bool aNotify);
|
|
|
|
|
2005-08-25 21:57:31 +00:00
|
|
|
static nsIAtom* GetEventNameForAttr(nsIAtom* aAttr);
|
2004-07-22 16:38:05 +00:00
|
|
|
|
2006-04-14 15:09:39 +00:00
|
|
|
struct LengthInfo {
|
|
|
|
nsIAtom** mName;
|
|
|
|
float mDefaultValue;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t mDefaultUnitType;
|
|
|
|
uint8_t mCtxType;
|
2006-04-14 15:09:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct LengthAttributesInfo {
|
|
|
|
nsSVGLength2* mLengths;
|
|
|
|
LengthInfo* mLengthInfo;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mLengthCount;
|
2006-04-14 15:09:39 +00:00
|
|
|
|
|
|
|
LengthAttributesInfo(nsSVGLength2 *aLengths,
|
|
|
|
LengthInfo *aLengthInfo,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aLengthCount) :
|
2006-04-14 15:09:39 +00:00
|
|
|
mLengths(aLengths), mLengthInfo(aLengthInfo), mLengthCount(aLengthCount)
|
|
|
|
{}
|
2007-11-22 08:54:31 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2006-04-14 15:09:39 +00:00
|
|
|
};
|
|
|
|
|
2006-07-28 18:10:48 +00:00
|
|
|
struct NumberInfo {
|
|
|
|
nsIAtom** mName;
|
|
|
|
float mDefaultValue;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mPercentagesAllowed;
|
2006-07-28 18:10:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct NumberAttributesInfo {
|
|
|
|
nsSVGNumber2* mNumbers;
|
|
|
|
NumberInfo* mNumberInfo;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mNumberCount;
|
2006-07-28 18:10:48 +00:00
|
|
|
|
|
|
|
NumberAttributesInfo(nsSVGNumber2 *aNumbers,
|
|
|
|
NumberInfo *aNumberInfo,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aNumberCount) :
|
2006-07-28 18:10:48 +00:00
|
|
|
mNumbers(aNumbers), mNumberInfo(aNumberInfo), mNumberCount(aNumberCount)
|
|
|
|
{}
|
2007-11-22 08:54:31 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2006-07-28 18:10:48 +00:00
|
|
|
};
|
|
|
|
|
2011-07-01 07:19:52 +00:00
|
|
|
struct NumberPairInfo {
|
|
|
|
nsIAtom** mName;
|
|
|
|
float mDefaultValue1;
|
|
|
|
float mDefaultValue2;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct NumberPairAttributesInfo {
|
|
|
|
nsSVGNumberPair* mNumberPairs;
|
|
|
|
NumberPairInfo* mNumberPairInfo;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mNumberPairCount;
|
2011-07-01 07:19:52 +00:00
|
|
|
|
|
|
|
NumberPairAttributesInfo(nsSVGNumberPair *aNumberPairs,
|
|
|
|
NumberPairInfo *aNumberPairInfo,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aNumberPairCount) :
|
2011-07-01 07:19:52 +00:00
|
|
|
mNumberPairs(aNumberPairs), mNumberPairInfo(aNumberPairInfo),
|
|
|
|
mNumberPairCount(aNumberPairCount)
|
|
|
|
{}
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2011-07-01 07:19:52 +00:00
|
|
|
};
|
|
|
|
|
2007-09-18 12:09:26 +00:00
|
|
|
struct IntegerInfo {
|
|
|
|
nsIAtom** mName;
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mDefaultValue;
|
2007-09-18 12:09:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct IntegerAttributesInfo {
|
|
|
|
nsSVGInteger* mIntegers;
|
|
|
|
IntegerInfo* mIntegerInfo;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mIntegerCount;
|
2007-09-18 12:09:26 +00:00
|
|
|
|
|
|
|
IntegerAttributesInfo(nsSVGInteger *aIntegers,
|
|
|
|
IntegerInfo *aIntegerInfo,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aIntegerCount) :
|
2007-09-18 12:09:26 +00:00
|
|
|
mIntegers(aIntegers), mIntegerInfo(aIntegerInfo), mIntegerCount(aIntegerCount)
|
|
|
|
{}
|
2007-11-22 08:54:31 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2007-09-18 12:09:26 +00:00
|
|
|
};
|
|
|
|
|
2011-07-01 07:19:52 +00:00
|
|
|
struct IntegerPairInfo {
|
|
|
|
nsIAtom** mName;
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mDefaultValue1;
|
|
|
|
int32_t mDefaultValue2;
|
2011-07-01 07:19:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct IntegerPairAttributesInfo {
|
|
|
|
nsSVGIntegerPair* mIntegerPairs;
|
|
|
|
IntegerPairInfo* mIntegerPairInfo;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mIntegerPairCount;
|
2011-07-01 07:19:52 +00:00
|
|
|
|
|
|
|
IntegerPairAttributesInfo(nsSVGIntegerPair *aIntegerPairs,
|
|
|
|
IntegerPairInfo *aIntegerPairInfo,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aIntegerPairCount) :
|
2011-07-01 07:19:52 +00:00
|
|
|
mIntegerPairs(aIntegerPairs), mIntegerPairInfo(aIntegerPairInfo),
|
|
|
|
mIntegerPairCount(aIntegerPairCount)
|
|
|
|
{}
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2011-07-01 07:19:52 +00:00
|
|
|
};
|
|
|
|
|
2007-10-10 10:07:59 +00:00
|
|
|
struct AngleInfo {
|
|
|
|
nsIAtom** mName;
|
|
|
|
float mDefaultValue;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t mDefaultUnitType;
|
2007-10-10 10:07:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct AngleAttributesInfo {
|
|
|
|
nsSVGAngle* mAngles;
|
|
|
|
AngleInfo* mAngleInfo;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mAngleCount;
|
2007-10-10 10:07:59 +00:00
|
|
|
|
|
|
|
AngleAttributesInfo(nsSVGAngle *aAngles,
|
|
|
|
AngleInfo *aAngleInfo,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aAngleCount) :
|
2007-10-10 10:07:59 +00:00
|
|
|
mAngles(aAngles), mAngleInfo(aAngleInfo), mAngleCount(aAngleCount)
|
|
|
|
{}
|
2007-11-22 08:54:31 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2007-10-10 10:07:59 +00:00
|
|
|
};
|
|
|
|
|
2007-09-26 09:22:08 +00:00
|
|
|
struct BooleanInfo {
|
|
|
|
nsIAtom** mName;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mDefaultValue;
|
2007-09-26 09:22:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct BooleanAttributesInfo {
|
|
|
|
nsSVGBoolean* mBooleans;
|
|
|
|
BooleanInfo* mBooleanInfo;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mBooleanCount;
|
2007-09-26 09:22:08 +00:00
|
|
|
|
|
|
|
BooleanAttributesInfo(nsSVGBoolean *aBooleans,
|
|
|
|
BooleanInfo *aBooleanInfo,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aBooleanCount) :
|
2007-09-26 09:22:08 +00:00
|
|
|
mBooleans(aBooleans), mBooleanInfo(aBooleanInfo), mBooleanCount(aBooleanCount)
|
|
|
|
{}
|
2007-11-22 08:54:31 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2007-09-26 09:22:08 +00:00
|
|
|
};
|
|
|
|
|
2007-09-18 12:09:26 +00:00
|
|
|
friend class nsSVGEnum;
|
|
|
|
|
2007-08-27 23:11:14 +00:00
|
|
|
struct EnumInfo {
|
|
|
|
nsIAtom** mName;
|
|
|
|
nsSVGEnumMapping* mMapping;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint16_t mDefaultValue;
|
2007-08-27 23:11:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct EnumAttributesInfo {
|
|
|
|
nsSVGEnum* mEnums;
|
|
|
|
EnumInfo* mEnumInfo;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mEnumCount;
|
2007-08-27 23:11:14 +00:00
|
|
|
|
|
|
|
EnumAttributesInfo(nsSVGEnum *aEnums,
|
|
|
|
EnumInfo *aEnumInfo,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aEnumCount) :
|
2007-08-27 23:11:14 +00:00
|
|
|
mEnums(aEnums), mEnumInfo(aEnumInfo), mEnumCount(aEnumCount)
|
|
|
|
{}
|
2007-11-22 08:54:31 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2007-08-27 23:11:14 +00:00
|
|
|
};
|
|
|
|
|
2010-12-03 16:40:23 +00:00
|
|
|
struct NumberListInfo {
|
|
|
|
nsIAtom** mName;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct NumberListAttributesInfo {
|
|
|
|
SVGAnimatedNumberList* mNumberLists;
|
|
|
|
NumberListInfo* mNumberListInfo;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mNumberListCount;
|
2010-12-03 16:40:23 +00:00
|
|
|
|
|
|
|
NumberListAttributesInfo(SVGAnimatedNumberList *aNumberLists,
|
|
|
|
NumberListInfo *aNumberListInfo,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aNumberListCount)
|
2010-12-03 16:40:23 +00:00
|
|
|
: mNumberLists(aNumberLists)
|
|
|
|
, mNumberListInfo(aNumberListInfo)
|
|
|
|
, mNumberListCount(aNumberListCount)
|
|
|
|
{}
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2010-12-03 16:40:23 +00:00
|
|
|
};
|
|
|
|
|
2010-07-16 21:42:12 +00:00
|
|
|
struct LengthListInfo {
|
|
|
|
nsIAtom** mName;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t mAxis;
|
2010-07-16 21:42:12 +00:00
|
|
|
/**
|
|
|
|
* Flag to indicate whether appending zeros to the end of the list would
|
|
|
|
* change the rendering of the SVG for the attribute in question. For x and
|
|
|
|
* y on the <text> element this is true, but for dx and dy on <text> this
|
|
|
|
* is false. This flag is fed down to SVGLengthListSMILType so it can
|
|
|
|
* determine if it can sensibly animate from-to lists of different lengths,
|
|
|
|
* which is desirable in the case of dx and dy.
|
|
|
|
*/
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mCouldZeroPadList;
|
2010-07-16 21:42:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct LengthListAttributesInfo {
|
2010-11-08 15:07:00 +00:00
|
|
|
SVGAnimatedLengthList* mLengthLists;
|
2010-07-16 21:42:12 +00:00
|
|
|
LengthListInfo* mLengthListInfo;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mLengthListCount;
|
2010-07-16 21:42:12 +00:00
|
|
|
|
2010-11-08 15:07:00 +00:00
|
|
|
LengthListAttributesInfo(SVGAnimatedLengthList *aLengthLists,
|
2010-07-16 21:42:12 +00:00
|
|
|
LengthListInfo *aLengthListInfo,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aLengthListCount)
|
2010-07-16 21:42:12 +00:00
|
|
|
: mLengthLists(aLengthLists)
|
|
|
|
, mLengthListInfo(aLengthListInfo)
|
|
|
|
, mLengthListCount(aLengthListCount)
|
|
|
|
{}
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2010-07-16 21:42:12 +00:00
|
|
|
};
|
|
|
|
|
2008-06-14 09:01:02 +00:00
|
|
|
struct StringInfo {
|
|
|
|
nsIAtom** mName;
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mNamespaceID;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mIsAnimatable;
|
2008-06-14 09:01:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct StringAttributesInfo {
|
|
|
|
nsSVGString* mStrings;
|
|
|
|
StringInfo* mStringInfo;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mStringCount;
|
2008-06-14 09:01:02 +00:00
|
|
|
|
|
|
|
StringAttributesInfo(nsSVGString *aStrings,
|
|
|
|
StringInfo *aStringInfo,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aStringCount) :
|
2008-06-14 09:01:02 +00:00
|
|
|
mStrings(aStrings), mStringInfo(aStringInfo), mStringCount(aStringCount)
|
|
|
|
{}
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2008-06-14 09:01:02 +00:00
|
|
|
};
|
|
|
|
|
2011-12-31 09:44:03 +00:00
|
|
|
friend class mozilla::DOMSVGStringList;
|
|
|
|
|
|
|
|
struct StringListInfo {
|
|
|
|
nsIAtom** mName;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct StringListAttributesInfo {
|
|
|
|
SVGStringList* mStringLists;
|
|
|
|
StringListInfo* mStringListInfo;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mStringListCount;
|
2011-12-31 09:44:03 +00:00
|
|
|
|
|
|
|
StringListAttributesInfo(SVGStringList *aStringLists,
|
|
|
|
StringListInfo *aStringListInfo,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aStringListCount) :
|
2011-12-31 09:44:03 +00:00
|
|
|
mStringLists(aStringLists), mStringListInfo(aStringListInfo),
|
|
|
|
mStringListCount(aStringListCount)
|
|
|
|
{}
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2011-12-31 09:44:03 +00:00
|
|
|
};
|
|
|
|
|
2006-04-14 15:09:39 +00:00
|
|
|
virtual LengthAttributesInfo GetLengthInfo();
|
2006-07-28 18:10:48 +00:00
|
|
|
virtual NumberAttributesInfo GetNumberInfo();
|
2011-07-01 07:19:52 +00:00
|
|
|
virtual NumberPairAttributesInfo GetNumberPairInfo();
|
2007-09-18 12:09:26 +00:00
|
|
|
virtual IntegerAttributesInfo GetIntegerInfo();
|
2011-07-01 07:19:52 +00:00
|
|
|
virtual IntegerPairAttributesInfo GetIntegerPairInfo();
|
2007-10-10 10:07:59 +00:00
|
|
|
virtual AngleAttributesInfo GetAngleInfo();
|
2007-09-26 09:22:08 +00:00
|
|
|
virtual BooleanAttributesInfo GetBooleanInfo();
|
|
|
|
virtual EnumAttributesInfo GetEnumInfo();
|
2009-02-03 14:42:24 +00:00
|
|
|
// We assume all viewboxes and preserveAspectRatios are alike
|
|
|
|
// so we don't need to wrap the class
|
|
|
|
virtual nsSVGViewBox *GetViewBox();
|
2010-12-20 00:45:29 +00:00
|
|
|
virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio();
|
2010-12-03 16:40:23 +00:00
|
|
|
virtual NumberListAttributesInfo GetNumberListInfo();
|
2010-07-16 21:42:12 +00:00
|
|
|
virtual LengthListAttributesInfo GetLengthListInfo();
|
2008-06-14 09:01:02 +00:00
|
|
|
virtual StringAttributesInfo GetStringInfo();
|
2011-12-31 09:44:03 +00:00
|
|
|
virtual StringListAttributesInfo GetStringListInfo();
|
2006-04-14 15:09:39 +00:00
|
|
|
|
2007-10-10 10:07:59 +00:00
|
|
|
static nsSVGEnumMapping sSVGUnitTypesMap[];
|
|
|
|
|
2008-06-24 12:54:11 +00:00
|
|
|
private:
|
2012-08-22 15:56:38 +00:00
|
|
|
void UnsetAttrInternal(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
2011-10-08 06:32:44 +00:00
|
|
|
bool aNotify);
|
|
|
|
|
2012-12-23 08:22:22 +00:00
|
|
|
nsSVGClass mClassAttribute;
|
|
|
|
nsAutoPtr<nsAttrValue> mClassAnimAttr;
|
2011-03-11 02:48:57 +00:00
|
|
|
nsRefPtr<mozilla::css::StyleRule> mContentStyleRule;
|
2001-12-12 07:59:31 +00:00
|
|
|
};
|
|
|
|
|
2004-05-18 20:58:12 +00:00
|
|
|
/**
|
|
|
|
* A macro to implement the NS_NewSVGXXXElement() functions.
|
|
|
|
*/
|
|
|
|
#define NS_IMPL_NS_NEW_SVG_ELEMENT(_elementName) \
|
|
|
|
nsresult \
|
|
|
|
NS_NewSVG##_elementName##Element(nsIContent **aResult, \
|
2014-06-20 02:01:40 +00:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) \
|
2004-05-18 20:58:12 +00:00
|
|
|
{ \
|
2010-01-15 11:44:12 +00:00
|
|
|
nsRefPtr<nsSVG##_elementName##Element> it = \
|
2008-02-02 23:41:24 +00:00
|
|
|
new nsSVG##_elementName##Element(aNodeInfo); \
|
2004-05-18 20:58:12 +00:00
|
|
|
\
|
2010-01-15 11:44:12 +00:00
|
|
|
nsresult rv = it->Init(); \
|
|
|
|
\
|
|
|
|
if (NS_FAILED(rv)) { \
|
|
|
|
return rv; \
|
|
|
|
} \
|
|
|
|
\
|
2013-01-05 01:50:20 +00:00
|
|
|
it.forget(aResult); \
|
|
|
|
\
|
|
|
|
return rv; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(_elementName) \
|
|
|
|
nsresult \
|
|
|
|
NS_NewSVG##_elementName##Element(nsIContent **aResult, \
|
2014-06-20 02:01:40 +00:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) \
|
2013-01-05 01:50:20 +00:00
|
|
|
{ \
|
|
|
|
nsRefPtr<mozilla::dom::SVG##_elementName##Element> it = \
|
|
|
|
new mozilla::dom::SVG##_elementName##Element(aNodeInfo); \
|
|
|
|
\
|
|
|
|
nsresult rv = it->Init(); \
|
|
|
|
\
|
|
|
|
if (NS_FAILED(rv)) { \
|
|
|
|
return rv; \
|
|
|
|
} \
|
|
|
|
\
|
2013-01-05 09:41:28 +00:00
|
|
|
it.forget(aResult); \
|
|
|
|
\
|
|
|
|
return rv; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT_CHECK_PARSER(_elementName) \
|
|
|
|
nsresult \
|
|
|
|
NS_NewSVG##_elementName##Element(nsIContent **aResult, \
|
2014-06-20 02:01:40 +00:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, \
|
2013-01-05 09:41:28 +00:00
|
|
|
mozilla::dom::FromParser aFromParser) \
|
|
|
|
{ \
|
|
|
|
nsRefPtr<mozilla::dom::SVG##_elementName##Element> it = \
|
|
|
|
new mozilla::dom::SVG##_elementName##Element(aNodeInfo, aFromParser); \
|
|
|
|
\
|
|
|
|
nsresult rv = it->Init(); \
|
|
|
|
\
|
2004-05-18 20:58:12 +00:00
|
|
|
if (NS_FAILED(rv)) { \
|
|
|
|
return rv; \
|
|
|
|
} \
|
|
|
|
\
|
2012-07-18 10:36:08 +00:00
|
|
|
it.forget(aResult); \
|
2004-05-18 20:58:12 +00:00
|
|
|
\
|
|
|
|
return rv; \
|
|
|
|
}
|
|
|
|
|
2012-12-23 04:54:22 +00:00
|
|
|
// No unlinking, we'd need to null out the value pointer (the object it
|
2008-12-30 16:32:22 +00:00
|
|
|
// points to is held by the element) and null-check it everywhere.
|
|
|
|
#define NS_SVG_VAL_IMPL_CYCLE_COLLECTION(_val, _element) \
|
2013-08-02 01:29:05 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(_val) \
|
2008-12-30 16:32:22 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(_val) \
|
2012-11-15 07:32:40 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(_element) \
|
2008-12-30 16:32:22 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END \
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_0(_val)
|
|
|
|
|
2012-12-23 04:54:22 +00:00
|
|
|
#define NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(_val, _element) \
|
2013-08-02 01:29:05 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(_val) \
|
2012-12-23 04:54:22 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(_val) \
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER \
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END \
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(_val) \
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(_element) \
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS \
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END \
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(_val) \
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER \
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
2008-12-30 16:32:22 +00:00
|
|
|
|
2001-12-12 07:59:31 +00:00
|
|
|
#endif // __NS_SVGELEMENT_H__
|