Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM ImageText.webidl BY Codegen.py - DO NOT EDIT */
#include <type_traits>
#include "AtomList.h"
#include "ImageTextBinding.h"
#include "MainThreadUtils.h"
#include "js/CallAndConstruct.h"
#include "js/Exception.h"
#include "js/MapAndSet.h"
#include "js/Object.h"
#include "js/PropertyAndElement.h"
#include "js/PropertyDescriptor.h"
#include "js/experimental/JitInfo.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/OwningNonNull.h"
#include "mozilla/dom/BindingCallContext.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/NonRefcountedDOMObject.h"
#include "mozilla/dom/PrimitiveConversions.h"
#include "mozilla/dom/ScriptSettings.h"
namespace mozilla::dom {
namespace binding_detail {}; // Just to make sure it's known as a namespace
using namespace mozilla::dom::binding_detail;
ImageText::ImageText()
{
// Safe to pass a null context if we pass a null value
Init();
}
bool
ImageText::InitIds(JSContext* cx, ImageTextAtoms* atomsCache)
{
MOZ_ASSERT(reinterpret_cast<jsid*>(atomsCache)->isVoid());
// Initialize these in reverse order so that any failure leaves the first one
// uninitialized.
if (!atomsCache->string_id.init(cx, "string") ||
!atomsCache->quad_id.init(cx, "quad") ||
!atomsCache->confidence_id.init(cx, "confidence")) {
return false;
}
return true;
}
bool
ImageText::Init(const char* sourceDescription, bool passedToJSImpl)
{
return true;
}
bool
ImageText::ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const
{
ImageTextAtoms* atomsCache = GetAtomCache<ImageTextAtoms>(cx);
if (reinterpret_cast<jsid*>(atomsCache)->isVoid() &&
!InitIds(cx, atomsCache)) {
return false;
}
JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
if (!obj) {
return false;
}
rval.set(JS::ObjectValue(*obj));
do {
// block for our 'break' successCode and scope for 'temp' and 'currentValue'
JS::Rooted<JS::Value> temp(cx);
float const & currentValue = mConfidence;
temp.set(JS_NumberValue(double(currentValue)));
if (!JS_DefinePropertyById(cx, obj, atomsCache->confidence_id, temp, JSPROP_ENUMERATE)) {
return false;
}
break;
} while(false);
do {
// block for our 'break' successCode and scope for 'temp' and 'currentValue'
JS::Rooted<JS::Value> temp(cx);
OwningNonNull<mozilla::dom::DOMQuad> const & currentValue = mQuad;
if (!GetOrCreateDOMReflector(cx, currentValue, &temp)) {
MOZ_ASSERT(JS_IsExceptionPending(cx));
return false;
}
if (!JS_DefinePropertyById(cx, obj, atomsCache->quad_id, temp, JSPROP_ENUMERATE)) {
return false;
}
break;
} while(false);
do {
// block for our 'break' successCode and scope for 'temp' and 'currentValue'
JS::Rooted<JS::Value> temp(cx);
nsString const & currentValue = mString;
if (!xpc::NonVoidStringToJsval(cx, currentValue, &temp)) {
return false;
}
if (!JS_DefinePropertyById(cx, obj, atomsCache->string_id, temp, JSPROP_ENUMERATE)) {
return false;
}
break;
} while(false);
return true;
}
void
ImageText::TraceDictionary(JSTracer* trc)
{
}
ImageText&
ImageText::operator=(const ImageText& aOther)
{
DictionaryBase::operator=(aOther);
mConfidence = aOther.mConfidence;
mQuad = aOther.mQuad;
mString = aOther.mString;
return *this;
}
} // namespace mozilla::dom