nsresult NS_NewSVGElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo, FromParser aFromParser) { NS_ASSERTION(sTagAtomTable, "no lookup table, needs SVGElementFactory::Init"); nsIAtom* name = aNodeInfo.get()->NameAtom(); NS_ASSERTION(aNodeInfo.get()->NamespaceEquals(kNameSpaceID_SVG), "Trying to create SVG elements that aren't in the SVG namespace"); void* tag = PL_HashTableLookupConst(sTagAtomTable, name); if (tag) { int32_t index = NS_PTR_TO_INT32(tag) - TABLE_VALUE_OFFSET; if (index < 0 || index >= eSVGTag_Count) { NS_WARNING("About to index out of array bounds - crashing instead"); MOZ_CRASH(); } contentCreatorCallback cb = sContentCreatorCallbacks[index]; return cb(aResult, aNodeInfo, aFromParser); } // if we don't know what to create, just create a standard svg element: return NS_NewSVGUnknownElement(aResult, aNodeInfo); }
void PeerConnectionImpl::NotifyDataChannel(already_AddRefed<mozilla::DataChannel> aChannel) { PC_AUTO_ENTER_API_CALL_NO_CHECK(); MOZ_ASSERT(aChannel.get()); CSFLogDebug(logTag, "%s: channel: %p", __FUNCTION__, aChannel.get()); #ifdef MOZILLA_INTERNAL_API nsCOMPtr<nsIDOMDataChannel> domchannel; nsresult rv = NS_NewDOMDataChannel(aChannel, mWindow, getter_AddRefs(domchannel)); NS_ENSURE_SUCCESS_VOID(rv); nsCOMPtr<IPeerConnectionObserver> pco = do_QueryReferent(mPCObserver); if (!pco) { return; } RUN_ON_THREAD(mThread, WrapRunnableNM(NotifyDataChannel_m, domchannel.get(), pco), NS_DISPATCH_NORMAL); #endif }
nsresult NS_NewElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo, FromParser aFromParser) { PRInt32 ns = aNodeInfo.get()->NamespaceID(); if (ns == kNameSpaceID_XHTML) { return NS_NewHTMLElement(aResult, aNodeInfo, aFromParser); } #ifdef MOZ_XUL if (ns == kNameSpaceID_XUL) { return NS_NewXULElement(aResult, aNodeInfo); } #endif if (ns == kNameSpaceID_MathML) { return NS_NewMathMLElement(aResult, aNodeInfo); } if (ns == kNameSpaceID_SVG) { return NS_NewSVGElement(aResult, aNodeInfo, aFromParser); } if (ns == kNameSpaceID_XMLEvents) { return NS_NewXMLEventsElement(aResult, aNodeInfo); } #ifdef MOZ_XTF if (ns > kNameSpaceID_LastBuiltin) { nsIXTFService* xtfService = nsContentUtils::GetXTFService(); NS_ASSERTION(xtfService, "could not get xtf service"); if (xtfService && NS_SUCCEEDED(xtfService->CreateElement(aResult, aNodeInfo))) return NS_OK; } #endif return NS_NewXMLElement(aResult, aNodeInfo); }
nsresult FlushableTaskQueue::FlushAndDispatch(already_AddRefed<nsIRunnable> aRunnable) { MonitorAutoLock mon(mQueueMonitor); AutoSetFlushing autoFlush(this); FlushLocked(); nsCOMPtr<nsIRunnable> r = dont_AddRef(aRunnable.take()); nsresult rv = DispatchLocked(r.forget(), IgnoreFlushing, AssertDispatchSuccess); NS_ENSURE_SUCCESS(rv, rv); AwaitIdleLocked(); return NS_OK; }
void PeerConnectionImpl::NotifyDataChannel(already_AddRefed<mozilla::DataChannel> aChannel) { PC_AUTO_ENTER_API_CALL_NO_CHECK(); MOZ_ASSERT(aChannel.get()); CSFLogDebugS(logTag, __FUNCTION__ << ": channel: " << static_cast<void*>(aChannel.get())); #ifdef MOZILLA_INTERNAL_API nsCOMPtr<nsIDOMDataChannel> domchannel; nsresult rv = NS_NewDOMDataChannel(aChannel, mWindow, getter_AddRefs(domchannel)); NS_ENSURE_SUCCESS_VOID(rv); RUN_ON_THREAD(mThread, WrapRunnableNM(NotifyDataChannel_m, domchannel.get(), mPCObserver), NS_DISPATCH_NORMAL); #endif }
void nsAttrValue::SetTo(already_AddRefed<DeclarationBlock> aValue, const nsAString* aSerialized) { MiscContainer* cont = EnsureEmptyMiscContainer(); MOZ_ASSERT(cont->mValue.mRefCount == 0); cont->mValue.mCSSDeclaration = aValue.take(); cont->mType = eCSSDeclaration; NS_ADDREF(cont); SetMiscAtomOrString(aSerialized); MOZ_ASSERT(cont->mValue.mRefCount == 1); }
nsresult NS_NewSVGElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo, FromParser aFromParser) { nsIAtom *name = aNodeInfo.get()->NameAtom(); if (name == nsGkAtoms::a) return NS_NewSVGAElement(aResult, aNodeInfo); if (name == nsGkAtoms::altGlyph) return NS_NewSVGAltGlyphElement(aResult, aNodeInfo); if (name == nsGkAtoms::polyline) return NS_NewSVGPolylineElement(aResult, aNodeInfo); if (name == nsGkAtoms::polygon) return NS_NewSVGPolygonElement(aResult, aNodeInfo); if (name == nsGkAtoms::circle) return NS_NewSVGCircleElement(aResult, aNodeInfo); if (name == nsGkAtoms::ellipse) return NS_NewSVGEllipseElement(aResult, aNodeInfo); if (name == nsGkAtoms::line) return NS_NewSVGLineElement(aResult, aNodeInfo); if (name == nsGkAtoms::rect) return NS_NewSVGRectElement(aResult, aNodeInfo); if (name == nsGkAtoms::svg) return NS_NewSVGSVGElement(aResult, aNodeInfo, aFromParser); if (name == nsGkAtoms::g) return NS_NewSVGGElement(aResult, aNodeInfo); if (name == nsGkAtoms::foreignObject) return NS_NewSVGForeignObjectElement(aResult, aNodeInfo); if (name == nsGkAtoms::path) return NS_NewSVGPathElement(aResult, aNodeInfo); if (name == nsGkAtoms::text) return NS_NewSVGTextElement(aResult, aNodeInfo); if (name == nsGkAtoms::tspan) return NS_NewSVGTSpanElement(aResult, aNodeInfo); if (name == nsGkAtoms::image) return NS_NewSVGImageElement(aResult, aNodeInfo); if (name == nsGkAtoms::style) return NS_NewSVGStyleElement(aResult, aNodeInfo); if (name == nsGkAtoms::linearGradient) return NS_NewSVGLinearGradientElement(aResult, aNodeInfo); if (name == nsGkAtoms::metadata) return NS_NewSVGMetadataElement(aResult, aNodeInfo); if (name == nsGkAtoms::radialGradient) return NS_NewSVGRadialGradientElement(aResult, aNodeInfo); if (name == nsGkAtoms::stop) return NS_NewSVGStopElement(aResult, aNodeInfo); if (name == nsGkAtoms::defs) return NS_NewSVGDefsElement(aResult, aNodeInfo); if (name == nsGkAtoms::desc) return NS_NewSVGDescElement(aResult, aNodeInfo); if (name == nsGkAtoms::script) return NS_NewSVGScriptElement(aResult, aNodeInfo, aFromParser); if (name == nsGkAtoms::use) return NS_NewSVGUseElement(aResult, aNodeInfo); if (name == nsGkAtoms::symbol) return NS_NewSVGSymbolElement(aResult, aNodeInfo); if (name == nsGkAtoms::marker) return NS_NewSVGMarkerElement(aResult, aNodeInfo); if (name == nsGkAtoms::title) return NS_NewSVGTitleElement(aResult, aNodeInfo); if (name == nsGkAtoms::clipPath) return NS_NewSVGClipPathElement(aResult, aNodeInfo); if (name == nsGkAtoms::textPath) return NS_NewSVGTextPathElement(aResult, aNodeInfo); if (name == nsGkAtoms::filter) return NS_NewSVGFilterElement(aResult, aNodeInfo); if (name == nsGkAtoms::feBlend) return NS_NewSVGFEBlendElement(aResult, aNodeInfo); if (name == nsGkAtoms::feColorMatrix) return NS_NewSVGFEColorMatrixElement(aResult, aNodeInfo); if (name == nsGkAtoms::feComponentTransfer) return NS_NewSVGFEComponentTransferElement(aResult, aNodeInfo); if (name == nsGkAtoms::feComposite) return NS_NewSVGFECompositeElement(aResult, aNodeInfo); if (name == nsGkAtoms::feFuncR) return NS_NewSVGFEFuncRElement(aResult, aNodeInfo); if (name == nsGkAtoms::feFuncG) return NS_NewSVGFEFuncGElement(aResult, aNodeInfo); if (name == nsGkAtoms::feFuncB) return NS_NewSVGFEFuncBElement(aResult, aNodeInfo); if (name == nsGkAtoms::feFuncA) return NS_NewSVGFEFuncAElement(aResult, aNodeInfo); if (name == nsGkAtoms::feGaussianBlur) return NS_NewSVGFEGaussianBlurElement(aResult, aNodeInfo); if (name == nsGkAtoms::feMerge) return NS_NewSVGFEMergeElement(aResult, aNodeInfo); if (name == nsGkAtoms::feMergeNode) return NS_NewSVGFEMergeNodeElement(aResult, aNodeInfo); if (name == nsGkAtoms::feMorphology) return NS_NewSVGFEMorphologyElement(aResult, aNodeInfo); if (name == nsGkAtoms::feOffset) return NS_NewSVGFEOffsetElement(aResult, aNodeInfo); if (name == nsGkAtoms::feFlood) return NS_NewSVGFEFloodElement(aResult, aNodeInfo); if (name == nsGkAtoms::feTile) return NS_NewSVGFETileElement(aResult, aNodeInfo); if (name == nsGkAtoms::feTurbulence) return NS_NewSVGFETurbulenceElement(aResult, aNodeInfo); if (name == nsGkAtoms::feConvolveMatrix) return NS_NewSVGFEConvolveMatrixElement(aResult, aNodeInfo); if (name == nsGkAtoms::feDistantLight) return NS_NewSVGFEDistantLightElement(aResult, aNodeInfo); if (name == nsGkAtoms::fePointLight) return NS_NewSVGFEPointLightElement(aResult, aNodeInfo); if (name == nsGkAtoms::feSpotLight) return NS_NewSVGFESpotLightElement(aResult, aNodeInfo); if (name == nsGkAtoms::feDiffuseLighting) return NS_NewSVGFEDiffuseLightingElement(aResult, aNodeInfo); if (name == nsGkAtoms::feSpecularLighting) return NS_NewSVGFESpecularLightingElement(aResult, aNodeInfo); if (name == nsGkAtoms::feImage) return NS_NewSVGFEImageElement(aResult, aNodeInfo); if (name == nsGkAtoms::feDisplacementMap) return NS_NewSVGFEDisplacementMapElement(aResult, aNodeInfo); if (name == nsGkAtoms::pattern) return NS_NewSVGPatternElement(aResult, aNodeInfo); if (name == nsGkAtoms::mask) return NS_NewSVGMaskElement(aResult, aNodeInfo); if (name == nsGkAtoms::svgSwitch) return NS_NewSVGSwitchElement(aResult, aNodeInfo); if (name == nsGkAtoms::view) return NS_NewSVGViewElement(aResult, aNodeInfo); if (NS_SMILEnabled()) { if (name == nsGkAtoms::animate) return NS_NewSVGAnimateElement(aResult, aNodeInfo); if (name == nsGkAtoms::animateTransform) return NS_NewSVGAnimateTransformElement(aResult, aNodeInfo); if (name == nsGkAtoms::animateMotion) return NS_NewSVGAnimateMotionElement(aResult, aNodeInfo); if (name == nsGkAtoms::mpath) return NS_NewSVGMPathElement(aResult, aNodeInfo); if (name == nsGkAtoms::set) return NS_NewSVGSetElement(aResult, aNodeInfo); } // if we don't know what to create, just create a standard svg element: return NS_NewSVGUnknownElement(aResult, aNodeInfo); }