/*
    This file is part of the WebKit open source project.
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/

#include "config.h"
#include "JSCSSFontFaceRule.h"

#include "CSSFontFaceRule.h"
#include "CSSStyleDeclaration.h"
#include "JSCSSStyleDeclaration.h"
#include "StylePropertySet.h"
#include <wtf/GetPtr.h>

using namespace JSC;

namespace WebCore {

/* Hash table */

static const HashTableValue JSCSSFontFaceRuleTableValues[] =
{
    { "style", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSFontFaceRuleStyle), (intptr_t)0, NoIntrinsic },
    { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSFontFaceRuleConstructor), (intptr_t)0, NoIntrinsic },
    { 0, 0, 0, 0, NoIntrinsic }
};

static const HashTable JSCSSFontFaceRuleTable = { 4, 3, JSCSSFontFaceRuleTableValues, 0 };
/* Hash table for constructor */

static const HashTableValue JSCSSFontFaceRuleConstructorTableValues[] =
{
    { 0, 0, 0, 0, NoIntrinsic }
};

static const HashTable JSCSSFontFaceRuleConstructorTable = { 1, 0, JSCSSFontFaceRuleConstructorTableValues, 0 };
const ClassInfo JSCSSFontFaceRuleConstructor::s_info = { "CSSFontFaceRuleConstructor", &Base::s_info, &JSCSSFontFaceRuleConstructorTable, 0, CREATE_METHOD_TABLE(JSCSSFontFaceRuleConstructor) };

JSCSSFontFaceRuleConstructor::JSCSSFontFaceRuleConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
    : DOMConstructorObject(structure, globalObject)
{
}

void JSCSSFontFaceRuleConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
{
    Base::finishCreation(exec->vm());
    ASSERT(inherits(&s_info));
    putDirect(exec->vm(), exec->propertyNames().prototype, JSCSSFontFaceRulePrototype::self(exec, globalObject), DontDelete | ReadOnly);
    putDirect(exec->vm(), exec->propertyNames().length, jsNumber(0), ReadOnly | DontDelete | DontEnum);
}

bool JSCSSFontFaceRuleConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSCSSFontFaceRuleConstructor, JSDOMWrapper>(exec, &JSCSSFontFaceRuleConstructorTable, jsCast<JSCSSFontFaceRuleConstructor*>(cell), propertyName, slot);
}

bool JSCSSFontFaceRuleConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
{
    return getStaticValueDescriptor<JSCSSFontFaceRuleConstructor, JSDOMWrapper>(exec, &JSCSSFontFaceRuleConstructorTable, jsCast<JSCSSFontFaceRuleConstructor*>(object), propertyName, descriptor);
}

/* Hash table for prototype */

static const HashTableValue JSCSSFontFaceRulePrototypeTableValues[] =
{
    { 0, 0, 0, 0, NoIntrinsic }
};

static const HashTable JSCSSFontFaceRulePrototypeTable = { 1, 0, JSCSSFontFaceRulePrototypeTableValues, 0 };
const ClassInfo JSCSSFontFaceRulePrototype::s_info = { "CSSFontFaceRulePrototype", &Base::s_info, &JSCSSFontFaceRulePrototypeTable, 0, CREATE_METHOD_TABLE(JSCSSFontFaceRulePrototype) };

JSObject* JSCSSFontFaceRulePrototype::self(ExecState* exec, JSGlobalObject* globalObject)
{
    return getDOMPrototype<JSCSSFontFaceRule>(exec, globalObject);
}

const ClassInfo JSCSSFontFaceRule::s_info = { "CSSFontFaceRule", &Base::s_info, &JSCSSFontFaceRuleTable, 0 , CREATE_METHOD_TABLE(JSCSSFontFaceRule) };

JSCSSFontFaceRule::JSCSSFontFaceRule(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<CSSFontFaceRule> impl)
    : JSCSSRule(structure, globalObject, impl)
{
}

void JSCSSFontFaceRule::finishCreation(VM& vm)
{
    Base::finishCreation(vm);
    ASSERT(inherits(&s_info));
}

JSObject* JSCSSFontFaceRule::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
{
    return JSCSSFontFaceRulePrototype::create(exec->vm(), globalObject, JSCSSFontFaceRulePrototype::createStructure(exec->vm(), globalObject, JSCSSRulePrototype::self(exec, globalObject)));
}

bool JSCSSFontFaceRule::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
    JSCSSFontFaceRule* thisObject = jsCast<JSCSSFontFaceRule*>(cell);
    ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
    return getStaticValueSlot<JSCSSFontFaceRule, Base>(exec, &JSCSSFontFaceRuleTable, thisObject, propertyName, slot);
}

bool JSCSSFontFaceRule::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
{
    JSCSSFontFaceRule* thisObject = jsCast<JSCSSFontFaceRule*>(object);
    ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
    return getStaticValueDescriptor<JSCSSFontFaceRule, Base>(exec, &JSCSSFontFaceRuleTable, thisObject, propertyName, descriptor);
}

JSValue jsCSSFontFaceRuleStyle(ExecState* exec, JSValue slotBase, PropertyName)
{
    JSCSSFontFaceRule* castedThis = jsCast<JSCSSFontFaceRule*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    CSSFontFaceRule* impl = static_cast<CSSFontFaceRule*>(castedThis->impl());
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->style()));
    return result;
}


JSValue jsCSSFontFaceRuleConstructor(ExecState* exec, JSValue slotBase, PropertyName)
{
    JSCSSFontFaceRule* domObject = jsCast<JSCSSFontFaceRule*>(asObject(slotBase));
    return JSCSSFontFaceRule::getConstructor(exec, domObject->globalObject());
}

JSValue JSCSSFontFaceRule::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
{
    return getDOMConstructor<JSCSSFontFaceRuleConstructor>(exec, jsCast<JSDOMGlobalObject*>(globalObject));
}

#if ENABLE(BINDING_INTEGRITY)
#if PLATFORM(WIN)
#pragma warning(disable: 4483)
extern "C" { extern void (*const __identifier("??_7CSSFontFaceRule@WebCore@@6B@")[])(); }
#else
extern "C" { extern void* _ZTVN7WebCore15CSSFontFaceRuleE[]; }
#endif
#endif
JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, CSSFontFaceRule* impl)
{
    if (!impl)
        return jsNull();
    if (JSValue result = getExistingWrapper<JSCSSFontFaceRule>(exec, impl))
        return result;

#if ENABLE(BINDING_INTEGRITY)
    void* actualVTablePointer = *(reinterpret_cast<void**>(impl));
#if PLATFORM(WIN)
    void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7CSSFontFaceRule@WebCore@@6B@"));
#else
    void* expectedVTablePointer = &_ZTVN7WebCore15CSSFontFaceRuleE[2];
#if COMPILER(CLANG) && COMPILER_SUPPORTS(CXX_STATIC_ASSERT)
    // If this fails CSSFontFaceRule does not have a vtable, so you need to add the
    // ImplementationLacksVTable attribute to the interface definition
    COMPILE_ASSERT(__is_polymorphic(CSSFontFaceRule), CSSFontFaceRule_is_not_polymorphic);
#endif
#endif
    // If you hit this assertion you either have a use after free bug, or
    // CSSFontFaceRule has subclasses. If CSSFontFaceRule has subclasses that get passed
    // to toJS() we currently require CSSFontFaceRule you to opt out of binding hardening
    // by adding the SkipVTableValidation attribute to the interface IDL definition
    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
#endif
    ReportMemoryCost<CSSFontFaceRule>::reportMemoryCost(exec, impl);
    return createNewWrapper<JSCSSFontFaceRule>(exec, globalObject, impl);
}

CSSFontFaceRule* toCSSFontFaceRule(JSC::JSValue value)
{
    return value.inherits(&JSCSSFontFaceRule::s_info) ? jsCast<JSCSSFontFaceRule*>(asObject(value))->impl() : 0;
}

}
