mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 664130 - const-ify some SVG element class methods. r=dholbert.
This commit is contained in:
parent
13b7699b24
commit
97132dbab9
@ -1405,7 +1405,7 @@ nsIAtom* nsSVGElement::GetEventNameForAttr(nsIAtom* aAttr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsSVGSVGElement *
|
nsSVGSVGElement *
|
||||||
nsSVGElement::GetCtx()
|
nsSVGElement::GetCtx() const
|
||||||
{
|
{
|
||||||
nsIContent* ancestor = GetFlattenedTreeParent();
|
nsIContent* ancestor = GetFlattenedTreeParent();
|
||||||
|
|
||||||
@ -1425,7 +1425,7 @@ nsSVGElement::GetCtx()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */ gfxMatrix
|
/* virtual */ gfxMatrix
|
||||||
nsSVGElement::PrependLocalTransformTo(const gfxMatrix &aMatrix)
|
nsSVGElement::PrependLocalTransformTo(const gfxMatrix &aMatrix) const
|
||||||
{
|
{
|
||||||
return aMatrix;
|
return aMatrix;
|
||||||
}
|
}
|
||||||
|
@ -152,13 +152,13 @@ public:
|
|||||||
// Gets the element that establishes the rectangular viewport against which
|
// Gets the element that establishes the rectangular viewport against which
|
||||||
// we should resolve percentage lengths (our "coordinate context"). Returns
|
// we should resolve percentage lengths (our "coordinate context"). Returns
|
||||||
// nsnull for outer <svg> or SVG without an <svg> parent (invalid SVG).
|
// nsnull for outer <svg> or SVG without an <svg> parent (invalid SVG).
|
||||||
nsSVGSVGElement* GetCtx();
|
nsSVGSVGElement* GetCtx() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns aMatrix post-multiplied by the transform from the userspace
|
* Returns aMatrix post-multiplied by the transform from the userspace
|
||||||
* established by this element to the userspace established by its parent.
|
* established by this element to the userspace established by its parent.
|
||||||
*/
|
*/
|
||||||
virtual gfxMatrix PrependLocalTransformTo(const gfxMatrix &aMatrix);
|
virtual gfxMatrix PrependLocalTransformTo(const gfxMatrix &aMatrix) const;
|
||||||
|
|
||||||
// Setter for to set the current <animateMotion> transformation
|
// Setter for to set the current <animateMotion> transformation
|
||||||
// Only visible for nsSVGGraphicElement, so it's a no-op here, and that
|
// Only visible for nsSVGGraphicElement, so it's a no-op here, and that
|
||||||
|
@ -108,13 +108,14 @@ NS_IMETHODIMP nsSVGForeignObjectElement::GetHeight(nsIDOMSVGAnimatedLength * *aH
|
|||||||
// nsSVGElement methods
|
// nsSVGElement methods
|
||||||
|
|
||||||
/* virtual */ gfxMatrix
|
/* virtual */ gfxMatrix
|
||||||
nsSVGForeignObjectElement::PrependLocalTransformTo(const gfxMatrix &aMatrix)
|
nsSVGForeignObjectElement::PrependLocalTransformTo(const gfxMatrix &aMatrix) const
|
||||||
{
|
{
|
||||||
// 'transform' attribute:
|
// 'transform' attribute:
|
||||||
gfxMatrix matrix = nsSVGForeignObjectElementBase::PrependLocalTransformTo(aMatrix);
|
gfxMatrix matrix = nsSVGForeignObjectElementBase::PrependLocalTransformTo(aMatrix);
|
||||||
|
|
||||||
// now translate by our 'x' and 'y':
|
// now translate by our 'x' and 'y':
|
||||||
float x, y;
|
float x, y;
|
||||||
|
const_cast<nsSVGForeignObjectElement*>(this)->
|
||||||
GetAnimatedLengthValues(&x, &y, nsnull);
|
GetAnimatedLengthValues(&x, &y, nsnull);
|
||||||
return gfxMatrix().Translate(gfxPoint(x, y)) * matrix;
|
return gfxMatrix().Translate(gfxPoint(x, y)) * matrix;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ public:
|
|||||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGForeignObjectElementBase::)
|
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGForeignObjectElementBase::)
|
||||||
|
|
||||||
// nsSVGElement specializations:
|
// nsSVGElement specializations:
|
||||||
virtual gfxMatrix PrependLocalTransformTo(const gfxMatrix &aMatrix);
|
virtual gfxMatrix PrependLocalTransformTo(const gfxMatrix &aMatrix) const;
|
||||||
|
|
||||||
// nsIContent interface
|
// nsIContent interface
|
||||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
||||||
|
@ -184,7 +184,7 @@ nsSVGGraphicElement::IsEventName(nsIAtom* aName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gfxMatrix
|
gfxMatrix
|
||||||
nsSVGGraphicElement::PrependLocalTransformTo(const gfxMatrix &aMatrix)
|
nsSVGGraphicElement::PrependLocalTransformTo(const gfxMatrix &aMatrix) const
|
||||||
{
|
{
|
||||||
gfxMatrix result(aMatrix);
|
gfxMatrix result(aMatrix);
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ public:
|
|||||||
// nsIContent interface
|
// nsIContent interface
|
||||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||||
|
|
||||||
virtual gfxMatrix PrependLocalTransformTo(const gfxMatrix &aMatrix);
|
virtual gfxMatrix PrependLocalTransformTo(const gfxMatrix &aMatrix) const;
|
||||||
virtual void SetAnimateMotionTransform(const gfxMatrix* aMatrix);
|
virtual void SetAnimateMotionTransform(const gfxMatrix* aMatrix);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -952,22 +952,22 @@ nsSVGSVGElement::IsEventName(nsIAtom* aName)
|
|||||||
// resolve percentage lengths. (It can only be used to resolve
|
// resolve percentage lengths. (It can only be used to resolve
|
||||||
// 'em'/'ex'-valued units).
|
// 'em'/'ex'-valued units).
|
||||||
inline float
|
inline float
|
||||||
ComputeSynthesizedViewBoxDimension(nsSVGLength2& aLength,
|
ComputeSynthesizedViewBoxDimension(const nsSVGLength2& aLength,
|
||||||
float aViewportLength,
|
float aViewportLength,
|
||||||
nsSVGSVGElement* aSelf)
|
const nsSVGSVGElement* aSelf)
|
||||||
{
|
{
|
||||||
if (aLength.IsPercentage()) {
|
if (aLength.IsPercentage()) {
|
||||||
return aViewportLength * aLength.GetAnimValInSpecifiedUnits() / 100.0f;
|
return aViewportLength * aLength.GetAnimValInSpecifiedUnits() / 100.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
return aLength.GetAnimValue(aSelf);
|
return aLength.GetAnimValue(const_cast<nsSVGSVGElement*>(aSelf));
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// public helpers:
|
// public helpers:
|
||||||
|
|
||||||
gfxMatrix
|
gfxMatrix
|
||||||
nsSVGSVGElement::GetViewBoxTransform()
|
nsSVGSVGElement::GetViewBoxTransform() const
|
||||||
{
|
{
|
||||||
// Do we have an override preserveAspectRatio value?
|
// Do we have an override preserveAspectRatio value?
|
||||||
const SVGPreserveAspectRatio* overridePARPtr =
|
const SVGPreserveAspectRatio* overridePARPtr =
|
||||||
@ -1178,11 +1178,11 @@ nsSVGSVGElement::GetLength(PRUint8 aCtxType)
|
|||||||
// nsSVGElement methods
|
// nsSVGElement methods
|
||||||
|
|
||||||
/* virtual */ gfxMatrix
|
/* virtual */ gfxMatrix
|
||||||
nsSVGSVGElement::PrependLocalTransformTo(const gfxMatrix &aMatrix)
|
nsSVGSVGElement::PrependLocalTransformTo(const gfxMatrix &aMatrix) const
|
||||||
{
|
{
|
||||||
if (IsInner()) {
|
if (IsInner()) {
|
||||||
float x, y;
|
float x, y;
|
||||||
GetAnimatedLengthValues(&x, &y, nsnull);
|
const_cast<nsSVGSVGElement*>(this)->GetAnimatedLengthValues(&x, &y, nsnull);
|
||||||
return GetViewBoxTransform() * gfxMatrix().Translate(gfxPoint(x, y)) * aMatrix;
|
return GetViewBoxTransform() * gfxMatrix().Translate(gfxPoint(x, y)) * aMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1272,7 +1272,7 @@ nsSVGSVGElement::GetPreserveAspectRatio()
|
|||||||
}
|
}
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
nsSVGSVGElement::ShouldSynthesizeViewBox()
|
nsSVGSVGElement::ShouldSynthesizeViewBox() const
|
||||||
{
|
{
|
||||||
NS_ABORT_IF_FALSE(!HasValidViewbox(),
|
NS_ABORT_IF_FALSE(!HasValidViewbox(),
|
||||||
"Should only be called if we lack a viewBox");
|
"Should only be called if we lack a viewBox");
|
||||||
@ -1361,7 +1361,7 @@ nsSVGSVGElement::ClearImageOverridePreserveAspectRatio()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const SVGPreserveAspectRatio*
|
const SVGPreserveAspectRatio*
|
||||||
nsSVGSVGElement::GetImageOverridePreserveAspectRatio()
|
nsSVGSVGElement::GetImageOverridePreserveAspectRatio() const
|
||||||
{
|
{
|
||||||
void* valPtr = GetProperty(nsGkAtoms::overridePreserveAspectRatio);
|
void* valPtr = GetProperty(nsGkAtoms::overridePreserveAspectRatio);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -192,7 +192,7 @@ public:
|
|||||||
#endif // MOZ_SMIL
|
#endif // MOZ_SMIL
|
||||||
|
|
||||||
// nsSVGElement specializations:
|
// nsSVGElement specializations:
|
||||||
virtual gfxMatrix PrependLocalTransformTo(const gfxMatrix &aMatrix);
|
virtual gfxMatrix PrependLocalTransformTo(const gfxMatrix &aMatrix) const;
|
||||||
virtual void DidChangeLength(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
virtual void DidChangeLength(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||||
virtual void DidChangeEnum(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
virtual void DidChangeEnum(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||||
virtual void DidChangeViewBox(PRBool aDoSetAttr);
|
virtual void DidChangeViewBox(PRBool aDoSetAttr);
|
||||||
@ -205,7 +205,7 @@ public:
|
|||||||
float GetLength(PRUint8 mCtxType);
|
float GetLength(PRUint8 mCtxType);
|
||||||
|
|
||||||
// public helpers:
|
// public helpers:
|
||||||
gfxMatrix GetViewBoxTransform();
|
gfxMatrix GetViewBoxTransform() const;
|
||||||
PRBool HasValidViewbox() const { return mViewBox.IsValid(); }
|
PRBool HasValidViewbox() const { return mViewBox.IsValid(); }
|
||||||
|
|
||||||
// This services any pending notifications for the transform on on this root
|
// This services any pending notifications for the transform on on this root
|
||||||
@ -232,13 +232,13 @@ private:
|
|||||||
// particular) have access.
|
// particular) have access.
|
||||||
void SetImageOverridePreserveAspectRatio(const SVGPreserveAspectRatio& aPAR);
|
void SetImageOverridePreserveAspectRatio(const SVGPreserveAspectRatio& aPAR);
|
||||||
void ClearImageOverridePreserveAspectRatio();
|
void ClearImageOverridePreserveAspectRatio();
|
||||||
const SVGPreserveAspectRatio* GetImageOverridePreserveAspectRatio();
|
const SVGPreserveAspectRatio* GetImageOverridePreserveAspectRatio() const;
|
||||||
|
|
||||||
// Returns PR_TRUE if we should synthesize a viewBox for ourselves (that is,
|
// Returns PR_TRUE if we should synthesize a viewBox for ourselves (that is,
|
||||||
// if we're the outermost <svg> in an image document, and we're not currently
|
// if we're the outermost <svg> in an image document, and we're not currently
|
||||||
// being painted by an <svg:image> element). This method also assumes that we
|
// being painted by an <svg:image> element). This method also assumes that we
|
||||||
// lack a valid viewBox attribute.
|
// lack a valid viewBox attribute.
|
||||||
PRBool ShouldSynthesizeViewBox();
|
PRBool ShouldSynthesizeViewBox() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// nsSVGElement overrides
|
// nsSVGElement overrides
|
||||||
@ -253,7 +253,7 @@ protected:
|
|||||||
|
|
||||||
// implementation helpers:
|
// implementation helpers:
|
||||||
|
|
||||||
PRBool IsRoot() {
|
PRBool IsRoot() const {
|
||||||
NS_ASSERTION((IsInDoc() && !GetParent()) ==
|
NS_ASSERTION((IsInDoc() && !GetParent()) ==
|
||||||
(GetOwnerDoc() && (GetOwnerDoc()->GetRootElement() == this)),
|
(GetOwnerDoc() && (GetOwnerDoc()->GetRootElement() == this)),
|
||||||
"Can't determine if we're root");
|
"Can't determine if we're root");
|
||||||
@ -264,7 +264,7 @@ protected:
|
|||||||
* Returns true if this is an SVG <svg> element that is the child of
|
* Returns true if this is an SVG <svg> element that is the child of
|
||||||
* another non-foreignObject SVG element.
|
* another non-foreignObject SVG element.
|
||||||
*/
|
*/
|
||||||
PRBool IsInner() {
|
PRBool IsInner() const {
|
||||||
const nsIContent *parent = GetFlattenedTreeParent();
|
const nsIContent *parent = GetFlattenedTreeParent();
|
||||||
return parent && parent->GetNameSpaceID() == kNameSpaceID_SVG &&
|
return parent && parent->GetNameSpaceID() == kNameSpaceID_SVG &&
|
||||||
parent->Tag() != nsGkAtoms::foreignObject;
|
parent->Tag() != nsGkAtoms::foreignObject;
|
||||||
|
@ -480,14 +480,14 @@ nsSVGUseElement::UnlinkSource()
|
|||||||
// nsSVGElement methods
|
// nsSVGElement methods
|
||||||
|
|
||||||
/* virtual */ gfxMatrix
|
/* virtual */ gfxMatrix
|
||||||
nsSVGUseElement::PrependLocalTransformTo(const gfxMatrix &aMatrix)
|
nsSVGUseElement::PrependLocalTransformTo(const gfxMatrix &aMatrix) const
|
||||||
{
|
{
|
||||||
// 'transform' attribute:
|
// 'transform' attribute:
|
||||||
gfxMatrix matrix = nsSVGUseElementBase::PrependLocalTransformTo(aMatrix);
|
gfxMatrix matrix = nsSVGUseElementBase::PrependLocalTransformTo(aMatrix);
|
||||||
|
|
||||||
// now translate by our 'x' and 'y':
|
// now translate by our 'x' and 'y':
|
||||||
float x, y;
|
float x, y;
|
||||||
GetAnimatedLengthValues(&x, &y, nsnull);
|
const_cast<nsSVGUseElement*>(this)->GetAnimatedLengthValues(&x, &y, nsnull);
|
||||||
return matrix.PreMultiply(gfxMatrix().Translate(gfxPoint(x, y)));
|
return matrix.PreMultiply(gfxMatrix().Translate(gfxPoint(x, y)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ public:
|
|||||||
void DestroyAnonymousContent();
|
void DestroyAnonymousContent();
|
||||||
|
|
||||||
// nsSVGElement specializations:
|
// nsSVGElement specializations:
|
||||||
virtual gfxMatrix PrependLocalTransformTo(const gfxMatrix &aMatrix);
|
virtual gfxMatrix PrependLocalTransformTo(const gfxMatrix &aMatrix) const;
|
||||||
virtual void DidChangeLength(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
virtual void DidChangeLength(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||||
virtual void DidChangeString(PRUint8 aAttrEnum);
|
virtual void DidChangeString(PRUint8 aAttrEnum);
|
||||||
virtual void DidAnimateString(PRUint8 aAttrEnum);
|
virtual void DidAnimateString(PRUint8 aAttrEnum);
|
||||||
|
@ -749,7 +749,7 @@ nsSVGUtils::GetOuterSVGFrameAndCoveredRegion(nsIFrame* aFrame, nsRect* aRect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gfxMatrix
|
gfxMatrix
|
||||||
nsSVGUtils::GetViewBoxTransform(nsSVGElement* aElement,
|
nsSVGUtils::GetViewBoxTransform(const nsSVGElement* aElement,
|
||||||
float aViewportWidth, float aViewportHeight,
|
float aViewportWidth, float aViewportHeight,
|
||||||
float aViewboxX, float aViewboxY,
|
float aViewboxX, float aViewboxY,
|
||||||
float aViewboxWidth, float aViewboxHeight,
|
float aViewboxWidth, float aViewboxHeight,
|
||||||
@ -763,7 +763,7 @@ nsSVGUtils::GetViewBoxTransform(nsSVGElement* aElement,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gfxMatrix
|
gfxMatrix
|
||||||
nsSVGUtils::GetViewBoxTransform(nsSVGElement* aElement,
|
nsSVGUtils::GetViewBoxTransform(const nsSVGElement* aElement,
|
||||||
float aViewportWidth, float aViewportHeight,
|
float aViewportWidth, float aViewportHeight,
|
||||||
float aViewboxX, float aViewboxY,
|
float aViewboxX, float aViewboxY,
|
||||||
float aViewboxWidth, float aViewboxHeight,
|
float aViewboxWidth, float aViewboxHeight,
|
||||||
|
@ -382,14 +382,14 @@ public:
|
|||||||
/* Generate a viewbox to viewport tranformation matrix */
|
/* Generate a viewbox to viewport tranformation matrix */
|
||||||
|
|
||||||
static gfxMatrix
|
static gfxMatrix
|
||||||
GetViewBoxTransform(nsSVGElement* aElement,
|
GetViewBoxTransform(const nsSVGElement* aElement,
|
||||||
float aViewportWidth, float aViewportHeight,
|
float aViewportWidth, float aViewportHeight,
|
||||||
float aViewboxX, float aViewboxY,
|
float aViewboxX, float aViewboxY,
|
||||||
float aViewboxWidth, float aViewboxHeight,
|
float aViewboxWidth, float aViewboxHeight,
|
||||||
const SVGAnimatedPreserveAspectRatio &aPreserveAspectRatio);
|
const SVGAnimatedPreserveAspectRatio &aPreserveAspectRatio);
|
||||||
|
|
||||||
static gfxMatrix
|
static gfxMatrix
|
||||||
GetViewBoxTransform(nsSVGElement* aElement,
|
GetViewBoxTransform(const nsSVGElement* aElement,
|
||||||
float aViewportWidth, float aViewportHeight,
|
float aViewportWidth, float aViewportHeight,
|
||||||
float aViewboxX, float aViewboxY,
|
float aViewboxX, float aViewboxY,
|
||||||
float aViewboxWidth, float aViewboxHeight,
|
float aViewboxWidth, float aViewboxHeight,
|
||||||
|
Loading…
Reference in New Issue
Block a user