Bug 282194 : Add null checks to methods that take SVG objects as arguments : r=tor

This commit is contained in:
jwatt%jwatt.org 2005-02-16 18:39:59 +00:00
Родитель 330fa6dc4b
Коммит 3092d10fa2
14 изменённых файлов: 196 добавлений и 54 удалений

Просмотреть файл

@ -308,6 +308,10 @@ NS_IMETHODIMP nsSVGGraphicElement::GetScreenCTM(nsIDOMSVGMatrix **_retval)
/* nsIDOMSVGMatrix getTransformToElement (in nsIDOMSVGElement element); */
NS_IMETHODIMP nsSVGGraphicElement::GetTransformToElement(nsIDOMSVGElement *element, nsIDOMSVGMatrix **_retval)
{
// null check when implementing - this method can be used by scripts!
// if (!element)
// return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -494,6 +494,11 @@ nsSVGLength::GetTransformedValue(nsIDOMSVGMatrix *matrix,
// or is it used like a vector-component (in which case it doesn't
// translate)
// maybe we should remove this method since it isn't part of the spec?
// if not, null check when implementing - this method can be used by scripts!
// if (!matrix)
// return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -211,8 +211,13 @@ NS_IMETHODIMP nsSVGLengthList::Clear()
}
/* nsIDOMSVGLength initialize (in nsIDOMSVGLength newItem); */
NS_IMETHODIMP nsSVGLengthList::Initialize(nsIDOMSVGLength *newItem, nsIDOMSVGLength **_retval)
NS_IMETHODIMP nsSVGLengthList::Initialize(nsIDOMSVGLength *newItem,
nsIDOMSVGLength **_retval)
{
if (!newItem) {
*_retval = nsnull;
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
}
Clear();
return AppendItem(newItem, _retval);
}
@ -232,16 +237,28 @@ NS_IMETHODIMP nsSVGLengthList::GetItem(PRUint32 index, nsIDOMSVGLength **_retval
/* nsIDOMSVGLength insertItemBefore (in nsIDOMSVGLength newItem, in unsigned long index); */
NS_IMETHODIMP
nsSVGLengthList::InsertItemBefore(nsIDOMSVGLength *newItem, PRUint32 index, nsIDOMSVGLength **_retval)
nsSVGLengthList::InsertItemBefore(nsIDOMSVGLength *newItem,
PRUint32 index,
nsIDOMSVGLength **_retval)
{
// null check when implementing - this method can be used by scripts!
// if (!newItem)
// return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
NS_NOTYETIMPLEMENTED("write me");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGLength replaceItem (in nsIDOMSVGLength newItem, in unsigned long index); */
NS_IMETHODIMP
nsSVGLengthList::ReplaceItem(nsIDOMSVGLength *newItem, PRUint32 index, nsIDOMSVGLength **_retval)
nsSVGLengthList::ReplaceItem(nsIDOMSVGLength *newItem,
PRUint32 index,
nsIDOMSVGLength **_retval)
{
// null check when implementing - this method can be used by scripts!
// if (!newItem)
// return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -268,9 +285,8 @@ nsSVGLengthList::AppendItem(nsIDOMSVGLength *newItem, nsIDOMSVGLength **_retval)
{
nsCOMPtr<nsISVGLength> length = do_QueryInterface(newItem);
if (!length) {
NS_ERROR("length doesn't implement required interface");
*_retval = nsnull;
return NS_ERROR_FAILURE;
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
}
AppendElement(length);

Просмотреть файл

@ -52,6 +52,7 @@
#include "nsSVGAnimatedPreserveAspectRatio.h"
#include "nsSVGPreserveAspectRatio.h"
#include "nsSVGMatrix.h"
#include "nsDOMError.h"
typedef nsSVGGraphicElement nsSVGMarkerElementBase;
@ -368,6 +369,9 @@ NS_IMETHODIMP nsSVGMarkerElement::SetOrientToAuto()
/* void setOrientToAngle (in nsIDOMSVGAngle angle); */
NS_IMETHODIMP nsSVGMarkerElement::SetOrientToAngle(nsIDOMSVGAngle *angle)
{
if (!angle)
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
mOrientType->SetBaseVal(SVG_MARKER_ORIENT_ANGLE);
nsIDOMSVGAngle *a;

Просмотреть файл

@ -189,10 +189,12 @@ NS_IMETHODIMP nsSVGMatrix::SetF(float aF)
}
/* nsIDOMSVGMatrix multiply (in nsIDOMSVGMatrix secondMatrix); */
NS_IMETHODIMP nsSVGMatrix::Multiply(nsIDOMSVGMatrix *secondMatrix, nsIDOMSVGMatrix **_retval)
NS_IMETHODIMP nsSVGMatrix::Multiply(nsIDOMSVGMatrix *secondMatrix,
nsIDOMSVGMatrix **_retval)
{
if (!secondMatrix) return NS_ERROR_FAILURE;
if (!secondMatrix)
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
float sa,sb,sc,sd,se,sf;
secondMatrix->GetA(&sa);
secondMatrix->GetB(&sb);

Просмотреть файл

@ -209,8 +209,13 @@ NS_IMETHODIMP nsSVGNumberList::Clear()
}
/* nsIDOMSVGNumber initialize (in nsIDOMSVGNumber newItem); */
NS_IMETHODIMP nsSVGNumberList::Initialize(nsIDOMSVGNumber *newItem, nsIDOMSVGNumber **_retval)
NS_IMETHODIMP nsSVGNumberList::Initialize(nsIDOMSVGNumber *newItem,
nsIDOMSVGNumber **_retval)
{
if (!newItem) {
*_retval = nsnull;
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
}
Clear();
return AppendItem(newItem, _retval);
}
@ -230,11 +235,15 @@ NS_IMETHODIMP nsSVGNumberList::GetItem(PRUint32 index, nsIDOMSVGNumber **_retval
/* nsIDOMSVGNumber insertItemBefore (in nsIDOMSVGNumber newItem, in unsigned long index); */
NS_IMETHODIMP
nsSVGNumberList::InsertItemBefore(nsIDOMSVGNumber *newItem, PRUint32 index, nsIDOMSVGNumber **_retval)
nsSVGNumberList::InsertItemBefore(nsIDOMSVGNumber *newItem,
PRUint32 index,
nsIDOMSVGNumber **_retval)
{
*_retval = newItem;
if (!newItem)
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
if (!newItem) return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
nsSVGValueAutoNotifier autonotifier(this);
PRInt32 idx = index;
PRInt32 count = mNumbers.Count();
@ -250,8 +259,15 @@ nsSVGNumberList::InsertItemBefore(nsIDOMSVGNumber *newItem, PRUint32 index, nsID
/* nsIDOMSVGNumber replaceItem (in nsIDOMSVGNumber newItem, in unsigned long index); */
NS_IMETHODIMP
nsSVGNumberList::ReplaceItem(nsIDOMSVGNumber *newItem, PRUint32 index, nsIDOMSVGNumber **_retval)
nsSVGNumberList::ReplaceItem(nsIDOMSVGNumber *newItem,
PRUint32 index,
nsIDOMSVGNumber **_retval)
{
if (!newItem) {
*_retval = nsnull;
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
}
nsresult rv = RemoveItem(index, _retval);
if (NS_FAILED(rv))
return rv;
@ -279,15 +295,10 @@ NS_IMETHODIMP nsSVGNumberList::RemoveItem(PRUint32 index, nsIDOMSVGNumber **_ret
NS_IMETHODIMP
nsSVGNumberList::AppendItem(nsIDOMSVGNumber *newItem, nsIDOMSVGNumber **_retval)
{
nsCOMPtr<nsIDOMSVGNumber> number = do_QueryInterface(newItem);
if (!number) {
NS_ERROR("number doesn't implement required interface");
*_retval = nsnull;
return NS_ERROR_FAILURE;
}
AppendElement(number);
*_retval = newItem;
if (!newItem)
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
AppendElement(newItem);
NS_ADDREF(*_retval);
return NS_OK;
}

Просмотреть файл

@ -209,8 +209,13 @@ NS_IMETHODIMP nsSVGPathSegList::Clear()
}
/* nsIDOMSVGPathSeg initialize (in nsIDOMSVGPathSeg newItem); */
NS_IMETHODIMP nsSVGPathSegList::Initialize(nsIDOMSVGPathSeg *newItem, nsIDOMSVGPathSeg **_retval)
NS_IMETHODIMP nsSVGPathSegList::Initialize(nsIDOMSVGPathSeg *newItem,
nsIDOMSVGPathSeg **_retval)
{
if (!newItem) {
*_retval = nsnull;
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
}
Clear();
return AppendItem(newItem, _retval);
}
@ -229,15 +234,27 @@ NS_IMETHODIMP nsSVGPathSegList::GetItem(PRUint32 index, nsIDOMSVGPathSeg **_retv
}
/* nsIDOMSVGPathSeg insertItemBefore (in nsIDOMSVGPathSeg newItem, in unsigned long index); */
NS_IMETHODIMP nsSVGPathSegList::InsertItemBefore(nsIDOMSVGPathSeg *newItem, PRUint32 index, nsIDOMSVGPathSeg **_retval)
NS_IMETHODIMP nsSVGPathSegList::InsertItemBefore(nsIDOMSVGPathSeg *newItem,
PRUint32 index,
nsIDOMSVGPathSeg **_retval)
{
// null check when implementing - this method can be used by scripts!
// if (!newItem)
// return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
NS_NOTYETIMPLEMENTED("write me");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGPathSeg replaceItem (in nsIDOMSVGPathSeg newItem, in unsigned long index); */
NS_IMETHODIMP nsSVGPathSegList::ReplaceItem(nsIDOMSVGPathSeg *newItem, PRUint32 index, nsIDOMSVGPathSeg **_retval)
NS_IMETHODIMP nsSVGPathSegList::ReplaceItem(nsIDOMSVGPathSeg *newItem,
PRUint32 index,
nsIDOMSVGPathSeg **_retval)
{
// null check when implementing - this method can be used by scripts!
// if (!newItem)
// return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -259,15 +276,18 @@ NS_IMETHODIMP nsSVGPathSegList::RemoveItem(PRUint32 index, nsIDOMSVGPathSeg **_r
}
/* nsIDOMSVGPathSeg appendItem (in nsIDOMSVGPathSeg newItem); */
NS_IMETHODIMP nsSVGPathSegList::AppendItem(nsIDOMSVGPathSeg *newItem, nsIDOMSVGPathSeg **_retval)
NS_IMETHODIMP nsSVGPathSegList::AppendItem(nsIDOMSVGPathSeg *newItem,
nsIDOMSVGPathSeg **_retval)
{
// XXX The SVG specs state that 'if newItem is already in a list, it
// is removed from its previous list before it is inserted into this
// list'. We don't do that. Should we?
*_retval = newItem;
NS_ADDREF(*_retval);
if (!newItem)
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
AppendElement(newItem);
NS_ADDREF(*_retval);
return NS_OK;
}

Просмотреть файл

@ -40,6 +40,7 @@
#include "nsIDOMSVGMatrix.h"
#include "nsSVGValue.h"
#include "nsContentUtils.h"
#include "nsDOMError.h"
class nsSVGPoint : public nsIDOMSVGPoint,
public nsSVGValue
@ -128,10 +129,12 @@ NS_IMETHODIMP nsSVGPoint::SetY(float aY)
}
/* nsIDOMSVGPoint matrixTransform (in nsIDOMSVGMatrix matrix); */
NS_IMETHODIMP nsSVGPoint::MatrixTransform(nsIDOMSVGMatrix *matrix, nsIDOMSVGPoint **_retval)
NS_IMETHODIMP nsSVGPoint::MatrixTransform(nsIDOMSVGMatrix *matrix,
nsIDOMSVGPoint **_retval)
{
if (!matrix) return NS_ERROR_FAILURE;
if (!matrix)
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
float a, b, c, d, e, f;
matrix->GetA(&a);
matrix->GetB(&b);

Просмотреть файл

@ -263,8 +263,13 @@ NS_IMETHODIMP nsSVGPointList::Clear()
}
/* nsIDOMSVGPoint initialize (in nsIDOMSVGPoint newItem); */
NS_IMETHODIMP nsSVGPointList::Initialize(nsIDOMSVGPoint *newItem, nsIDOMSVGPoint **_retval)
NS_IMETHODIMP nsSVGPointList::Initialize(nsIDOMSVGPoint *newItem,
nsIDOMSVGPoint **_retval)
{
if (!newItem) {
*_retval = nsnull;
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
}
Clear();
return AppendItem(newItem, _retval);
}
@ -283,15 +288,27 @@ NS_IMETHODIMP nsSVGPointList::GetItem(PRUint32 index, nsIDOMSVGPoint **_retval)
}
/* nsIDOMSVGPoint insertItemBefore (in nsIDOMSVGPoint newItem, in unsigned long index); */
NS_IMETHODIMP nsSVGPointList::InsertItemBefore(nsIDOMSVGPoint *newItem, PRUint32 index, nsIDOMSVGPoint **_retval)
NS_IMETHODIMP nsSVGPointList::InsertItemBefore(nsIDOMSVGPoint *newItem,
PRUint32 index,
nsIDOMSVGPoint **_retval)
{
// null check when implementing - this method can be used by scripts!
// if (!newItem)
// return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
NS_NOTYETIMPLEMENTED("write me");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGPoint replaceItem (in nsIDOMSVGPoint newItem, in unsigned long index); */
NS_IMETHODIMP nsSVGPointList::ReplaceItem(nsIDOMSVGPoint *newItem, PRUint32 index, nsIDOMSVGPoint **_retval)
NS_IMETHODIMP nsSVGPointList::ReplaceItem(nsIDOMSVGPoint *newItem,
PRUint32 index,
nsIDOMSVGPoint **_retval)
{
// null check when implementing - this method can be used by scripts!
// if (!newItem)
// return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
NS_NOTYETIMPLEMENTED("write me");
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -313,15 +330,18 @@ NS_IMETHODIMP nsSVGPointList::RemoveItem(PRUint32 index, nsIDOMSVGPoint **_retva
}
/* nsIDOMSVGPoint appendItem (in nsIDOMSVGPoint newItem); */
NS_IMETHODIMP nsSVGPointList::AppendItem(nsIDOMSVGPoint *newItem, nsIDOMSVGPoint **_retval)
NS_IMETHODIMP nsSVGPointList::AppendItem(nsIDOMSVGPoint *newItem,
nsIDOMSVGPoint **_retval)
{
// XXX The SVG specs state that 'if newItem is already in a list, it
// is removed from its previous list before it is inserted into this
// list'. We don't do that. Should we?
*_retval = newItem;
NS_ADDREF(*_retval);
if (!newItem)
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
AppendElement(newItem);
NS_ADDREF(*_retval);
return NS_OK;
}

Просмотреть файл

@ -630,32 +630,56 @@ nsSVGSVGElement::SetCurrentTime(float seconds)
/* nsIDOMNodeList getIntersectionList (in nsIDOMSVGRect rect, in nsIDOMSVGElement referenceElement); */
NS_IMETHODIMP
nsSVGSVGElement::GetIntersectionList(nsIDOMSVGRect *rect, nsIDOMSVGElement *referenceElement, nsIDOMNodeList **_retval)
nsSVGSVGElement::GetIntersectionList(nsIDOMSVGRect *rect,
nsIDOMSVGElement *referenceElement,
nsIDOMNodeList **_retval)
{
// null check when implementing - this method can be used by scripts!
// if (!rect || !referenceElement)
// return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMNodeList getEnclosureList (in nsIDOMSVGRect rect, in nsIDOMSVGElement referenceElement); */
NS_IMETHODIMP
nsSVGSVGElement::GetEnclosureList(nsIDOMSVGRect *rect, nsIDOMSVGElement *referenceElement, nsIDOMNodeList **_retval)
nsSVGSVGElement::GetEnclosureList(nsIDOMSVGRect *rect,
nsIDOMSVGElement *referenceElement,
nsIDOMNodeList **_retval)
{
// null check when implementing - this method can be used by scripts!
// if (!rect || !referenceElement)
// return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean checkIntersection (in nsIDOMSVGElement element, in nsIDOMSVGRect rect); */
NS_IMETHODIMP
nsSVGSVGElement::CheckIntersection(nsIDOMSVGElement *element, nsIDOMSVGRect *rect, PRBool *_retval)
nsSVGSVGElement::CheckIntersection(nsIDOMSVGElement *element,
nsIDOMSVGRect *rect,
PRBool *_retval)
{
// null check when implementing - this method can be used by scripts!
// if (!element || !rect)
// return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean checkEnclosure (in nsIDOMSVGElement element, in nsIDOMSVGRect rect); */
NS_IMETHODIMP
nsSVGSVGElement::CheckEnclosure(nsIDOMSVGElement *element, nsIDOMSVGRect *rect, PRBool *_retval)
nsSVGSVGElement::CheckEnclosure(nsIDOMSVGElement *element,
nsIDOMSVGRect *rect,
PRBool *_retval)
{
// null check when implementing - this method can be used by scripts!
// if (!element || !rect)
// return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -723,6 +747,9 @@ NS_IMETHODIMP
nsSVGSVGElement::CreateSVGTransformFromMatrix(nsIDOMSVGMatrix *matrix,
nsIDOMSVGTransform **_retval)
{
if (!matrix)
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
nsresult rv = NS_NewSVGTransform(_retval);
if (NS_FAILED(rv))
return rv;
@ -1118,8 +1145,13 @@ nsSVGSVGElement::GetScreenCTM(nsIDOMSVGMatrix **_retval)
/* nsIDOMSVGMatrix getTransformToElement (in nsIDOMSVGElement element); */
NS_IMETHODIMP
nsSVGSVGElement::GetTransformToElement(nsIDOMSVGElement *element, nsIDOMSVGMatrix **_retval)
nsSVGSVGElement::GetTransformToElement(nsIDOMSVGElement *element,
nsIDOMSVGMatrix **_retval)
{
// null check when implementing - this method can be used by scripts!
// if (!element)
// return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -275,8 +275,13 @@ NS_IMETHODIMP nsSVGTSpanElement::GetRotationOfChar(PRUint32 charnum, float *_ret
}
/* long getCharNumAtPosition (in nsIDOMSVGPoint point); */
NS_IMETHODIMP nsSVGTSpanElement::GetCharNumAtPosition(nsIDOMSVGPoint *point, PRInt32 *_retval)
NS_IMETHODIMP nsSVGTSpanElement::GetCharNumAtPosition(nsIDOMSVGPoint *point,
PRInt32 *_retval)
{
// null check when implementing - this method can be used by scripts!
// if (!point)
// return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}

Просмотреть файл

@ -295,6 +295,10 @@ NS_IMETHODIMP nsSVGTextElement::GetRotationOfChar(PRUint32 charnum, float *_retv
/* long getCharNumAtPosition (in nsIDOMSVGPoint point); */
NS_IMETHODIMP nsSVGTextElement::GetCharNumAtPosition(nsIDOMSVGPoint *point, PRInt32 *_retval)
{
// null check when implementing - this method can be used by scripts!
// if (!element)
// return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}

Просмотреть файл

@ -45,6 +45,7 @@
#include "nsSVGMatrix.h"
#include "nsTextFormatter.h"
#include "nsContentUtils.h"
#include "nsDOMError.h"
////////////////////////////////////////////////////////////////////////
@ -244,8 +245,9 @@ NS_IMETHODIMP nsSVGTransform::GetAngle(float *aAngle)
/* void setMatrix (in nsIDOMSVGMatrix matrix); */
NS_IMETHODIMP nsSVGTransform::SetMatrix(nsIDOMSVGMatrix *matrix)
{
NS_ENSURE_ARG(matrix);
if (!matrix)
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
WillModify();
mType = SVG_TRANSFORM_MATRIX;

Просмотреть файл

@ -350,12 +350,14 @@ NS_IMETHODIMP nsSVGTransformList::Clear()
}
/* nsIDOMSVGTransform initialize (in nsIDOMSVGTransform newItem); */
NS_IMETHODIMP nsSVGTransformList::Initialize(nsIDOMSVGTransform *newItem, nsIDOMSVGTransform **_retval)
NS_IMETHODIMP nsSVGTransformList::Initialize(nsIDOMSVGTransform *newItem,
nsIDOMSVGTransform **_retval)
{
nsSVGValueAutoNotifier autonotifier(this);
*_retval = newItem;
if (!newItem)
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
if (!newItem) return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
nsSVGValueAutoNotifier autonotifier(this);
ReleaseTransforms();
if (!AppendElement(newItem)) {
@ -381,12 +383,15 @@ NS_IMETHODIMP nsSVGTransformList::GetItem(PRUint32 index, nsIDOMSVGTransform **_
}
/* nsIDOMSVGTransform insertItemBefore (in nsIDOMSVGTransform newItem, in unsigned long index); */
NS_IMETHODIMP nsSVGTransformList::InsertItemBefore(nsIDOMSVGTransform *newItem, PRUint32 index, nsIDOMSVGTransform **_retval)
NS_IMETHODIMP nsSVGTransformList::InsertItemBefore(nsIDOMSVGTransform *newItem,
PRUint32 index,
nsIDOMSVGTransform **_retval)
{
nsSVGValueAutoNotifier autonotifier(this);
*_retval = newItem;
if (!newItem)
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
if (!newItem) return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
nsSVGValueAutoNotifier autonotifier(this);
PRUint32 count = mTransforms.Count();
@ -405,12 +410,16 @@ NS_IMETHODIMP nsSVGTransformList::InsertItemBefore(nsIDOMSVGTransform *newItem,
}
/* nsIDOMSVGTransform replaceItem (in nsIDOMSVGTransform newItem, in unsigned long index); */
NS_IMETHODIMP nsSVGTransformList::ReplaceItem(nsIDOMSVGTransform *newItem, PRUint32 index, nsIDOMSVGTransform **_retval)
NS_IMETHODIMP nsSVGTransformList::ReplaceItem(nsIDOMSVGTransform *newItem,
PRUint32 index,
nsIDOMSVGTransform **_retval)
{
nsSVGValueAutoNotifier autonotifier(this);
if (!newItem)
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
*_retval = nsnull;
if (!newItem) return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
nsSVGValueAutoNotifier autonotifier(this);
if (index >= PRUint32(mTransforms.Count()))
return NS_ERROR_DOM_INDEX_SIZE_ERR;
@ -463,12 +472,14 @@ NS_IMETHODIMP nsSVGTransformList::RemoveItem(PRUint32 index, nsIDOMSVGTransform
}
/* nsIDOMSVGTransform appendItem (in nsIDOMSVGTransform newItem); */
NS_IMETHODIMP nsSVGTransformList::AppendItem(nsIDOMSVGTransform *newItem, nsIDOMSVGTransform **_retval)
NS_IMETHODIMP nsSVGTransformList::AppendItem(nsIDOMSVGTransform *newItem,
nsIDOMSVGTransform **_retval)
{
nsSVGValueAutoNotifier autonotifier(this);
*_retval = newItem;
if (!newItem)
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
if (!newItem) return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
nsSVGValueAutoNotifier autonotifier(this);
if (!AppendElement(newItem)) {
*_retval = nsnull;
@ -484,6 +495,9 @@ NS_IMETHODIMP
nsSVGTransformList::CreateSVGTransformFromMatrix(nsIDOMSVGMatrix *matrix,
nsIDOMSVGTransform **_retval)
{
if (!matrix)
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
nsresult rv = NS_NewSVGTransform(_retval);
if (NS_FAILED(rv))
return rv;