NS_INTERFACE_MAP_END //---------------------------------------------------------------------- // nsISVGValue methods: NS_IMETHODIMP nsSVGPathSegList::SetValueString(const nsAString& aValue) { nsresult rv; WillModify(); ReleaseSegments(PR_FALSE); nsSVGPathDataParserToDOM parser(&mSegments); rv = parser.Parse(aValue); PRInt32 count = mSegments.Count(); for (PRInt32 i=0; i<count; ++i) { nsSVGPathSeg* seg = static_cast<nsSVGPathSeg*>(mSegments.ObjectAt(i)); seg->SetCurrentList(this); } if (NS_FAILED(rv)) { NS_ERROR("path data parse error!"); ReleaseSegments(PR_FALSE); } DidModify(); return rv; }
/* void clear (); */ NS_IMETHODIMP nsSVGPathSegList::Clear() { WillModify(); ReleaseSegments(); DidModify(); return NS_OK; }
NS_INTERFACE_MAP_END //---------------------------------------------------------------------- // nsISVGValue methods: NS_IMETHODIMP nsSVGPathSegList::SetValueString(const nsAString& aValue) { nsresult rv; char *str = ToNewCString(aValue); nsVoidArray data; nsSVGPathDataParser parser(&data); rv = parser.Parse(str); if (NS_SUCCEEDED(rv)) { WillModify(); ReleaseSegments(); mSegments = data; PRInt32 count = mSegments.Count(); for (PRInt32 i=0; i<count; ++i) { nsIDOMSVGPathSeg* seg = ElementAt(i); nsCOMPtr<nsISVGValue> val = do_QueryInterface(seg); if (val) val->AddObserver(this); } DidModify(); } else { NS_ERROR("path data parse error!"); PRInt32 count = data.Count(); for (PRInt32 i=0; i<count; ++i) { nsIDOMSVGPathSeg* seg = (nsIDOMSVGPathSeg*)data.ElementAt(i); NS_RELEASE(seg); } } nsMemory::Free(str); return rv; }
nsSVGPathSegList::~nsSVGPathSegList() { ReleaseSegments(); }