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/. */
|
2001-12-12 10:59:31 +03: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-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-01-26 13:57:21 +04:00
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsChangeHint.h"
|
2001-12-12 10:59:31 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2012-01-26 13:57:21 +04:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsError.h"
|
2013-09-20 14:21:03 +04:00
|
|
|
#include "mozilla/dom/DOMRect.h"
|
2016-12-13 10:11:04 +03:00
|
|
|
#include "mozilla/dom/Element.h"
|
2017-07-05 18:18:48 +03:00
|
|
|
#include "mozilla/gfx/MatrixFwd.h"
|
2012-01-26 13:57:21 +04:00
|
|
|
#include "nsISupportsImpl.h"
|
2007-08-06 19:27:19 +04:00
|
|
|
#include "nsStyledElement.h"
|
2012-12-23 12:22:22 +04:00
|
|
|
#include "nsSVGClass.h"
|
2013-02-03 00:22:35 +04:00
|
|
|
#include "nsIDOMSVGElement.h"
|
2015-12-03 01:36:23 +03:00
|
|
|
#include "SVGContentUtils.h"
|
2017-07-05 18:18:49 +03:00
|
|
|
#include "gfxMatrix.h"
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2007-10-10 14:07:59 +04:00
|
|
|
class nsSVGAngle;
|
2007-09-26 13:22:08 +04:00
|
|
|
class nsSVGBoolean;
|
2007-08-28 03:11:14 +04:00
|
|
|
class nsSVGEnum;
|
2012-01-26 13:57:21 +04:00
|
|
|
class nsSVGInteger;
|
|
|
|
class nsSVGIntegerPair;
|
|
|
|
class nsSVGLength2;
|
|
|
|
class nsSVGNumber2;
|
|
|
|
class nsSVGNumberPair;
|
2008-06-14 13:01:02 +04:00
|
|
|
class nsSVGString;
|
2012-01-26 13:57:21 +04:00
|
|
|
class nsSVGViewBox;
|
|
|
|
|
2010-07-17 01:42:12 +04:00
|
|
|
namespace mozilla {
|
2016-12-31 12:10:45 +03:00
|
|
|
class DeclarationBlock;
|
|
|
|
|
2012-12-23 12:22:58 +04:00
|
|
|
namespace dom {
|
2013-01-10 03:02:45 +04:00
|
|
|
class SVGSVGElement;
|
2017-10-10 09:58:34 +03:00
|
|
|
class SVGViewportElement;
|
2013-02-18 06:14:02 +04: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;
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
2012-12-23 12:22:58 +04:00
|
|
|
|
2010-12-03 19:40:23 +03:00
|
|
|
class SVGAnimatedNumberList;
|
|
|
|
class SVGNumberList;
|
2010-07-17 01:42:12 +04:00
|
|
|
class SVGAnimatedLengthList;
|
|
|
|
class SVGUserUnitList;
|
2010-12-08 15:15:53 +03:00
|
|
|
class SVGAnimatedPointList;
|
2010-11-08 18:07:00 +03:00
|
|
|
class SVGAnimatedPathSegList;
|
2010-12-20 03:45:29 +03:00
|
|
|
class SVGAnimatedPreserveAspectRatio;
|
2013-04-15 02:56:34 +04:00
|
|
|
class nsSVGAnimatedTransformList;
|
2011-12-31 13:44:03 +04:00
|
|
|
class SVGStringList;
|
|
|
|
class DOMSVGStringList;
|
2013-12-29 01:37:40 +04:00
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace mozilla
|
2010-07-17 01:42:12 +04:00
|
|
|
|
2012-01-26 13:57:21 +04:00
|
|
|
struct nsSVGEnumMapping;
|
|
|
|
|
2016-08-02 21:05:38 +03:00
|
|
|
typedef nsStyledElement nsSVGElementBase;
|
2007-08-06 19:27:19 +04:00
|
|
|
|
2011-09-30 13:25:34 +04:00
|
|
|
class nsSVGElement : public nsSVGElementBase // nsIContent
|
2013-03-28 05:23:09 +04:00
|
|
|
, public nsIDOMSVGElement
|
2001-12-12 10:59:31 +03:00
|
|
|
{
|
|
|
|
protected:
|
2014-08-08 17:49:39 +04:00
|
|
|
explicit nsSVGElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
2013-12-03 18:40:11 +04:00
|
|
|
friend nsresult NS_NewSVGElement(mozilla::dom::Element **aResult,
|
2014-06-20 06:01:40 +04:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
2006-04-14 19:09:39 +04:00
|
|
|
nsresult Init();
|
2016-12-31 12:10:45 +03:00
|
|
|
virtual ~nsSVGElement();
|
2001-12-12 10:59:31 +03:00
|
|
|
|
|
|
|
public:
|
2013-03-28 05:23:10 +04:00
|
|
|
|
2017-04-20 22:57:48 +03:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
|
|
|
|
bool aPreallocateChildren) const MOZ_MUST_OVERRIDE override;
|
2013-03-28 05:23:10 +04:00
|
|
|
|
2010-12-03 19:40:23 +03:00
|
|
|
typedef mozilla::SVGNumberList SVGNumberList;
|
|
|
|
typedef mozilla::SVGAnimatedNumberList SVGAnimatedNumberList;
|
2010-11-08 18:07:00 +03:00
|
|
|
typedef mozilla::SVGUserUnitList SVGUserUnitList;
|
|
|
|
typedef mozilla::SVGAnimatedLengthList SVGAnimatedLengthList;
|
2010-12-08 15:15:53 +03:00
|
|
|
typedef mozilla::SVGAnimatedPointList SVGAnimatedPointList;
|
2010-11-08 18:07:00 +03:00
|
|
|
typedef mozilla::SVGAnimatedPathSegList SVGAnimatedPathSegList;
|
2010-12-20 03:45:29 +03:00
|
|
|
typedef mozilla::SVGAnimatedPreserveAspectRatio SVGAnimatedPreserveAspectRatio;
|
2013-04-15 02:56:34 +04:00
|
|
|
typedef mozilla::nsSVGAnimatedTransformList nsSVGAnimatedTransformList;
|
2011-12-31 13:44:03 +04:00
|
|
|
typedef mozilla::SVGStringList SVGStringList;
|
2010-11-08 18:07:00 +03:00
|
|
|
|
2001-12-12 10:59:31 +03:00
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2012-12-23 12:22:22 +04:00
|
|
|
void DidAnimateClass();
|
|
|
|
|
2001-12-12 10:59:31 +03:00
|
|
|
// nsIContent interface methods
|
|
|
|
|
2008-01-01 13:51:40 +03:00
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aCompileEventHandlers) override;
|
2008-01-01 13:51:40 +03:00
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsAtom* aAttribute,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNotify) override;
|
2006-07-28 22:10:48 +04:00
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
|
2015-03-21 19:28:04 +03:00
|
|
|
int32_t aModType) const override;
|
2008-08-05 16:01:47 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsNodeOfType(uint32_t aFlags) const override;
|
2006-07-28 22:10:48 +04:00
|
|
|
|
2017-02-23 04:19:04 +03:00
|
|
|
/**
|
|
|
|
* We override the default to unschedule computation of Servo declaration blocks
|
|
|
|
* when adopted across documents.
|
|
|
|
*/
|
2017-04-15 18:55:05 +03:00
|
|
|
virtual void NodeInfoChanged(nsIDocument* aOldDoc) override;
|
2017-02-23 04:19:04 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;
|
2014-09-13 17:17:35 +04:00
|
|
|
void WalkAnimatedContentStyleRules(nsRuleWalker* aRuleWalker);
|
2004-02-09 23:48:20 +03:00
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
|
2012-02-20 00:49:34 +04:00
|
|
|
|
2004-02-26 00:04:50 +03:00
|
|
|
static const MappedAttributeEntry sFillStrokeMap[];
|
|
|
|
static const MappedAttributeEntry sGraphicsMap[];
|
|
|
|
static const MappedAttributeEntry sTextContentElementsMap[];
|
|
|
|
static const MappedAttributeEntry sFontSpecificationMap[];
|
2004-10-15 03:02:53 +04:00
|
|
|
static const MappedAttributeEntry sGradientStopMap[];
|
2004-10-27 04:25:08 +04:00
|
|
|
static const MappedAttributeEntry sViewportsMap[];
|
2004-12-09 06:16:15 +03:00
|
|
|
static const MappedAttributeEntry sMarkersMap[];
|
2004-12-10 02:51:25 +03:00
|
|
|
static const MappedAttributeEntry sColorMap[];
|
2007-01-30 16:19:55 +03:00
|
|
|
static const MappedAttributeEntry sFiltersMap[];
|
2007-01-08 19:48:56 +03:00
|
|
|
static const MappedAttributeEntry sFEFloodMap[];
|
2007-07-26 10:57:42 +04:00
|
|
|
static const MappedAttributeEntry sLightingEffectsMap[];
|
2012-12-21 04:15:22 +04:00
|
|
|
static const MappedAttributeEntry sMaskMap[];
|
2007-07-26 10:57:42 +04:00
|
|
|
|
2013-03-28 05:23:09 +04:00
|
|
|
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
|
|
|
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
|
|
|
NS_DECL_NSIDOMSVGELEMENT
|
2001-12-12 10:59:31 +03:00
|
|
|
|
2017-02-23 04:19:04 +03:00
|
|
|
NS_IMPL_FROMCONTENT(nsSVGElement, kNameSpaceID_SVG)
|
|
|
|
|
2008-01-25 23:51:13 +03:00
|
|
|
// Gets the element that establishes the rectangular viewport against which
|
|
|
|
// we should resolve percentage lengths (our "coordinate context"). Returns
|
2012-07-30 18:20:58 +04:00
|
|
|
// nullptr for outer <svg> or SVG without an <svg> parent (invalid SVG).
|
2017-10-10 09:58:34 +03:00
|
|
|
mozilla::dom::SVGViewportElement* GetCtx() const;
|
2006-04-14 19:09:39 +04:00
|
|
|
|
2009-04-29 08:31:34 +04:00
|
|
|
/**
|
2012-02-17 12:12:47 +04: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 08:31:34 +04:00
|
|
|
*/
|
2015-12-03 01:36:23 +03:00
|
|
|
virtual gfxMatrix PrependLocalTransformsTo(
|
|
|
|
const gfxMatrix &aMatrix, SVGTransformTypes aWhich = eAllTransforms) const;
|
2009-04-29 08:31:34 +04:00
|
|
|
|
2010-04-29 03:00:54 +04: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-29 01:37:40 +04:00
|
|
|
virtual void SetAnimateMotionTransform(const mozilla::gfx::Matrix* aMatrix) {/*no-op*/}
|
|
|
|
virtual const mozilla::gfx::Matrix* GetAnimateMotionTransform() const { return nullptr; }
|
2010-04-29 03:00:54 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
bool IsStringAnimatable(uint8_t aAttrEnum) {
|
2010-10-07 23:19:32 +04:00
|
|
|
return GetStringInfo().mStringInfo[aAttrEnum].mIsAnimatable;
|
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
bool NumberAttrAllowsPercentage(uint8_t aAttrEnum) {
|
2010-12-05 23:33:31 +03:00
|
|
|
return GetNumberInfo().mNumberInfo[aAttrEnum].mPercentagesAllowed;
|
|
|
|
}
|
2012-03-03 13:21:09 +04:00
|
|
|
virtual bool HasValidDimensions() const {
|
|
|
|
return true;
|
|
|
|
}
|
2017-10-03 01:05:19 +03:00
|
|
|
void SetLength(nsAtom* aName, const nsSVGLength2 &aLength);
|
2012-02-16 03:40:45 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsAttrValue WillChangeLength(uint8_t aAttrEnum);
|
|
|
|
nsAttrValue WillChangeNumberPair(uint8_t aAttrEnum);
|
|
|
|
nsAttrValue WillChangeIntegerPair(uint8_t aAttrEnum);
|
|
|
|
nsAttrValue WillChangeAngle(uint8_t aAttrEnum);
|
2012-02-16 03:40:46 +04:00
|
|
|
nsAttrValue WillChangeViewBox();
|
2012-02-16 03:40:46 +04:00
|
|
|
nsAttrValue WillChangePreserveAspectRatio();
|
2012-08-22 19:56:38 +04:00
|
|
|
nsAttrValue WillChangeNumberList(uint8_t aAttrEnum);
|
|
|
|
nsAttrValue WillChangeLengthList(uint8_t aAttrEnum);
|
2012-02-16 03:40:46 +04:00
|
|
|
nsAttrValue WillChangePointList();
|
2012-02-16 03:40:46 +04:00
|
|
|
nsAttrValue WillChangePathSegList();
|
2012-02-16 03:40:46 +04:00
|
|
|
nsAttrValue WillChangeTransformList();
|
2012-02-16 03:40:46 +04:00
|
|
|
nsAttrValue WillChangeStringList(bool aIsConditionalProcessingAttribute,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t aAttrEnum);
|
2012-02-16 03:40:45 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void DidChangeLength(uint8_t aAttrEnum, const nsAttrValue& aEmptyOrOldValue);
|
|
|
|
void DidChangeNumber(uint8_t aAttrEnum);
|
|
|
|
void DidChangeNumberPair(uint8_t aAttrEnum,
|
2012-02-16 03:40:45 +04:00
|
|
|
const nsAttrValue& aEmptyOrOldValue);
|
2012-08-22 19:56:38 +04:00
|
|
|
void DidChangeInteger(uint8_t aAttrEnum);
|
|
|
|
void DidChangeIntegerPair(uint8_t aAttrEnum,
|
2012-02-16 03:40:45 +04:00
|
|
|
const nsAttrValue& aEmptyOrOldValue);
|
2012-08-22 19:56:38 +04:00
|
|
|
void DidChangeAngle(uint8_t aAttrEnum, const nsAttrValue& aEmptyOrOldValue);
|
|
|
|
void DidChangeBoolean(uint8_t aAttrEnum);
|
|
|
|
void DidChangeEnum(uint8_t aAttrEnum);
|
2012-02-16 03:40:46 +04:00
|
|
|
void DidChangeViewBox(const nsAttrValue& aEmptyOrOldValue);
|
2012-02-16 03:40:46 +04:00
|
|
|
void DidChangePreserveAspectRatio(const nsAttrValue& aEmptyOrOldValue);
|
2012-08-22 19:56:38 +04:00
|
|
|
void DidChangeNumberList(uint8_t aAttrEnum,
|
2012-02-16 03:40:46 +04:00
|
|
|
const nsAttrValue& aEmptyOrOldValue);
|
2012-08-22 19:56:38 +04:00
|
|
|
void DidChangeLengthList(uint8_t aAttrEnum,
|
2012-02-16 03:40:45 +04:00
|
|
|
const nsAttrValue& aEmptyOrOldValue);
|
2012-02-16 03:40:46 +04:00
|
|
|
void DidChangePointList(const nsAttrValue& aEmptyOrOldValue);
|
2012-02-16 03:40:46 +04:00
|
|
|
void DidChangePathSegList(const nsAttrValue& aEmptyOrOldValue);
|
2012-02-16 03:40:46 +04:00
|
|
|
void DidChangeTransformList(const nsAttrValue& aEmptyOrOldValue);
|
2012-08-22 19:56:38 +04:00
|
|
|
void DidChangeString(uint8_t aAttrEnum) {}
|
2011-12-31 13:44:03 +04:00
|
|
|
void DidChangeStringList(bool aIsConditionalProcessingAttribute,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t aAttrEnum,
|
2012-02-16 03:40:46 +04:00
|
|
|
const nsAttrValue& aEmptyOrOldValue);
|
2006-04-14 19:09:39 +04:00
|
|
|
|
2012-08-22 19:56:38 +04: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 13:04:06 +04:00
|
|
|
void DidAnimateViewBox();
|
|
|
|
void DidAnimatePreserveAspectRatio();
|
2012-08-22 19:56:38 +04:00
|
|
|
void DidAnimateNumberList(uint8_t aAttrEnum);
|
|
|
|
void DidAnimateLengthList(uint8_t aAttrEnum);
|
2012-02-19 13:04:06 +04:00
|
|
|
void DidAnimatePointList();
|
|
|
|
void DidAnimatePathSegList();
|
2014-04-07 23:52:12 +04:00
|
|
|
void DidAnimateTransformList(int32_t aModType);
|
2012-08-22 19:56:38 +04:00
|
|
|
void DidAnimateString(uint8_t aAttrEnum);
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2012-07-30 04:35:26 +04: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
|
|
|
|
};
|
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
nsSVGLength2* GetAnimatedLength(const nsAtom *aAttrName);
|
2006-04-14 19:09:39 +04:00
|
|
|
void GetAnimatedLengthValues(float *aFirst, ...);
|
2006-07-28 22:10:48 +04:00
|
|
|
void GetAnimatedNumberValues(float *aFirst, ...);
|
2012-08-22 19:56:38 +04:00
|
|
|
void GetAnimatedIntegerValues(int32_t *aFirst, ...);
|
|
|
|
SVGAnimatedNumberList* GetAnimatedNumberList(uint8_t aAttrEnum);
|
2017-10-03 01:05:19 +03:00
|
|
|
SVGAnimatedNumberList* GetAnimatedNumberList(nsAtom *aAttrName);
|
2010-11-08 18:07:00 +03:00
|
|
|
void GetAnimatedLengthListValues(SVGUserUnitList *aFirst, ...);
|
2012-08-22 19:56:38 +04:00
|
|
|
SVGAnimatedLengthList* GetAnimatedLengthList(uint8_t aAttrEnum);
|
2010-12-08 15:15:53 +03:00
|
|
|
virtual SVGAnimatedPointList* GetAnimatedPointList() {
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2010-12-08 15:15:53 +03:00
|
|
|
}
|
2010-11-08 18:07:00 +03: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 18:20:58 +04:00
|
|
|
return nullptr;
|
2010-11-08 18:07:00 +03:00
|
|
|
}
|
2012-07-30 04:35:26 +04:00
|
|
|
/**
|
2013-04-15 02:56:34 +04:00
|
|
|
* Get the nsSVGAnimatedTransformList for this element.
|
2012-07-30 04:35:26 +04: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-15 02:56:34 +04:00
|
|
|
* set, so to save memory the nsSVGAnimatedTransformList is not allocated until
|
2012-07-30 04:35:26 +04:00
|
|
|
* the attribute is set/animated or its DOM wrapper is created. Callers that
|
2013-04-15 02:56:34 +04:00
|
|
|
* require the nsSVGAnimatedTransformList to be allocated and for this method
|
2012-07-30 04:35:26 +04:00
|
|
|
* to return non-null must pass the DO_ALLOCATE flag.
|
|
|
|
*/
|
2013-04-15 02:56:34 +04:00
|
|
|
virtual nsSVGAnimatedTransformList* GetAnimatedTransformList(
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aFlags = 0) {
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2011-09-26 01:04:31 +04:00
|
|
|
}
|
2006-07-28 22:10:48 +04:00
|
|
|
|
2017-03-30 07:10:07 +03:00
|
|
|
mozilla::UniquePtr<nsISMILAttr> GetAnimatedAttr(int32_t aNamespaceID,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* aName) override;
|
2009-01-22 04:00:27 +03:00
|
|
|
void AnimationNeedsResample();
|
|
|
|
void FlushAnimations();
|
2009-01-15 07:38:07 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void RecompileScriptEventListeners() override;
|
2006-10-07 14:27:45 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void GetStringBaseValue(uint8_t aAttrEnum, nsAString& aResult) const;
|
|
|
|
void SetStringBaseValue(uint8_t aAttrEnum, const nsAString& aValue);
|
2009-01-22 03:56:51 +03:00
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual nsAtom* GetPointListAttrName() const {
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2010-12-08 15:15:53 +03:00
|
|
|
}
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual nsAtom* GetPathDataAttrName() const {
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2010-11-08 18:07:00 +03:00
|
|
|
}
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual nsAtom* GetTransformListAttrName() const {
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2011-09-26 01:04:31 +04:00
|
|
|
}
|
2014-05-30 11:36:53 +04:00
|
|
|
const nsAttrValue* GetAnimatedClassName() const
|
|
|
|
{
|
|
|
|
if (!mClassAttribute.IsAnimated()) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return mClassAnimAttr;
|
|
|
|
}
|
2010-11-08 18:07:00 +03:00
|
|
|
|
2014-10-04 15:13:30 +04:00
|
|
|
virtual void ClearAnyCachedPath() {}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIDOMNode* AsDOMNode() final override { return this; }
|
2013-03-28 05:23:09 +04:00
|
|
|
virtual bool IsTransformable() { return false; }
|
|
|
|
|
2012-12-23 12:22:58 +04:00
|
|
|
// WebIDL
|
2013-08-07 21:40:52 +04:00
|
|
|
mozilla::dom::SVGSVGElement* GetOwnerSVGElement();
|
2013-01-06 10:25:55 +04:00
|
|
|
nsSVGElement* GetViewportElement();
|
2013-06-15 02:37:27 +04:00
|
|
|
already_AddRefed<mozilla::dom::SVGAnimatedString> ClassName();
|
2016-09-28 15:05:28 +03:00
|
|
|
|
|
|
|
virtual bool IsSVGFocusable(bool* aIsFocusable, int32_t* aTabIndex);
|
2016-05-24 07:22:17 +03:00
|
|
|
virtual bool IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse) override;
|
|
|
|
|
2017-02-23 04:19:04 +03:00
|
|
|
void UpdateContentDeclarationBlock(mozilla::StyleBackendType aBackend);
|
|
|
|
const mozilla::DeclarationBlock* GetContentDeclarationBlock() const;
|
|
|
|
|
2001-12-12 10:59:31 +03:00
|
|
|
protected:
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
|
2012-12-23 12:22:58 +04:00
|
|
|
|
2012-02-16 03:40:45 +04:00
|
|
|
#ifdef DEBUG
|
2015-03-21 19:28:04 +03:00
|
|
|
// We define BeforeSetAttr here and mark it final to ensure it is NOT used
|
2012-02-16 03:40:45 +04:00
|
|
|
// 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.
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual nsresult BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
2017-03-16 21:50:41 +03:00
|
|
|
const nsAttrValueOrString* aValue,
|
2015-08-01 08:46:15 +03:00
|
|
|
bool aNotify) override final
|
|
|
|
{
|
|
|
|
return nsSVGElementBase::BeforeSetAttr(aNamespaceID, aName, aValue, aNotify);
|
|
|
|
}
|
2012-02-16 03:40:45 +04:00
|
|
|
#endif // DEBUG
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
2017-05-19 00:09:01 +03:00
|
|
|
const nsAttrValue* aValue,
|
|
|
|
const nsAttrValue* aOldValue,
|
2017-10-10 00:33:38 +03:00
|
|
|
nsIPrincipal* aSubjectPrincipal,
|
2017-05-19 00:09:01 +03:00
|
|
|
bool aNotify) override;
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
2017-11-02 06:35:52 +03:00
|
|
|
const nsAString& aValue,
|
|
|
|
nsIPrincipal* aMaybeScriptedPrincipal,
|
|
|
|
nsAttrValue& aResult) override;
|
2009-01-15 07:38:07 +03:00
|
|
|
static nsresult ReportAttributeParseFailure(nsIDocument* aDocument,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* aAttribute,
|
2009-01-15 07:38:07 +03:00
|
|
|
const nsAString& aValue);
|
2005-10-28 06:59:38 +04:00
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAttrValue WillChangeValue(nsAtom* aName);
|
2015-07-25 08:57:13 +03:00
|
|
|
// aNewValue is set to the old value. This value may be invalid if
|
|
|
|
// !StoresOwnData.
|
2017-10-03 01:05:19 +03:00
|
|
|
void DidChangeValue(nsAtom* aName, const nsAttrValue& aEmptyOrOldValue,
|
2012-02-16 03:40:45 +04:00
|
|
|
nsAttrValue& aNewValue);
|
2017-10-03 01:05:19 +03:00
|
|
|
void MaybeSerializeAttrBeforeRemoval(nsAtom* aName, bool aNotify);
|
2012-02-16 03:40:45 +04:00
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
static nsAtom* GetEventNameForAttr(nsAtom* aAttr);
|
2004-07-22 20:38:05 +04:00
|
|
|
|
2006-04-14 19:09:39 +04:00
|
|
|
struct LengthInfo {
|
2017-10-27 02:31:13 +03:00
|
|
|
nsStaticAtom** mName;
|
2006-04-14 19:09:39 +04:00
|
|
|
float mDefaultValue;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mDefaultUnitType;
|
|
|
|
uint8_t mCtxType;
|
2006-04-14 19:09:39 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct LengthAttributesInfo {
|
|
|
|
nsSVGLength2* mLengths;
|
|
|
|
LengthInfo* mLengthInfo;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mLengthCount;
|
2006-04-14 19:09:39 +04:00
|
|
|
|
|
|
|
LengthAttributesInfo(nsSVGLength2 *aLengths,
|
|
|
|
LengthInfo *aLengthInfo,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aLengthCount) :
|
2006-04-14 19:09:39 +04:00
|
|
|
mLengths(aLengths), mLengthInfo(aLengthInfo), mLengthCount(aLengthCount)
|
|
|
|
{}
|
2007-11-22 11:54:31 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2006-04-14 19:09:39 +04:00
|
|
|
};
|
|
|
|
|
2006-07-28 22:10:48 +04:00
|
|
|
struct NumberInfo {
|
2017-10-27 02:31:13 +03:00
|
|
|
nsStaticAtom** mName;
|
2006-07-28 22:10:48 +04:00
|
|
|
float mDefaultValue;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mPercentagesAllowed;
|
2006-07-28 22:10:48 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct NumberAttributesInfo {
|
|
|
|
nsSVGNumber2* mNumbers;
|
|
|
|
NumberInfo* mNumberInfo;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mNumberCount;
|
2006-07-28 22:10:48 +04:00
|
|
|
|
|
|
|
NumberAttributesInfo(nsSVGNumber2 *aNumbers,
|
|
|
|
NumberInfo *aNumberInfo,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aNumberCount) :
|
2006-07-28 22:10:48 +04:00
|
|
|
mNumbers(aNumbers), mNumberInfo(aNumberInfo), mNumberCount(aNumberCount)
|
|
|
|
{}
|
2007-11-22 11:54:31 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2006-07-28 22:10:48 +04:00
|
|
|
};
|
|
|
|
|
2011-07-01 11:19:52 +04:00
|
|
|
struct NumberPairInfo {
|
2017-10-27 02:31:13 +03:00
|
|
|
nsStaticAtom** mName;
|
2011-07-01 11:19:52 +04:00
|
|
|
float mDefaultValue1;
|
|
|
|
float mDefaultValue2;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct NumberPairAttributesInfo {
|
|
|
|
nsSVGNumberPair* mNumberPairs;
|
|
|
|
NumberPairInfo* mNumberPairInfo;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mNumberPairCount;
|
2011-07-01 11:19:52 +04:00
|
|
|
|
|
|
|
NumberPairAttributesInfo(nsSVGNumberPair *aNumberPairs,
|
|
|
|
NumberPairInfo *aNumberPairInfo,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aNumberPairCount) :
|
2011-07-01 11:19:52 +04:00
|
|
|
mNumberPairs(aNumberPairs), mNumberPairInfo(aNumberPairInfo),
|
|
|
|
mNumberPairCount(aNumberPairCount)
|
|
|
|
{}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2011-07-01 11:19:52 +04:00
|
|
|
};
|
|
|
|
|
2007-09-18 16:09:26 +04:00
|
|
|
struct IntegerInfo {
|
2017-10-27 02:31:13 +03:00
|
|
|
nsStaticAtom** mName;
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mDefaultValue;
|
2007-09-18 16:09:26 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct IntegerAttributesInfo {
|
|
|
|
nsSVGInteger* mIntegers;
|
|
|
|
IntegerInfo* mIntegerInfo;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mIntegerCount;
|
2007-09-18 16:09:26 +04:00
|
|
|
|
|
|
|
IntegerAttributesInfo(nsSVGInteger *aIntegers,
|
|
|
|
IntegerInfo *aIntegerInfo,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aIntegerCount) :
|
2007-09-18 16:09:26 +04:00
|
|
|
mIntegers(aIntegers), mIntegerInfo(aIntegerInfo), mIntegerCount(aIntegerCount)
|
|
|
|
{}
|
2007-11-22 11:54:31 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2007-09-18 16:09:26 +04:00
|
|
|
};
|
|
|
|
|
2011-07-01 11:19:52 +04:00
|
|
|
struct IntegerPairInfo {
|
2017-10-27 02:31:13 +03:00
|
|
|
nsStaticAtom** mName;
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mDefaultValue1;
|
|
|
|
int32_t mDefaultValue2;
|
2011-07-01 11:19:52 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct IntegerPairAttributesInfo {
|
|
|
|
nsSVGIntegerPair* mIntegerPairs;
|
|
|
|
IntegerPairInfo* mIntegerPairInfo;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mIntegerPairCount;
|
2011-07-01 11:19:52 +04:00
|
|
|
|
|
|
|
IntegerPairAttributesInfo(nsSVGIntegerPair *aIntegerPairs,
|
|
|
|
IntegerPairInfo *aIntegerPairInfo,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aIntegerPairCount) :
|
2011-07-01 11:19:52 +04:00
|
|
|
mIntegerPairs(aIntegerPairs), mIntegerPairInfo(aIntegerPairInfo),
|
|
|
|
mIntegerPairCount(aIntegerPairCount)
|
|
|
|
{}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2011-07-01 11:19:52 +04:00
|
|
|
};
|
|
|
|
|
2007-10-10 14:07:59 +04:00
|
|
|
struct AngleInfo {
|
2017-10-27 02:31:13 +03:00
|
|
|
nsStaticAtom** mName;
|
2007-10-10 14:07:59 +04:00
|
|
|
float mDefaultValue;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mDefaultUnitType;
|
2007-10-10 14:07:59 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct AngleAttributesInfo {
|
|
|
|
nsSVGAngle* mAngles;
|
|
|
|
AngleInfo* mAngleInfo;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mAngleCount;
|
2007-10-10 14:07:59 +04:00
|
|
|
|
|
|
|
AngleAttributesInfo(nsSVGAngle *aAngles,
|
|
|
|
AngleInfo *aAngleInfo,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aAngleCount) :
|
2007-10-10 14:07:59 +04:00
|
|
|
mAngles(aAngles), mAngleInfo(aAngleInfo), mAngleCount(aAngleCount)
|
|
|
|
{}
|
2007-11-22 11:54:31 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2007-10-10 14:07:59 +04:00
|
|
|
};
|
|
|
|
|
2007-09-26 13:22:08 +04:00
|
|
|
struct BooleanInfo {
|
2017-10-27 02:31:13 +03:00
|
|
|
nsStaticAtom** mName;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mDefaultValue;
|
2007-09-26 13:22:08 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct BooleanAttributesInfo {
|
|
|
|
nsSVGBoolean* mBooleans;
|
|
|
|
BooleanInfo* mBooleanInfo;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mBooleanCount;
|
2007-09-26 13:22:08 +04:00
|
|
|
|
|
|
|
BooleanAttributesInfo(nsSVGBoolean *aBooleans,
|
|
|
|
BooleanInfo *aBooleanInfo,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aBooleanCount) :
|
2007-09-26 13:22:08 +04:00
|
|
|
mBooleans(aBooleans), mBooleanInfo(aBooleanInfo), mBooleanCount(aBooleanCount)
|
|
|
|
{}
|
2007-11-22 11:54:31 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2007-09-26 13:22:08 +04:00
|
|
|
};
|
|
|
|
|
2007-09-18 16:09:26 +04:00
|
|
|
friend class nsSVGEnum;
|
|
|
|
|
2007-08-28 03:11:14 +04:00
|
|
|
struct EnumInfo {
|
2017-10-27 02:31:13 +03:00
|
|
|
nsStaticAtom** mName;
|
2007-08-28 03:11:14 +04:00
|
|
|
nsSVGEnumMapping* mMapping;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint16_t mDefaultValue;
|
2007-08-28 03:11:14 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct EnumAttributesInfo {
|
|
|
|
nsSVGEnum* mEnums;
|
|
|
|
EnumInfo* mEnumInfo;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mEnumCount;
|
2007-08-28 03:11:14 +04:00
|
|
|
|
|
|
|
EnumAttributesInfo(nsSVGEnum *aEnums,
|
|
|
|
EnumInfo *aEnumInfo,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aEnumCount) :
|
2007-08-28 03:11:14 +04:00
|
|
|
mEnums(aEnums), mEnumInfo(aEnumInfo), mEnumCount(aEnumCount)
|
|
|
|
{}
|
2007-11-22 11:54:31 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2007-08-28 03:11:14 +04:00
|
|
|
};
|
|
|
|
|
2010-12-03 19:40:23 +03:00
|
|
|
struct NumberListInfo {
|
2017-10-27 02:31:13 +03:00
|
|
|
nsStaticAtom** mName;
|
2010-12-03 19:40:23 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct NumberListAttributesInfo {
|
|
|
|
SVGAnimatedNumberList* mNumberLists;
|
|
|
|
NumberListInfo* mNumberListInfo;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mNumberListCount;
|
2010-12-03 19:40:23 +03:00
|
|
|
|
|
|
|
NumberListAttributesInfo(SVGAnimatedNumberList *aNumberLists,
|
|
|
|
NumberListInfo *aNumberListInfo,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aNumberListCount)
|
2010-12-03 19:40:23 +03:00
|
|
|
: mNumberLists(aNumberLists)
|
|
|
|
, mNumberListInfo(aNumberListInfo)
|
|
|
|
, mNumberListCount(aNumberListCount)
|
|
|
|
{}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2010-12-03 19:40:23 +03:00
|
|
|
};
|
|
|
|
|
2010-07-17 01:42:12 +04:00
|
|
|
struct LengthListInfo {
|
2017-10-27 02:31:13 +03:00
|
|
|
nsStaticAtom** mName;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mAxis;
|
2010-07-17 01:42:12 +04: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 10:19:26 +04:00
|
|
|
bool mCouldZeroPadList;
|
2010-07-17 01:42:12 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct LengthListAttributesInfo {
|
2010-11-08 18:07:00 +03:00
|
|
|
SVGAnimatedLengthList* mLengthLists;
|
2010-07-17 01:42:12 +04:00
|
|
|
LengthListInfo* mLengthListInfo;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mLengthListCount;
|
2010-07-17 01:42:12 +04:00
|
|
|
|
2010-11-08 18:07:00 +03:00
|
|
|
LengthListAttributesInfo(SVGAnimatedLengthList *aLengthLists,
|
2010-07-17 01:42:12 +04:00
|
|
|
LengthListInfo *aLengthListInfo,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aLengthListCount)
|
2010-07-17 01:42:12 +04:00
|
|
|
: mLengthLists(aLengthLists)
|
|
|
|
, mLengthListInfo(aLengthListInfo)
|
|
|
|
, mLengthListCount(aLengthListCount)
|
|
|
|
{}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2010-07-17 01:42:12 +04:00
|
|
|
};
|
|
|
|
|
2008-06-14 13:01:02 +04:00
|
|
|
struct StringInfo {
|
2017-10-27 02:31:13 +03:00
|
|
|
nsStaticAtom** mName;
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mNamespaceID;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsAnimatable;
|
2008-06-14 13:01:02 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct StringAttributesInfo {
|
|
|
|
nsSVGString* mStrings;
|
|
|
|
StringInfo* mStringInfo;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mStringCount;
|
2008-06-14 13:01:02 +04:00
|
|
|
|
|
|
|
StringAttributesInfo(nsSVGString *aStrings,
|
|
|
|
StringInfo *aStringInfo,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aStringCount) :
|
2008-06-14 13:01:02 +04:00
|
|
|
mStrings(aStrings), mStringInfo(aStringInfo), mStringCount(aStringCount)
|
|
|
|
{}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2008-06-14 13:01:02 +04:00
|
|
|
};
|
|
|
|
|
2011-12-31 13:44:03 +04:00
|
|
|
friend class mozilla::DOMSVGStringList;
|
|
|
|
|
|
|
|
struct StringListInfo {
|
2017-10-27 02:31:13 +03:00
|
|
|
nsStaticAtom** mName;
|
2011-12-31 13:44:03 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct StringListAttributesInfo {
|
|
|
|
SVGStringList* mStringLists;
|
|
|
|
StringListInfo* mStringListInfo;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mStringListCount;
|
2011-12-31 13:44:03 +04:00
|
|
|
|
|
|
|
StringListAttributesInfo(SVGStringList *aStringLists,
|
|
|
|
StringListInfo *aStringListInfo,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aStringListCount) :
|
2011-12-31 13:44:03 +04:00
|
|
|
mStringLists(aStringLists), mStringListInfo(aStringListInfo),
|
|
|
|
mStringListCount(aStringListCount)
|
|
|
|
{}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void Reset(uint8_t aAttrEnum);
|
2011-12-31 13:44:03 +04:00
|
|
|
};
|
|
|
|
|
2006-04-14 19:09:39 +04:00
|
|
|
virtual LengthAttributesInfo GetLengthInfo();
|
2006-07-28 22:10:48 +04:00
|
|
|
virtual NumberAttributesInfo GetNumberInfo();
|
2011-07-01 11:19:52 +04:00
|
|
|
virtual NumberPairAttributesInfo GetNumberPairInfo();
|
2007-09-18 16:09:26 +04:00
|
|
|
virtual IntegerAttributesInfo GetIntegerInfo();
|
2011-07-01 11:19:52 +04:00
|
|
|
virtual IntegerPairAttributesInfo GetIntegerPairInfo();
|
2007-10-10 14:07:59 +04:00
|
|
|
virtual AngleAttributesInfo GetAngleInfo();
|
2007-09-26 13:22:08 +04:00
|
|
|
virtual BooleanAttributesInfo GetBooleanInfo();
|
|
|
|
virtual EnumAttributesInfo GetEnumInfo();
|
2009-02-03 17:42:24 +03:00
|
|
|
// We assume all viewboxes and preserveAspectRatios are alike
|
|
|
|
// so we don't need to wrap the class
|
|
|
|
virtual nsSVGViewBox *GetViewBox();
|
2010-12-20 03:45:29 +03:00
|
|
|
virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio();
|
2010-12-03 19:40:23 +03:00
|
|
|
virtual NumberListAttributesInfo GetNumberListInfo();
|
2010-07-17 01:42:12 +04:00
|
|
|
virtual LengthListAttributesInfo GetLengthListInfo();
|
2008-06-14 13:01:02 +04:00
|
|
|
virtual StringAttributesInfo GetStringInfo();
|
2011-12-31 13:44:03 +04:00
|
|
|
virtual StringListAttributesInfo GetStringListInfo();
|
2006-04-14 19:09:39 +04:00
|
|
|
|
2007-10-10 14:07:59 +04:00
|
|
|
static nsSVGEnumMapping sSVGUnitTypesMap[];
|
|
|
|
|
2008-06-24 16:54:11 +04:00
|
|
|
private:
|
2017-10-03 01:05:19 +03:00
|
|
|
void UnsetAttrInternal(int32_t aNameSpaceID, nsAtom* aAttribute,
|
2011-10-08 10:32:44 +04:00
|
|
|
bool aNotify);
|
|
|
|
|
2012-12-23 12:22:22 +04:00
|
|
|
nsSVGClass mClassAttribute;
|
|
|
|
nsAutoPtr<nsAttrValue> mClassAnimAttr;
|
2016-12-31 12:10:45 +03:00
|
|
|
RefPtr<mozilla::DeclarationBlock> mContentDeclarationBlock;
|
2001-12-12 10:59:31 +03:00
|
|
|
};
|
|
|
|
|
2004-05-19 00:58:12 +04: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 06:01:40 +04:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) \
|
2004-05-19 00:58:12 +04:00
|
|
|
{ \
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsSVG##_elementName##Element> it = \
|
2008-02-03 02:41:24 +03:00
|
|
|
new nsSVG##_elementName##Element(aNodeInfo); \
|
2004-05-19 00:58:12 +04:00
|
|
|
\
|
2010-01-15 14:44:12 +03:00
|
|
|
nsresult rv = it->Init(); \
|
|
|
|
\
|
|
|
|
if (NS_FAILED(rv)) { \
|
|
|
|
return rv; \
|
|
|
|
} \
|
|
|
|
\
|
2013-01-05 05:50:20 +04: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 06:01:40 +04:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) \
|
2013-01-05 05:50:20 +04:00
|
|
|
{ \
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::dom::SVG##_elementName##Element> it = \
|
2013-01-05 05:50:20 +04:00
|
|
|
new mozilla::dom::SVG##_elementName##Element(aNodeInfo); \
|
|
|
|
\
|
|
|
|
nsresult rv = it->Init(); \
|
|
|
|
\
|
|
|
|
if (NS_FAILED(rv)) { \
|
|
|
|
return rv; \
|
|
|
|
} \
|
|
|
|
\
|
2013-01-05 13:41:28 +04: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 06:01:40 +04:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, \
|
2013-01-05 13:41:28 +04:00
|
|
|
mozilla::dom::FromParser aFromParser) \
|
|
|
|
{ \
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::dom::SVG##_elementName##Element> it = \
|
2013-01-05 13:41:28 +04:00
|
|
|
new mozilla::dom::SVG##_elementName##Element(aNodeInfo, aFromParser); \
|
|
|
|
\
|
|
|
|
nsresult rv = it->Init(); \
|
|
|
|
\
|
2004-05-19 00:58:12 +04:00
|
|
|
if (NS_FAILED(rv)) { \
|
|
|
|
return rv; \
|
|
|
|
} \
|
|
|
|
\
|
2012-07-18 14:36:08 +04:00
|
|
|
it.forget(aResult); \
|
2004-05-19 00:58:12 +04:00
|
|
|
\
|
|
|
|
return rv; \
|
|
|
|
}
|
|
|
|
|
2012-12-23 08:54:22 +04:00
|
|
|
// No unlinking, we'd need to null out the value pointer (the object it
|
2008-12-30 19:32:22 +03: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 05:29:05 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(_val) \
|
2008-12-30 19:32:22 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(_val) \
|
2012-11-15 11:32:40 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(_element) \
|
2008-12-30 19:32:22 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END \
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_0(_val)
|
|
|
|
|
2012-12-23 08:54:22 +04:00
|
|
|
#define NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(_val, _element) \
|
2013-08-02 05:29:05 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(_val) \
|
2012-12-23 08:54:22 +04: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_END \
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(_val) \
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER \
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
2008-12-30 19:32:22 +03:00
|
|
|
|
2001-12-12 10:59:31 +03:00
|
|
|
#endif // __NS_SVGELEMENT_H__
|