Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM FontFaceSet.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_FONTFACESETBINDING_H_
#define DOM_FONTFACESETBINDING_H_
#include "js/CallAndConstruct.h"
#include "js/RootingAPI.h"
#include "js/TypeDecls.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/EnumTypeTraits.h"
#include "mozilla/Span.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/CallbackFunction.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/PrototypeList.h"
#include "mozilla/dom/ToJSValue.h"
namespace mozilla {
namespace dom {
class FontFace;
class FontFaceSet;
class FontFaceSetForEachCallback;
class FontFaceSetIterator;
struct FontFaceSetIteratorResultAtoms;
struct NativePropertyHooks;
class ProtoAndIfaceCache;
} // namespace dom
} // namespace mozilla
namespace mozilla {
namespace dom {
enum class FontFaceSetLoadStatus : uint8_t {
Loading,
Loaded,
};
namespace binding_detail {
template <> struct EnumStrings<FontFaceSetLoadStatus> {
static constexpr nsLiteralCString Values[2] {
"loading"_ns,
"loaded"_ns,
};
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, FontFaceSetLoadStatus aArgument, JS::MutableHandle<JS::Value> aValue);
class FontFaceSetForEachCallback : public CallbackFunction
{
public:
explicit inline FontFaceSetForEachCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline FontFaceSetForEachCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
: CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline FontFaceSetForEachCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline FontFaceSetForEachCallback(CallbackFunction* aOther)
: CallbackFunction(aOther)
{
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline void
Call(const T& thisVal, FontFace& value, FontFace& key, FontFaceSet& set, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
{
MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
if (!aExecutionReason) {
aExecutionReason = "FontFaceSetForEachCallback";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return;
}
JS::Rooted<JS::Value> thisValJS(s.GetContext());
if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
return Call(s.GetCallContext(), thisValJS, value, key, set, aRv);
}
MOZ_CAN_RUN_SCRIPT inline void
Call(FontFace& value, FontFace& key, FontFaceSet& set, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
{
MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
if (!aExecutionReason) {
aExecutionReason = "FontFaceSetForEachCallback";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return;
}
return Call(s.GetCallContext(), JS::UndefinedHandleValue, value, key, set, aRv);
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline void
Call(const T& thisVal, FontFace& value, FontFace& key, FontFaceSet& set, const char* aExecutionReason = nullptr)
{
return Call(thisVal, value, key, set, IgnoreErrors(), aExecutionReason);
}
MOZ_CAN_RUN_SCRIPT inline void
Call(FontFace& value, FontFace& key, FontFaceSet& set, const char* aExecutionReason = nullptr)
{
return Call(value, key, set, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr);
}
inline bool
operator==(const FontFaceSetForEachCallback& aOther) const
{
return CallbackFunction::operator==(aOther);
}
private:
MOZ_CAN_RUN_SCRIPT void Call(BindingCallContext& cx, JS::Handle<JS::Value> aThisVal, FontFace& value, FontFace& key, FontFaceSet& set, ErrorResult& aRv);
};
namespace binding_detail {
class FastFontFaceSetForEachCallback : public FontFaceSetForEachCallback
{
public:
explicit inline FastFontFaceSetForEachCallback(JSObject* aCallback, JSObject* aCallbackGlobal)
: FontFaceSetForEachCallback(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
}
inline void
Trace(JSTracer* aTracer)
{
FontFaceSetForEachCallback::Trace(aTracer);
}
inline void
FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
{
FontFaceSetForEachCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
}
};
} // namespace binding_detail
struct FontFaceSetIteratorResult : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR bool mDone;
MOZ_INIT_OUTSIDE_CTOR JS::Value mValue;
FontFaceSetIteratorResult();
explicit inline FontFaceSetIteratorResult(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
FontFaceSetIteratorResult(FontFaceSetIteratorResult&& aOther) = default;
private:
FontFaceSetIteratorResult(const FontFaceSetIteratorResult&) = delete;
FontFaceSetIteratorResult& operator=(const FontFaceSetIteratorResult&) = delete;
static bool
InitIds(JSContext* cx, FontFaceSetIteratorResultAtoms* atomsCache);
public:
bool
Init(const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
};
namespace binding_detail {
struct FastFontFaceSetIteratorResult : public FontFaceSetIteratorResult
{
inline FastFontFaceSetIteratorResult()
: FontFaceSetIteratorResult(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
namespace FontFaceSet_Binding {
typedef mozilla::dom::FontFaceSet NativeType;
bool
Wrap(JSContext* aCx, mozilla::dom::FontFaceSet* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
template <class T>
inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
{
JS::Rooted<JSObject*> reflector(aCx);
return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
}
void
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, DefineInterfaceProperty aDefineOnGlobal);
JS::Handle<JSObject*>
GetConstructorObjectHandle(JSContext* aCx);
inline bool CreateAndDefineOnGlobal(JSContext* aCx)
{
// Get the interface or namespace object for this class. This will
// create the object as needed and always define the properties for
// it on the global. The caller should make sure the interface or
// namespace is exposed on the global before calling this.
return GetPerInterfaceObjectHandle(aCx, constructors::id::FontFaceSet,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace FontFaceSet_Binding
namespace FontFaceSetIterator_Binding {
typedef mozilla::dom::FontFaceSetIterator NativeType;
bool
Wrap(JSContext* aCx, mozilla::dom::FontFaceSetIterator* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
void
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, DefineInterfaceProperty aDefineOnGlobal);
} // namespace FontFaceSetIterator_Binding
} // namespace dom
template <>
struct MaxContiguousEnumValue<dom::FontFaceSetLoadStatus>
{
static constexpr dom::FontFaceSetLoadStatus value = dom::FontFaceSetLoadStatus::Loaded;
static_assert(static_cast<uint8_t>(dom::FontFaceSetLoadStatus::Loading) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(std::size(dom::binding_detail::EnumStrings<dom::FontFaceSetLoadStatus>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
} // namespace mozilla
#endif // DOM_FONTFACESETBINDING_H_