void DOMSVGPathSegList::Clear(ErrorResult& aError) { if (IsAnimValList()) { aError.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR); return; } if (LengthNoFlush() > 0) { nsAttrValue emptyOrOldValue = Element()->WillChangePathSegList(); // DOM list items that are to be removed must be removed before we change // the internal list, otherwise they wouldn't be able to copy their // internal counterparts' values! InternalListWillChangeTo(SVGPathData()); // clears mItems if (!AttrIsAnimating()) { // The anim val list is in sync with the base val list DOMSVGPathSegList *animList = GetDOMWrapperIfExists(InternalAList().GetAnimValKey()); if (animList) { animList->InternalListWillChangeTo(SVGPathData()); // clears its mItems } } InternalList().Clear(); Element()->DidChangePathSegList(emptyOrOldValue); if (AttrIsAnimating()) { Element()->AnimationNeedsResample(); } } }
NS_IMETHODIMP DOMSVGPathSegList::Clear() { if (IsAnimValList()) { return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; } if (Length() > 0) { // DOM list items that are to be removed must be removed before we change // the internal list, otherwise they wouldn't be able to copy their // internal counterparts' values! InternalListWillChangeTo(SVGPathData()); // clears mItems if (!AttrIsAnimating()) { // The anim val list is in sync with the base val list DOMSVGPathSegList *animList = GetDOMWrapperIfExists(InternalAList().GetAnimValKey()); if (animList) { animList->InternalListWillChangeTo(SVGPathData()); // clears its mItems } } InternalList().Clear(); Element()->DidChangePathSegList(PR_TRUE); #ifdef MOZ_SMIL if (AttrIsAnimating()) { Element()->AnimationNeedsResample(); } #endif } return NS_OK; }
void SVGAnimatedPathSegList::ClearBaseValue() { // We must send these notifications *before* changing mBaseVal! (See above.) DOMSVGPathSegList *baseValWrapper = DOMSVGPathSegList::GetDOMWrapperIfExists(GetBaseValKey()); if (baseValWrapper) { baseValWrapper->InternalListWillChangeTo(SVGPathData()); } if (!IsAnimating()) { // DOM anim val wraps our base val too! DOMSVGPathSegList *animValWrapper = DOMSVGPathSegList::GetDOMWrapperIfExists(GetAnimValKey()); if (animValWrapper) { animValWrapper->InternalListWillChangeTo(SVGPathData()); } } mBaseVal.Clear(); // Caller notifies }