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

          Line data    Source code
       1             : /* THIS FILE IS AUTOGENERATED FROM SVGPatternElement.webidl BY Codegen.py - DO NOT EDIT */
       2             : 
       3             : #include "SVGAnimatedPreserveAspectRatio.h"
       4             : #include "SVGElementBinding.h"
       5             : #include "SVGPatternElementBinding.h"
       6             : #include "WrapperFactory.h"
       7             : #include "mozilla/OwningNonNull.h"
       8             : #include "mozilla/dom/BindingUtils.h"
       9             : #include "mozilla/dom/DOMJSClass.h"
      10             : #include "mozilla/dom/NonRefcountedDOMObject.h"
      11             : #include "mozilla/dom/SVGAnimatedEnumeration.h"
      12             : #include "mozilla/dom/SVGAnimatedLength.h"
      13             : #include "mozilla/dom/SVGAnimatedRect.h"
      14             : #include "mozilla/dom/SVGAnimatedString.h"
      15             : #include "mozilla/dom/SVGAnimatedTransformList.h"
      16             : #include "mozilla/dom/SVGPatternElement.h"
      17             : #include "mozilla/dom/XrayExpandoClass.h"
      18             : 
      19             : namespace mozilla {
      20             : namespace dom {
      21             : 
      22             : namespace SVGPatternElementBinding {
      23             : 
      24             : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGElementBinding::NativeType>::value,
      25             :               "Can't inherit from an interface with a different ownership model.");
      26             : 
      27             : static bool
      28           0 : get_patternUnits(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGPatternElement* self, JSJitGetterCallArgs args)
      29             : {
      30           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedEnumeration>(self->PatternUnits()));
      31           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      32           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
      33           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
      34           0 :     return false;
      35             :   }
      36           0 :   return true;
      37             : }
      38             : 
      39             : static const JSJitInfo patternUnits_getterinfo = {
      40             :   { (JSJitGetterOp)get_patternUnits },
      41             :   { prototypes::id::SVGPatternElement },
      42             :   { PrototypeTraits<prototypes::id::SVGPatternElement>::Depth },
      43             :   JSJitInfo::Getter,
      44             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
      45             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
      46             :   false,  /* isInfallible. False in setters. */
      47             :   true,  /* isMovable.  Not relevant for setters. */
      48             :   true, /* isEliminatable.  Not relevant for setters. */
      49             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      50             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      51             :   false,  /* isTypedMethod.  Only relevant for methods. */
      52             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      53             : };
      54             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      55             : static_assert(0 < 1, "There is no slot for us");
      56             : 
      57             : static bool
      58           0 : get_patternContentUnits(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGPatternElement* self, JSJitGetterCallArgs args)
      59             : {
      60           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedEnumeration>(self->PatternContentUnits()));
      61           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      62           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
      63           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
      64           0 :     return false;
      65             :   }
      66           0 :   return true;
      67             : }
      68             : 
      69             : static const JSJitInfo patternContentUnits_getterinfo = {
      70             :   { (JSJitGetterOp)get_patternContentUnits },
      71             :   { prototypes::id::SVGPatternElement },
      72             :   { PrototypeTraits<prototypes::id::SVGPatternElement>::Depth },
      73             :   JSJitInfo::Getter,
      74             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
      75             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
      76             :   false,  /* isInfallible. False in setters. */
      77             :   true,  /* isMovable.  Not relevant for setters. */
      78             :   true, /* isEliminatable.  Not relevant for setters. */
      79             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
      80             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
      81             :   false,  /* isTypedMethod.  Only relevant for methods. */
      82             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
      83             : };
      84             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
      85             : static_assert(0 < 1, "There is no slot for us");
      86             : 
      87             : static bool
      88           0 : get_patternTransform(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGPatternElement* self, JSJitGetterCallArgs args)
      89             : {
      90           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedTransformList>(self->PatternTransform()));
      91           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
      92           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
      93           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
      94           0 :     return false;
      95             :   }
      96           0 :   return true;
      97             : }
      98             : 
      99             : static const JSJitInfo patternTransform_getterinfo = {
     100             :   { (JSJitGetterOp)get_patternTransform },
     101             :   { prototypes::id::SVGPatternElement },
     102             :   { PrototypeTraits<prototypes::id::SVGPatternElement>::Depth },
     103             :   JSJitInfo::Getter,
     104             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     105             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     106             :   false,  /* isInfallible. False in setters. */
     107             :   true,  /* isMovable.  Not relevant for setters. */
     108             :   true, /* isEliminatable.  Not relevant for setters. */
     109             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     110             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     111             :   false,  /* isTypedMethod.  Only relevant for methods. */
     112             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     113             : };
     114             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     115             : static_assert(0 < 1, "There is no slot for us");
     116             : 
     117             : static bool
     118           0 : get_x(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGPatternElement* self, JSJitGetterCallArgs args)
     119             : {
     120           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->X()));
     121           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     122           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     123           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     124           0 :     return false;
     125             :   }
     126           0 :   return true;
     127             : }
     128             : 
     129             : static const JSJitInfo x_getterinfo = {
     130             :   { (JSJitGetterOp)get_x },
     131             :   { prototypes::id::SVGPatternElement },
     132             :   { PrototypeTraits<prototypes::id::SVGPatternElement>::Depth },
     133             :   JSJitInfo::Getter,
     134             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     135             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     136             :   false,  /* isInfallible. False in setters. */
     137             :   true,  /* isMovable.  Not relevant for setters. */
     138             :   true, /* isEliminatable.  Not relevant for setters. */
     139             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     140             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     141             :   false,  /* isTypedMethod.  Only relevant for methods. */
     142             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     143             : };
     144             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     145             : static_assert(0 < 1, "There is no slot for us");
     146             : 
     147             : static bool
     148           0 : get_y(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGPatternElement* self, JSJitGetterCallArgs args)
     149             : {
     150           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Y()));
     151           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     152           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     153           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     154           0 :     return false;
     155             :   }
     156           0 :   return true;
     157             : }
     158             : 
     159             : static const JSJitInfo y_getterinfo = {
     160             :   { (JSJitGetterOp)get_y },
     161             :   { prototypes::id::SVGPatternElement },
     162             :   { PrototypeTraits<prototypes::id::SVGPatternElement>::Depth },
     163             :   JSJitInfo::Getter,
     164             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     165             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     166             :   false,  /* isInfallible. False in setters. */
     167             :   true,  /* isMovable.  Not relevant for setters. */
     168             :   true, /* isEliminatable.  Not relevant for setters. */
     169             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     170             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     171             :   false,  /* isTypedMethod.  Only relevant for methods. */
     172             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     173             : };
     174             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     175             : static_assert(0 < 1, "There is no slot for us");
     176             : 
     177             : static bool
     178           0 : get_width(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGPatternElement* self, JSJitGetterCallArgs args)
     179             : {
     180           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Width()));
     181           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     182           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     183           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     184           0 :     return false;
     185             :   }
     186           0 :   return true;
     187             : }
     188             : 
     189             : static const JSJitInfo width_getterinfo = {
     190             :   { (JSJitGetterOp)get_width },
     191             :   { prototypes::id::SVGPatternElement },
     192             :   { PrototypeTraits<prototypes::id::SVGPatternElement>::Depth },
     193             :   JSJitInfo::Getter,
     194             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     195             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     196             :   false,  /* isInfallible. False in setters. */
     197             :   true,  /* isMovable.  Not relevant for setters. */
     198             :   true, /* isEliminatable.  Not relevant for setters. */
     199             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     200             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     201             :   false,  /* isTypedMethod.  Only relevant for methods. */
     202             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     203             : };
     204             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     205             : static_assert(0 < 1, "There is no slot for us");
     206             : 
     207             : static bool
     208           0 : get_height(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGPatternElement* self, JSJitGetterCallArgs args)
     209             : {
     210           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedLength>(self->Height()));
     211           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     212           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     213           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     214           0 :     return false;
     215             :   }
     216           0 :   return true;
     217             : }
     218             : 
     219             : static const JSJitInfo height_getterinfo = {
     220             :   { (JSJitGetterOp)get_height },
     221             :   { prototypes::id::SVGPatternElement },
     222             :   { PrototypeTraits<prototypes::id::SVGPatternElement>::Depth },
     223             :   JSJitInfo::Getter,
     224             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     225             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     226             :   false,  /* isInfallible. False in setters. */
     227             :   true,  /* isMovable.  Not relevant for setters. */
     228             :   true, /* isEliminatable.  Not relevant for setters. */
     229             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     230             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     231             :   false,  /* isTypedMethod.  Only relevant for methods. */
     232             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     233             : };
     234             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     235             : static_assert(0 < 1, "There is no slot for us");
     236             : 
     237             : static bool
     238           0 : get_viewBox(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGPatternElement* self, JSJitGetterCallArgs args)
     239             : {
     240           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedRect>(self->ViewBox()));
     241           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     242           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     243           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     244           0 :     return false;
     245             :   }
     246           0 :   return true;
     247             : }
     248             : 
     249             : static const JSJitInfo viewBox_getterinfo = {
     250             :   { (JSJitGetterOp)get_viewBox },
     251             :   { prototypes::id::SVGPatternElement },
     252             :   { PrototypeTraits<prototypes::id::SVGPatternElement>::Depth },
     253             :   JSJitInfo::Getter,
     254             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     255             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     256             :   false,  /* isInfallible. False in setters. */
     257             :   true,  /* isMovable.  Not relevant for setters. */
     258             :   true, /* isEliminatable.  Not relevant for setters. */
     259             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     260             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     261             :   false,  /* isTypedMethod.  Only relevant for methods. */
     262             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     263             : };
     264             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     265             : static_assert(0 < 1, "There is no slot for us");
     266             : 
     267             : static bool
     268           0 : get_preserveAspectRatio(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGPatternElement* self, JSJitGetterCallArgs args)
     269             : {
     270           0 :   auto result(StrongOrRawPtr<mozilla::dom::DOMSVGAnimatedPreserveAspectRatio>(self->PreserveAspectRatio()));
     271           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     272           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     273           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     274           0 :     return false;
     275             :   }
     276           0 :   return true;
     277             : }
     278             : 
     279             : static const JSJitInfo preserveAspectRatio_getterinfo = {
     280             :   { (JSJitGetterOp)get_preserveAspectRatio },
     281             :   { prototypes::id::SVGPatternElement },
     282             :   { PrototypeTraits<prototypes::id::SVGPatternElement>::Depth },
     283             :   JSJitInfo::Getter,
     284             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     285             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     286             :   false,  /* isInfallible. False in setters. */
     287             :   true,  /* isMovable.  Not relevant for setters. */
     288             :   true, /* isEliminatable.  Not relevant for setters. */
     289             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     290             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     291             :   false,  /* isTypedMethod.  Only relevant for methods. */
     292             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     293             : };
     294             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     295             : static_assert(0 < 1, "There is no slot for us");
     296             : 
     297             : static bool
     298           0 : get_href(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGPatternElement* self, JSJitGetterCallArgs args)
     299             : {
     300           0 :   auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedString>(self->Href()));
     301           0 :   MOZ_ASSERT(!JS_IsExceptionPending(cx));
     302           0 :   if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
     303           0 :     MOZ_ASSERT(true || JS_IsExceptionPending(cx));
     304           0 :     return false;
     305             :   }
     306           0 :   return true;
     307             : }
     308             : 
     309             : static const JSJitInfo href_getterinfo = {
     310             :   { (JSJitGetterOp)get_href },
     311             :   { prototypes::id::SVGPatternElement },
     312             :   { PrototypeTraits<prototypes::id::SVGPatternElement>::Depth },
     313             :   JSJitInfo::Getter,
     314             :   JSJitInfo::AliasNone, /* aliasSet.  Not relevant for setters. */
     315             :   JSVAL_TYPE_OBJECT,  /* returnType.  Not relevant for setters. */
     316             :   false,  /* isInfallible. False in setters. */
     317             :   true,  /* isMovable.  Not relevant for setters. */
     318             :   true, /* isEliminatable.  Not relevant for setters. */
     319             :   false, /* isAlwaysInSlot.  Only relevant for getters. */
     320             :   false, /* isLazilyCachedInSlot.  Only relevant for getters. */
     321             :   false,  /* isTypedMethod.  Only relevant for methods. */
     322             :   0   /* Reserved slot index, if we're stored in a slot, else 0. */
     323             : };
     324             : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
     325             : static_assert(0 < 1, "There is no slot for us");
     326             : 
     327             : static bool
     328           0 : _addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
     329             : {
     330           0 :   mozilla::dom::SVGPatternElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGPatternElement>(obj);
     331             :   // We don't want to preserve if we don't have a wrapper, and we
     332             :   // obviously can't preserve if we're not initialized.
     333           0 :   if (self && self->GetWrapperPreserveColor()) {
     334           0 :     PreserveWrapper(self);
     335             :   }
     336           0 :   return true;
     337             : }
     338             : 
     339             : static void
     340           0 : _finalize(js::FreeOp* fop, JSObject* obj)
     341             : {
     342           0 :   mozilla::dom::SVGPatternElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGPatternElement>(obj);
     343           0 :   if (self) {
     344           0 :     ClearWrapper(self, self, obj);
     345           0 :     AddForDeferredFinalization<mozilla::dom::SVGPatternElement>(self);
     346             :   }
     347           0 : }
     348             : 
     349             : static void
     350           0 : _objectMoved(JSObject* obj, const JSObject* old)
     351             : {
     352           0 :   mozilla::dom::SVGPatternElement* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::SVGPatternElement>(obj);
     353           0 :   if (self) {
     354           0 :     UpdateWrapper(self, self, obj, old);
     355             :   }
     356           0 : }
     357             : 
     358             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     359             : #if defined(__clang__)
     360             : #pragma clang diagnostic push
     361             : #pragma clang diagnostic ignored "-Wmissing-braces"
     362             : #endif
     363             : static const JSPropertySpec sAttributes_specs[] = {
     364             :   { "patternUnits", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &patternUnits_getterinfo, nullptr, nullptr },
     365             :   { "patternContentUnits", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &patternContentUnits_getterinfo, nullptr, nullptr },
     366             :   { "patternTransform", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &patternTransform_getterinfo, nullptr, nullptr },
     367             :   { "x", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &x_getterinfo, nullptr, nullptr },
     368             :   { "y", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &y_getterinfo, nullptr, nullptr },
     369             :   { "width", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &width_getterinfo, nullptr, nullptr },
     370             :   { "height", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &height_getterinfo, nullptr, nullptr },
     371             :   { "viewBox", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &viewBox_getterinfo, nullptr, nullptr },
     372             :   { "preserveAspectRatio", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &preserveAspectRatio_getterinfo, nullptr, nullptr },
     373             :   { "href", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &href_getterinfo, nullptr, nullptr },
     374             :   { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
     375             : };
     376             : #if defined(__clang__)
     377             : #pragma clang diagnostic pop
     378             : #endif
     379             : 
     380             : 
     381             : // Can't be const because the pref-enabled boolean needs to be writable
     382             : static Prefable<const JSPropertySpec> sAttributes[] = {
     383             :   { nullptr, &sAttributes_specs[0] },
     384             :   { nullptr, nullptr }
     385             : };
     386             : 
     387             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     388             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     389             : static_assert(10 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     390             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     391             : 
     392             : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
     393             : #if defined(__clang__)
     394             : #pragma clang diagnostic push
     395             : #pragma clang diagnostic ignored "-Wmissing-braces"
     396             : #endif
     397             : static const ConstantSpec sConstants_specs[] = {
     398             :   { "SVG_UNIT_TYPE_UNKNOWN", JS::Int32Value(0) },
     399             :   { "SVG_UNIT_TYPE_USERSPACEONUSE", JS::Int32Value(1) },
     400             :   { "SVG_UNIT_TYPE_OBJECTBOUNDINGBOX", JS::Int32Value(2) },
     401             :   { 0, JS::UndefinedValue() }
     402             : };
     403             : #if defined(__clang__)
     404             : #pragma clang diagnostic pop
     405             : #endif
     406             : 
     407             : 
     408             : // Can't be const because the pref-enabled boolean needs to be writable
     409             : static Prefable<const ConstantSpec> sConstants[] = {
     410             :   { nullptr, &sConstants_specs[0] },
     411             :   { nullptr, nullptr }
     412             : };
     413             : 
     414             : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
     415             :     "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
     416             : static_assert(3 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
     417             :     "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
     418             : 
     419             : 
     420             : static uint16_t sNativeProperties_sortedPropertyIndices[13];
     421             : static PropertyInfo sNativeProperties_propertyInfos[13];
     422             : 
     423             : static const NativePropertiesN<2> sNativeProperties = {
     424             :   false, 0,
     425             :   false, 0,
     426             :   false, 0,
     427             :   true,  0 /* sAttributes */,
     428             :   false, 0,
     429             :   false, 0,
     430             :   true,  1 /* sConstants */,
     431             :   -1,
     432             :   13,
     433             :   sNativeProperties_sortedPropertyIndices,
     434             :   {
     435             :     { sAttributes, &sNativeProperties_propertyInfos[0] },
     436             :     { sConstants, &sNativeProperties_propertyInfos[10] }
     437             :   }
     438             : };
     439             : static_assert(13 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
     440             :     "We have a property info count that is oversized");
     441             : 
     442             : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
     443             :   {
     444             :     "Function",
     445             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
     446             :     &sBoringInterfaceObjectClassClassOps,
     447             :     JS_NULL_CLASS_SPEC,
     448             :     JS_NULL_CLASS_EXT,
     449             :     &sInterfaceObjectClassObjectOps
     450             :   },
     451             :   eInterface,
     452             :   true,
     453             :   prototypes::id::SVGPatternElement,
     454             :   PrototypeTraits<prototypes::id::SVGPatternElement>::Depth,
     455             :   sNativePropertyHooks,
     456             :   "function SVGPatternElement() {\n    [native code]\n}",
     457             :   SVGElementBinding::GetConstructorObject
     458             : };
     459             : 
     460             : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
     461             :   {
     462             :     "SVGPatternElementPrototype",
     463             :     JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
     464             :     JS_NULL_CLASS_OPS,
     465             :     JS_NULL_CLASS_SPEC,
     466             :     JS_NULL_CLASS_EXT,
     467             :     JS_NULL_OBJECT_OPS
     468             :   },
     469             :   eInterfacePrototype,
     470             :   false,
     471             :   prototypes::id::SVGPatternElement,
     472             :   PrototypeTraits<prototypes::id::SVGPatternElement>::Depth,
     473             :   sNativePropertyHooks,
     474             :   "[object SVGPatternElementPrototype]",
     475             :   SVGElementBinding::GetProtoObject
     476             : };
     477             : 
     478             : JSObject*
     479           0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
     480             : {
     481           0 :   return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
     482             : }
     483             : 
     484             : static const js::ClassOps sClassOps = {
     485             :   _addProperty, /* addProperty */
     486             :   nullptr,               /* delProperty */
     487             :   nullptr,               /* getProperty */
     488             :   nullptr,               /* setProperty */
     489             :   nullptr,               /* enumerate */
     490             :   nullptr, /* newEnumerate */
     491             :   nullptr, /* resolve */
     492             :   nullptr, /* mayResolve */
     493             :   _finalize, /* finalize */
     494             :   nullptr, /* call */
     495             :   nullptr,               /* hasInstance */
     496             :   nullptr,               /* construct */
     497             :   nullptr, /* trace */
     498             : };
     499             : 
     500             : static const js::ClassExtension sClassExtension = {
     501             :   nullptr, /* weakmapKeyDelegateOp */
     502             :   _objectMoved /* objectMovedOp */
     503             : };
     504             : 
     505             : static const DOMJSClass sClass = {
     506             :   { "SVGPatternElement",
     507             :     JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
     508             :     &sClassOps,
     509             :     JS_NULL_CLASS_SPEC,
     510             :     &sClassExtension,
     511             :     JS_NULL_OBJECT_OPS
     512             :   },
     513             :   { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::SVGElement, prototypes::id::SVGPatternElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
     514             :   IsBaseOf<nsISupports, mozilla::dom::SVGPatternElement >::value,
     515             :   sNativePropertyHooks,
     516             :   FindAssociatedGlobalForNative<mozilla::dom::SVGPatternElement>::Get,
     517             :   GetProtoObjectHandle,
     518             :   GetCCParticipant<mozilla::dom::SVGPatternElement>::Get()
     519             : };
     520             : static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
     521             :               "Must have the right minimal number of reserved slots.");
     522             : static_assert(1 >= 1,
     523             :               "Must have enough reserved slots.");
     524             : 
     525             : const JSClass*
     526           0 : GetJSClass()
     527             : {
     528           0 :   return sClass.ToJSClass();
     529             : }
     530             : 
     531             : bool
     532           0 : Wrap(JSContext* aCx, mozilla::dom::SVGPatternElement* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
     533             : {
     534             :   MOZ_ASSERT(static_cast<mozilla::dom::SVGPatternElement*>(aObject) ==
     535             :              reinterpret_cast<mozilla::dom::SVGPatternElement*>(aObject),
     536             :              "Multiple inheritance for mozilla::dom::SVGPatternElement is broken.");
     537             :   MOZ_ASSERT(static_cast<nsSVGElement*>(aObject) ==
     538             :              reinterpret_cast<nsSVGElement*>(aObject),
     539             :              "Multiple inheritance for nsSVGElement is broken.");
     540             :   MOZ_ASSERT(static_cast<mozilla::dom::Element*>(aObject) ==
     541             :              reinterpret_cast<mozilla::dom::Element*>(aObject),
     542             :              "Multiple inheritance for mozilla::dom::Element is broken.");
     543             :   MOZ_ASSERT(static_cast<nsINode*>(aObject) ==
     544             :              reinterpret_cast<nsINode*>(aObject),
     545             :              "Multiple inheritance for nsINode is broken.");
     546             :   MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
     547             :              reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
     548             :              "Multiple inheritance for mozilla::dom::EventTarget is broken.");
     549           0 :   MOZ_ASSERT(ToSupportsIsCorrect(aObject));
     550           0 :   MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
     551           0 :   MOZ_ASSERT(!aCache->GetWrapper(),
     552             :              "You should probably not be using Wrap() directly; use "
     553             :              "GetOrCreateDOMReflector instead");
     554             : 
     555           0 :   MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
     556             :              "nsISupports must be on our primary inheritance chain");
     557             : 
     558           0 :   JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
     559           0 :   if (!global) {
     560           0 :     return false;
     561             :   }
     562           0 :   MOZ_ASSERT(JS_IsGlobalObject(global));
     563           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(global));
     564             : 
     565             :   // That might have ended up wrapping us already, due to the wonders
     566             :   // of XBL.  Check for that, and bail out as needed.
     567           0 :   aReflector.set(aCache->GetWrapper());
     568           0 :   if (aReflector) {
     569             : #ifdef DEBUG
     570           0 :     binding_detail::AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
     571             : #endif // DEBUG
     572           0 :     return true;
     573             :   }
     574             : 
     575           0 :   JSAutoCompartment ac(aCx, global);
     576           0 :   JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
     577           0 :   if (!canonicalProto) {
     578           0 :     return false;
     579             :   }
     580           0 :   JS::Rooted<JSObject*> proto(aCx);
     581           0 :   if (aGivenProto) {
     582           0 :     proto = aGivenProto;
     583             :     // Unfortunately, while aGivenProto was in the compartment of aCx
     584             :     // coming in, we changed compartments to that of "parent" so may need
     585             :     // to wrap the proto here.
     586           0 :     if (js::GetContextCompartment(aCx) != js::GetObjectCompartment(proto)) {
     587           0 :       if (!JS_WrapObject(aCx, &proto)) {
     588           0 :         return false;
     589             :       }
     590             :     }
     591             :   } else {
     592           0 :     proto = canonicalProto;
     593             :   }
     594             : 
     595           0 :   BindingJSObjectCreator<mozilla::dom::SVGPatternElement> creator(aCx);
     596           0 :   creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
     597           0 :   if (!aReflector) {
     598           0 :     return false;
     599             :   }
     600             : 
     601           0 :   aCache->SetWrapper(aReflector);
     602           0 :   creator.InitializationSucceeded();
     603             : 
     604           0 :   MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
     605             :              aCache->GetWrapperPreserveColor() == aReflector);
     606             :   // If proto != canonicalProto, we have to preserve our wrapper;
     607             :   // otherwise we won't be able to properly recreate it later, since
     608             :   // we won't know what proto to use.  Note that we don't check
     609             :   // aGivenProto here, since it's entirely possible (and even
     610             :   // somewhat common) to have a non-null aGivenProto which is the
     611             :   // same as canonicalProto.
     612           0 :   if (proto != canonicalProto) {
     613           0 :     PreserveWrapper(aObject);
     614             :   }
     615             : 
     616           0 :   return true;
     617             : }
     618             : 
     619             : const NativePropertyHooks sNativePropertyHooks[] = { {
     620             :   nullptr,
     621             :   nullptr,
     622             :   nullptr,
     623             :   { sNativeProperties.Upcast(), nullptr },
     624             :   prototypes::id::SVGPatternElement,
     625             :   constructors::id::SVGPatternElement,
     626             :   SVGElementBinding::sNativePropertyHooks,
     627             :   &DefaultXrayExpandoObjectClass
     628             : } };
     629             : 
     630             : void
     631           0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
     632             : {
     633           0 :   JS::Handle<JSObject*> parentProto(SVGElementBinding::GetProtoObjectHandle(aCx));
     634           0 :   if (!parentProto) {
     635           0 :     return;
     636             :   }
     637             : 
     638           0 :   JS::Handle<JSObject*> constructorProto(SVGElementBinding::GetConstructorObjectHandle(aCx));
     639           0 :   if (!constructorProto) {
     640           0 :     return;
     641             :   }
     642             : 
     643             :   static bool sIdsInited = false;
     644           0 :   if (!sIdsInited && NS_IsMainThread()) {
     645           0 :     if (!InitIds(aCx, sNativeProperties.Upcast())) {
     646           0 :       return;
     647             :     }
     648           0 :     sIdsInited = true;
     649             :   }
     650             : 
     651           0 :   JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGPatternElement);
     652           0 :   JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGPatternElement);
     653           0 :   dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
     654             :                               &sPrototypeClass.mBase, protoCache,
     655             :                               constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
     656             :                               interfaceCache,
     657             :                               sNativeProperties.Upcast(),
     658             :                               nullptr,
     659             :                               "SVGPatternElement", aDefineOnGlobal,
     660             :                               nullptr,
     661           0 :                               false);
     662             : }
     663             : 
     664             : JS::Handle<JSObject*>
     665           0 : GetProtoObjectHandle(JSContext* aCx)
     666             : {
     667             :   /* Get the interface prototype object for this class.  This will create the
     668             :      object as needed. */
     669           0 :   bool aDefineOnGlobal = true;
     670             : 
     671             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     672           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     673           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     674           0 :     return nullptr;
     675             :   }
     676             : 
     677             :   /* Check to see whether the interface objects are already installed */
     678           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     679           0 :   if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SVGPatternElement)) {
     680           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     681           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     682             :   }
     683             : 
     684             :   /*
     685             :    * The object might _still_ be null, but that's OK.
     686             :    *
     687             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     688             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     689             :    * changed after they have been set.
     690             :    *
     691             :    * Calling address() avoids the read read barrier that does gray
     692             :    * unmarking, but it's not possible for the object to be gray here.
     693             :    */
     694             : 
     695           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SVGPatternElement);
     696           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     697           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     698             : }
     699             : 
     700             : JS::Handle<JSObject*>
     701           0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
     702             : {
     703             :   /* Get the interface object for this class.  This will create the object as
     704             :      needed. */
     705             : 
     706             :   /* Make sure our global is sane.  Hopefully we can remove this sometime */
     707           0 :   JSObject* global = JS::CurrentGlobalOrNull(aCx);
     708           0 :   if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
     709           0 :     return nullptr;
     710             :   }
     711             : 
     712             :   /* Check to see whether the interface objects are already installed */
     713           0 :   ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
     714           0 :   if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGPatternElement)) {
     715           0 :     JS::Rooted<JSObject*> rootedGlobal(aCx, global);
     716           0 :     CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
     717             :   }
     718             : 
     719             :   /*
     720             :    * The object might _still_ be null, but that's OK.
     721             :    *
     722             :    * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
     723             :    * traced by TraceProtoAndIfaceCache() and its contents are never
     724             :    * changed after they have been set.
     725             :    *
     726             :    * Calling address() avoids the read read barrier that does gray
     727             :    * unmarking, but it's not possible for the object to be gray here.
     728             :    */
     729             : 
     730           0 :   const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGPatternElement);
     731           0 :   MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
     732           0 :   return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
     733             : }
     734             : 
     735             : JSObject*
     736           0 : GetConstructorObject(JSContext* aCx)
     737             : {
     738           0 :   return GetConstructorObjectHandle(aCx);
     739             : }
     740             : 
     741             : } // namespace SVGPatternElementBinding
     742             : 
     743             : 
     744             : 
     745             : } // namespace dom
     746             : } // namespace mozilla

Generated by: LCOV version 1.13