LCOV - code coverage report
Current view: top level - obj-x86_64-pc-linux-gnu/dom/bindings - SVGTSpanElementBinding.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 91 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 10 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM SVGTSpanElement.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "SVGTSpanElementBinding.h"
       4             : #include "SVGTextPositioningElementBinding.h"
       5             : #include "WrapperFactory.h"
       6             : #include "mozilla/OwningNonNull.h"
       7             : #include "mozilla/dom/BindingUtils.h"
       8             : #include "mozilla/dom/DOMJSClass.h"
       9             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      10             : #include "mozilla/dom/SVGTSpanElement.h"
      11             : #include "mozilla/dom/XrayExpandoClass.h"
      12             : 
      13             : namespace mozilla {
      14             : namespace dom {
      15             : 
      16             : namespace SVGTSpanElementBinding {
      17             : 
      18             : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGTextPositioningElementBinding::NativeType>::value,
      19             :               "Can't inherit from an interface with a different ownership model.");
      20             : 
      21             : static bool
      22           0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
      23             : {
      24           0 :   mozilla::dom::SVGTSpanElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGTSpanElement>(obj);
      25             :   // We don't want to preserve if we don't have a wrapper, and we
      26             :   // obviously can't preserve if we're not initialized.
      27           0 :   if (self && self->GetWrapperPreserveColor()) {
      28           0 :     PreserveWrapper(self);
      29             :   }
      30           0 :   return true;
      31             : }
      32             : 
      33             : static void
      34           0 : _finalize(js::FreeOp* fop, JSObject* obj)
      35             : {
      36           0 :   mozilla::dom::SVGTSpanElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGTSpanElement>(obj);
      37           0 :   if (self) {
      38           0 :     ClearWrapper(self, self, obj);
      39           0 :     AddForDeferredFinalization<mozilla::dom::SVGTSpanElement>(self);
      40             :   }
      41           0 : }
      42             : 
      43             : static void
      44           0 : _objectMoved(JSObject* obj, const JSObject* old)
      45             : {
      46           0 :   mozilla::dom::SVGTSpanElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGTSpanElement>(obj);
      47           0 :   if (self) {
      48           0 :     UpdateWrapper(self, self, obj, old);
      49             :   }
      50           0 : }
      51             : 
      52             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
      53             :   {
      54             :     "Function",
      55             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
      56             :     &sBoringInterfaceObjectClassClassOps,
      57             :     JS_NULL_CLASS_SPEC,
      58             :     JS_NULL_CLASS_EXT,
      59             :     &sInterfaceObjectClassObjectOps
      60             :   },
      61             :   eInterface,
      62             :   true,
      63             :   prototypes::id::SVGTSpanElement,
      64             :   PrototypeTraits<prototypes::id::SVGTSpanElement>::Depth,
      65             :   sNativePropertyHooks,
      66             :   "function SVGTSpanElement() {\n    [native code]\n}",
      67             :   SVGTextPositioningElementBinding::GetConstructorObject
      68             : };
      69             : 
      70             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
      71             :   {
      72             :     "SVGTSpanElementPrototype",
      73             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
      74             :     JS_NULL_CLASS_OPS,
      75             :     JS_NULL_CLASS_SPEC,
      76             :     JS_NULL_CLASS_EXT,
      77             :     JS_NULL_OBJECT_OPS
      78             :   },
      79             :   eInterfacePrototype,
      80             :   false,
      81             :   prototypes::id::SVGTSpanElement,
      82             :   PrototypeTraits<prototypes::id::SVGTSpanElement>::Depth,
      83             :   sNativePropertyHooks,
      84             :   "[object SVGTSpanElementPrototype]",
      85             :   SVGTextPositioningElementBinding::GetProtoObject
      86             : };
      87             : 
      88             : JSObject*
      89           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
      90             : {
      91           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
      92             : }
      93             : 
      94             : static const js::ClassOps sClassOps = {
      95             :   _addProperty, /* addProperty */
      96             :   nullptr,               /* delProperty */
      97             :   nullptr,               /* getProperty */
      98             :   nullptr,               /* setProperty */
      99             :   nullptr,               /* enumerate */
     100             :   nullptr, /* newEnumerate */
     101             :   nullptr, /* resolve */
     102             :   nullptr, /* mayResolve */
     103             :   _finalize, /* finalize */
     104             :   nullptr, /* call */
     105             :   nullptr,               /* hasInstance */
     106             :   nullptr,               /* construct */
     107             :   nullptr, /* trace */
     108             : };
     109             : 
     110             : static const js::ClassExtension sClassExtension = {
     111             :   nullptr, /* weakmapKeyDelegateOp */
     112             :   _objectMoved /* objectMovedOp */
     113             : };
     114             : 
     115             : static const DOMJSClass sClass = {
     116             :   { "SVGTSpanElement",
     117             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
     118             :     &sClassOps,
     119             :     JS_NULL_CLASS_SPEC,
     120             :     &sClassExtension,
     121             :     JS_NULL_OBJECT_OPS
     122             :   },
     123             :   { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGGraphicsElement, prototypes::id::SVGTextContentElement, prototypes::id::SVGTextPositioningElement, prototypes::id::SVGTSpanElement },
     124             :   IsBaseOf<nsISupports, mozilla::dom::SVGTSpanElement >::value,
     125             :   sNativePropertyHooks,
     126             :   FindAssociatedGlobalForNative<mozilla::dom::SVGTSpanElement>::Get,
     127             :   GetProtoObjectHandle,
     128             :   GetCCParticipant<mozilla::dom::SVGTSpanElement>::Get()
     129             : };
     130             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
     131             :               "Must have the right minimal number of reserved slots.");
     132             : static_assert(1 >= 1,
     133             :               "Must have enough reserved slots.");
     134             : 
     135             : const JSClass*
     136           0 : GetJSClass()
     137             : {
     138           0 :   return sClass.ToJSClass();
     139             : }
     140             : 
     141             : bool
     142           0 : Wrap(JSContext* aCx, mozilla::dom::SVGTSpanElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
     143             : {
     144             :   MOZ_ASSERT(static_cast<mozilla::dom::SVGTSpanElement*>(aObject) ==
     145             :              reinterpret_cast<mozilla::dom::SVGTSpanElement*>(aObject),
     146             :              "Multiple inheritance for mozilla::dom::SVGTSpanElement is broken.");
     147             :   MOZ_ASSERT(static_cast<mozilla::dom::SVGTextPositioningElement*>(aObject) ==
     148             :              reinterpret_cast<mozilla::dom::SVGTextPositioningElement*>(aObject),
     149             :              "Multiple inheritance for mozilla::dom::SVGTextPositioningElement is broken.");
     150             :   MOZ_ASSERT(static_cast<mozilla::dom::SVGTextContentElement*>(aObject) ==
     151             :              reinterpret_cast<mozilla::dom::SVGTextContentElement*>(aObject),
     152             :              "Multiple inheritance for mozilla::dom::SVGTextContentElement is broken.");
     153             :   MOZ_ASSERT(static_cast<mozilla::dom::SVGGraphicsElement*>(aObject) ==
     154             :              reinterpret_cast<mozilla::dom::SVGGraphicsElement*>(aObject),
     155             :              "Multiple inheritance for mozilla::dom::SVGGraphicsElement is broken.");
     156             :   MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) ==
     157             :              reinterpret_cast<nsSVGElement*>(aObject),
     158             :              "Multiple inheritance for nsSVGElement is broken.");
     159             :   MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
     160             :              reinterpret_cast<mozilla::dom::Element*>(aObject),
     161             :              "Multiple inheritance for mozilla::dom::Element is broken.");
     162             :   MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
     163             :              reinterpret_cast<nsINode*>(aObject),
     164             :              "Multiple inheritance for nsINode is broken.");
     165             :   MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
     166             :              reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
     167             :              "Multiple inheritance for mozilla::dom::EventTarget is broken.");
     168           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
     169           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
     170           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
     171             :              "You should probably not be using Wrap() directly; use "
     172             :              "GetOrCreateDOMReflector instead");
     173             : 
     174           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
     175             :              "nsISupports must be on our primary inheritance chain");
     176             : 
     177           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
     178           0 :   if (!global) {
     179           0 :     return false;
     180             :   }
     181           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
     182           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
     183             : 
     184             :   // That might have ended up wrapping us already, due to the wonders
     185             :   // of XBL.  Check for that, and bail out as needed.
     186           0 :   aReflector.set(aCache->GetWrapper());
     187           0 :   if (aReflector) {
     188             : #ifdef DEBUG
     189           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
     190             : #endif // DEBUG
     191           0 :     return true;
     192             :   }
     193             : 
     194           0 :   JSAutoCompartment ac(aCx, global);
     195           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
     196           0 :   if (!canonicalProto) {
     197           0 :     return false;
     198             :   }
     199           0 :   JS::Rooted<JSObject*> proto(aCx);
     200           0 :   if (aGivenProto) {
     201           0 :     proto = aGivenProto;
     202             :     // Unfortunately, while aGivenProto was in the compartment of aCx
     203             :     // coming in, we changed compartments to that of "parent" so may need
     204             :     // to wrap the proto here.
     205           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
     206           0 :       if (!JS_WrapObject(aCx, &proto)) {
     207           0 :         return false;
     208             :       }
     209             :     }
     210             :   } else {
     211           0 :     proto = canonicalProto;
     212             :   }
     213             : 
     214           0 :   BindingJSObjectCreator<mozilla::dom::SVGTSpanElement> creator(aCx);
     215           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
     216           0 :   if (!aReflector) {
     217           0 :     return false;
     218             :   }
     219             : 
     220           0 :   aCache->SetWrapper(aReflector);
     221           0 :   creator.InitializationSucceeded();
     222             : 
     223           0 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
     224             :              aCache->GetWrapperPreserveColor() == aReflector);
     225             :   // If proto != canonicalProto, we have to preserve our wrapper;
     226             :   // otherwise we won't be able to properly recreate it later, since
     227             :   // we won't know what proto to use.  Note that we don't check
     228             :   // aGivenProto here, since it's entirely possible (and even
     229             :   // somewhat common) to have a non-null aGivenProto which is the
     230             :   // same as canonicalProto.
     231           0 :   if (proto != canonicalProto) {
     232           0 :     PreserveWrapper(aObject);
     233             :   }
     234             : 
     235           0 :   return true;
     236             : }
     237             : 
     238             : const NativePropertyHooks sNativePropertyHooks[] = { {
     239             :   nullptr,
     240             :   nullptr,
     241             :   nullptr,
     242             :   { nullptr, nullptr },
     243             :   prototypes::id::SVGTSpanElement,
     244             :   constructors::id::SVGTSpanElement,
     245             :   SVGTextPositioningElementBinding::sNativePropertyHooks,
     246             :   &DefaultXrayExpandoObjectClass
     247             : } };
     248             : 
     249             : void
     250           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     251             : {
     252           0 :   JS::Handle<JSObject*> parentProto(SVGTextPositioningElementBinding::GetProtoObjectHandle(aCx));
     253           0 :   if (!parentProto) {
     254           0 :     return;
     255             :   }
     256             : 
     257           0 :   JS::Handle<JSObject*> constructorProto(SVGTextPositioningElementBinding::GetConstructorObjectHandle(aCx));
     258           0 :   if (!constructorProto) {
     259           0 :     return;
     260             :   }
     261             : 
     262           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGTSpanElement);
     263           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGTSpanElement);
     264           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     265             :                               &sPrototypeClass.mBase, protoCache,
     266             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
     267             :                               interfaceCache,
     268             :                               nullptr,
     269             :                               nullptr,
     270             :                               "SVGTSpanElement", aDefineOnGlobal,
     271             :                               nullptr,
     272           0 :                               false);
     273             : }
     274             : 
     275             : JS::Handle<JSObject*>
     276           0 : GetProtoObjectHandle(JSContext* aCx)
     277             : {
     278             :   /* Get the interface prototype object for this class.  This will create the
     279             :      object as needed. */
     280           0 :   bool aDefineOnGlobal = true;
     281             : 
     282             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     283           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     284           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     285           0 :     return nullptr;
     286             :   }
     287             : 
     288             :   /* Check to see whether the interface objects are already installed */
     289           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     290           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SVGTSpanElement)) {
     291           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     292           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     293             :   }
     294             : 
     295             :   /*
     296             :    * The object might _still_ be null, but that's OK.
     297             :    *
     298             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     299             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     300             :    * changed after they have been set.
     301             :    *
     302             :    * Calling address() avoids the read read barrier that does gray
     303             :    * unmarking, but it's not possible for the object to be gray here.
     304             :    */
     305             : 
     306           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SVGTSpanElement);
     307           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     308           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     309             : }
     310             : 
     311             : JS::Handle<JSObject*>
     312           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
     313             : {
     314             :   /* Get the interface object for this class.  This will create the object as
     315             :      needed. */
     316             : 
     317             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     318           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     319           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     320           0 :     return nullptr;
     321             :   }
     322             : 
     323             :   /* Check to see whether the interface objects are already installed */
     324           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     325           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGTSpanElement)) {
     326           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     327           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     328             :   }
     329             : 
     330             :   /*
     331             :    * The object might _still_ be null, but that's OK.
     332             :    *
     333             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     334             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     335             :    * changed after they have been set.
     336             :    *
     337             :    * Calling address() avoids the read read barrier that does gray
     338             :    * unmarking, but it's not possible for the object to be gray here.
     339             :    */
     340             : 
     341           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGTSpanElement);
     342           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     343           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     344             : }
     345             : 
     346             : JSObject*
     347           0 : GetConstructorObject(JSContext* aCx)
     348             : {
     349           0 :   return GetConstructorObjectHandle(aCx);
     350             : }
     351             : 
     352             : } // namespace SVGTSpanElementBinding
     353             : 
     354             : 
     355             : 
     356             : } // namespace dom
     357             : } // namespace mozilla

Generated by: LCOV version 1.13