static v8::Handle<v8::Value> initializeCallback(const v8::Arguments& args) { INC_STATS("DOM.SVGPointList.initialize"); SVGPointList* imp = V8SVGPointList::toNative(args.Holder()); ExceptionCode ec = 0; { bool itemOk; FloatPoint item = V8SVGPODTypeUtil::toSVGPODType<FloatPoint>(&V8SVGPoint::info, args[0], itemOk); if (UNLIKELY(!itemOk)) { ec = TYPE_MISMATCH_ERR; goto fail; } SVGList<RefPtr<SVGPODListItem<FloatPoint> > >* listImp = imp; RefPtr<SVGPODListItem<FloatPoint> > result = listImp->initialize(SVGPODListItem<FloatPoint>::copy(item), ec); if (UNLIKELY(ec)) goto fail; RefPtr<V8SVGPODTypeWrapper<FloatPoint> > wrapper = V8SVGPODTypeWrapperCreatorForList<FloatPoint>::create(result, imp->associatedAttributeName()); SVGElement* context = V8Proxy::svgContext(imp); V8Proxy::setSVGContext(wrapper.get(), context); context->svgAttributeChanged(imp->associatedAttributeName()); return toV8(wrapper.release()); } fail: V8Proxy::setDOMException(ec); return v8::Handle<v8::Value>(); }
static v8::Handle<v8::Value> clearCallback(const v8::Arguments& args) { INC_STATS("DOM.SVGPointList.clear"); SVGPointList* imp = V8SVGPointList::toNative(args.Holder()); ExceptionCode ec = 0; { imp->clear(ec); if (UNLIKELY(ec)) goto fail; SVGElement* context = V8Proxy::svgContext(imp); context->svgAttributeChanged(imp->associatedAttributeName()); return v8::Handle<v8::Value>(); } fail: V8Proxy::setDOMException(ec); return v8::Handle<v8::Value>(); }
static v8::Handle<v8::Value> initializeCallback(const v8::Arguments& args) { INC_STATS("DOM.SVGPathSegList.initialize"); SVGPathSegList* imp = V8SVGPathSegList::toNative(args.Holder()); ExceptionCode ec = 0; { EXCEPTION_BLOCK(SVGPathSeg*, newItem, V8SVGPathSeg::HasInstance(args[0]) ? V8SVGPathSeg::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); RefPtr<SVGPathSeg> result = imp->initialize(newItem, ec); if (UNLIKELY(ec)) goto fail; SVGElement* context = V8Proxy::svgContext(imp); V8Proxy::setSVGContext(result.get(), context); context->svgAttributeChanged(imp->associatedAttributeName()); return toV8(result.release()); } fail: V8Proxy::setDOMException(ec); return v8::Handle<v8::Value>(); }
static v8::Handle<v8::Value> removeItemCallback(const v8::Arguments& args) { INC_STATS("DOM.SVGPathSegList.removeItem"); SVGPathSegList* imp = V8SVGPathSegList::toNative(args.Holder()); ExceptionCode ec = 0; { EXCEPTION_BLOCK(unsigned, index, toUInt32(args[0])); RefPtr<SVGPathSeg> result = imp->removeItem(index, ec); if (UNLIKELY(ec)) goto fail; SVGElement* context = V8Proxy::svgContext(imp); V8Proxy::setSVGContext(result.get(), context); context->svgAttributeChanged(imp->associatedAttributeName()); return toV8(result.release()); } fail: V8Proxy::setDOMException(ec); return v8::Handle<v8::Value>(); }
void SVGDocumentExtensions::rebuildAllElementReferencesForTarget(SVGElement* referencedElement) { ASSERT(referencedElement); if (!referencedElement->hasSVGRareData()) return; const SVGElementSet& referencingElements = referencedElement->svgRareData()->referencingElements(); // Iterate on a snapshot as |referencingElements| may be altered inside loop. WillBeHeapVector<RawPtrWillBeMember<SVGElement> > referencingElementsSnapShot; copyToVector(referencingElements, referencingElementsSnapShot); // Force rebuilding the referencingElement so it knows about this change. for (WillBeHeapVector<RawPtrWillBeMember<SVGElement> >::iterator it = referencingElementsSnapShot.begin(), itEnd = referencingElementsSnapShot.end(); it != itEnd; ++it) { SVGElement* referencingElement = *it; // Before rebuilding referencingElement ensure it was not removed from under us. if (referencingElements.contains(referencingElement)) referencingElement->svgAttributeChanged(XLinkNames::hrefAttr); } }
static v8::Handle<v8::Value> removeItemCallback(const v8::Arguments& args) { INC_STATS("DOM.SVGPointList.removeItem"); SVGPointList* imp = V8SVGPointList::toNative(args.Holder()); ExceptionCode ec = 0; { EXCEPTION_BLOCK(unsigned, index, toUInt32(args[0])); SVGList<RefPtr<SVGPODListItem<FloatPoint> > >* listImp = imp; RefPtr<SVGPODListItem<FloatPoint> > result = listImp->removeItem(index, ec); if (UNLIKELY(ec)) goto fail; RefPtr<V8SVGPODTypeWrapper<FloatPoint> > wrapper = V8SVGPODTypeWrapperCreatorForList<FloatPoint>::create(result, imp->associatedAttributeName()); SVGElement* context = V8Proxy::svgContext(imp); V8Proxy::setSVGContext(wrapper.get(), context); context->svgAttributeChanged(imp->associatedAttributeName()); return toV8(wrapper.release()); } fail: V8Proxy::setDOMException(ec); return v8::Handle<v8::Value>(); }