/*
    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"

#if ENABLE(SVG) && ENABLE(SVG_FONTS)

#include "JSSVGGlyphRefElement.h"

#include "SVGGlyphRefElement.h"
#include "SVGNames.h"
#include "URL.h"
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>

#if ENABLE(SVG)
#include "JSSVGAnimatedString.h"
#endif

using namespace JSC;

namespace WebCore {

/* Hash table */

static const HashTableValue JSSVGGlyphRefElementTableValues[] =
{
    { "glyphRef", DontDelete, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGGlyphRefElementGlyphRef), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGGlyphRefElementGlyphRef) },
    { "format", DontDelete, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGGlyphRefElementFormat), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGGlyphRefElementFormat) },
    { "x", DontDelete, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGGlyphRefElementX), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGGlyphRefElementX) },
    { "y", DontDelete, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGGlyphRefElementY), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGGlyphRefElementY) },
    { "dx", DontDelete, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGGlyphRefElementDx), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGGlyphRefElementDx) },
    { "dy", DontDelete, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGGlyphRefElementDy), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGGlyphRefElementDy) },
#if ENABLE(SVG)
    { "href", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGGlyphRefElementHref), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
#endif
    { "constructor", DontEnum | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGGlyphRefElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { 0, 0, NoIntrinsic, 0, 0 }
};

static const HashTable JSSVGGlyphRefElementTable = { 17, 15, true, JSSVGGlyphRefElementTableValues, 0 };
/* Hash table for constructor */

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

static const HashTable JSSVGGlyphRefElementConstructorTable = { 1, 0, false, JSSVGGlyphRefElementConstructorTableValues, 0 };
const ClassInfo JSSVGGlyphRefElementConstructor::s_info = { "SVGGlyphRefElementConstructor", &Base::s_info, &JSSVGGlyphRefElementConstructorTable, 0, CREATE_METHOD_TABLE(JSSVGGlyphRefElementConstructor) };

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

void JSSVGGlyphRefElementConstructor::finishCreation(VM& vm, JSDOMGlobalObject* globalObject)
{
    Base::finishCreation(vm);
    ASSERT(inherits(info()));
    putDirect(vm, vm.propertyNames->prototype, JSSVGGlyphRefElementPrototype::self(vm, globalObject), DontDelete | ReadOnly);
    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontDelete | DontEnum);
}

bool JSSVGGlyphRefElementConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSSVGGlyphRefElementConstructor, JSDOMWrapper>(exec, JSSVGGlyphRefElementConstructorTable, jsCast<JSSVGGlyphRefElementConstructor*>(object), propertyName, slot);
}

/* Hash table for prototype */

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

static const HashTable JSSVGGlyphRefElementPrototypeTable = { 1, 0, false, JSSVGGlyphRefElementPrototypeTableValues, 0 };
const ClassInfo JSSVGGlyphRefElementPrototype::s_info = { "SVGGlyphRefElementPrototype", &Base::s_info, &JSSVGGlyphRefElementPrototypeTable, 0, CREATE_METHOD_TABLE(JSSVGGlyphRefElementPrototype) };

JSObject* JSSVGGlyphRefElementPrototype::self(VM& vm, JSGlobalObject* globalObject)
{
    return getDOMPrototype<JSSVGGlyphRefElement>(vm, globalObject);
}

const ClassInfo JSSVGGlyphRefElement::s_info = { "SVGGlyphRefElement", &Base::s_info, &JSSVGGlyphRefElementTable, 0 , CREATE_METHOD_TABLE(JSSVGGlyphRefElement) };

JSSVGGlyphRefElement::JSSVGGlyphRefElement(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<SVGGlyphRefElement> impl)
    : JSSVGElement(structure, globalObject, impl)
{
}

void JSSVGGlyphRefElement::finishCreation(VM& vm)
{
    Base::finishCreation(vm);
    ASSERT(inherits(info()));
}

JSObject* JSSVGGlyphRefElement::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
    return JSSVGGlyphRefElementPrototype::create(vm, globalObject, JSSVGGlyphRefElementPrototype::createStructure(vm, globalObject, JSSVGElementPrototype::self(vm, globalObject)));
}

bool JSSVGGlyphRefElement::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
    JSSVGGlyphRefElement* thisObject = jsCast<JSSVGGlyphRefElement*>(object);
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    return getStaticValueSlot<JSSVGGlyphRefElement, Base>(exec, JSSVGGlyphRefElementTable, thisObject, propertyName, slot);
}

EncodedJSValue jsSVGGlyphRefElementGlyphRef(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSSVGGlyphRefElement* castedThis = jsDynamicCast<JSSVGGlyphRefElement*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    SVGGlyphRefElement& impl = castedThis->impl();
    JSValue result = jsStringWithCache(exec, impl.glyphRef());
    return JSValue::encode(result);
}


EncodedJSValue jsSVGGlyphRefElementFormat(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSSVGGlyphRefElement* castedThis = jsDynamicCast<JSSVGGlyphRefElement*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    SVGGlyphRefElement& impl = castedThis->impl();
    JSValue result = jsStringWithCache(exec, impl.fastGetAttribute(WebCore::SVGNames::formatAttr));
    return JSValue::encode(result);
}


EncodedJSValue jsSVGGlyphRefElementX(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSSVGGlyphRefElement* castedThis = jsDynamicCast<JSSVGGlyphRefElement*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    SVGGlyphRefElement& impl = castedThis->impl();
    JSValue result = jsNumber(impl.x());
    return JSValue::encode(result);
}


EncodedJSValue jsSVGGlyphRefElementY(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSSVGGlyphRefElement* castedThis = jsDynamicCast<JSSVGGlyphRefElement*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    SVGGlyphRefElement& impl = castedThis->impl();
    JSValue result = jsNumber(impl.y());
    return JSValue::encode(result);
}


EncodedJSValue jsSVGGlyphRefElementDx(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSSVGGlyphRefElement* castedThis = jsDynamicCast<JSSVGGlyphRefElement*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    SVGGlyphRefElement& impl = castedThis->impl();
    JSValue result = jsNumber(impl.dx());
    return JSValue::encode(result);
}


EncodedJSValue jsSVGGlyphRefElementDy(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSSVGGlyphRefElement* castedThis = jsDynamicCast<JSSVGGlyphRefElement*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    SVGGlyphRefElement& impl = castedThis->impl();
    JSValue result = jsNumber(impl.dy());
    return JSValue::encode(result);
}


#if ENABLE(SVG)
EncodedJSValue jsSVGGlyphRefElementHref(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSSVGGlyphRefElement* castedThis = jsDynamicCast<JSSVGGlyphRefElement*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    SVGGlyphRefElement& impl = castedThis->impl();
    RefPtr<SVGAnimatedString> obj = impl.hrefAnimated();
    JSValue result =  toJS(exec, castedThis->globalObject(), obj.get());
    return JSValue::encode(result);
}

#endif

EncodedJSValue jsSVGGlyphRefElementConstructor(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue, PropertyName)
{
    JSSVGGlyphRefElement* domObject = jsDynamicCast<JSSVGGlyphRefElement*>(JSValue::decode(thisValue));
    if (!domObject)
        return throwVMTypeError(exec);
    if (!domObject)
        return throwVMTypeError(exec);
    return JSValue::encode(JSSVGGlyphRefElement::getConstructor(exec->vm(), domObject->globalObject()));
}

void setJSSVGGlyphRefElementGlyphRef(ExecState* exec, JSObject* /* baseObject */, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
    JSValue value = JSValue::decode(encodedValue);
    UNUSED_PARAM(exec);
    JSSVGGlyphRefElement* castedThis = jsDynamicCast<JSSVGGlyphRefElement*>(JSValue::decode(thisValue));
    if (!castedThis) {
        throwVMTypeError(exec);
        return;
    }
    SVGGlyphRefElement& impl = castedThis->impl();
    ExceptionCode ec = 0;
    const String& nativeValue(value.isEmpty() ? String() : value.toString(exec)->value(exec));
    if (exec->hadException())
        return;
    impl.setGlyphRef(nativeValue, ec);
    setDOMException(exec, ec);
}


void setJSSVGGlyphRefElementFormat(ExecState* exec, JSObject* /* baseObject */, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
    JSValue value = JSValue::decode(encodedValue);
    UNUSED_PARAM(exec);
    JSSVGGlyphRefElement* castedThis = jsDynamicCast<JSSVGGlyphRefElement*>(JSValue::decode(thisValue));
    if (!castedThis) {
        throwVMTypeError(exec);
        return;
    }
    SVGGlyphRefElement& impl = castedThis->impl();
    const String& nativeValue(valueToStringWithNullCheck(exec, value));
    if (exec->hadException())
        return;
    impl.setAttribute(WebCore::SVGNames::formatAttr, nativeValue);
}


void setJSSVGGlyphRefElementX(ExecState* exec, JSObject* /* baseObject */, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
    JSValue value = JSValue::decode(encodedValue);
    UNUSED_PARAM(exec);
    JSSVGGlyphRefElement* castedThis = jsDynamicCast<JSSVGGlyphRefElement*>(JSValue::decode(thisValue));
    if (!castedThis) {
        throwVMTypeError(exec);
        return;
    }
    SVGGlyphRefElement& impl = castedThis->impl();
    ExceptionCode ec = 0;
    float nativeValue(value.toFloat(exec));
    if (exec->hadException())
        return;
    impl.setX(nativeValue, ec);
    setDOMException(exec, ec);
}


void setJSSVGGlyphRefElementY(ExecState* exec, JSObject* /* baseObject */, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
    JSValue value = JSValue::decode(encodedValue);
    UNUSED_PARAM(exec);
    JSSVGGlyphRefElement* castedThis = jsDynamicCast<JSSVGGlyphRefElement*>(JSValue::decode(thisValue));
    if (!castedThis) {
        throwVMTypeError(exec);
        return;
    }
    SVGGlyphRefElement& impl = castedThis->impl();
    ExceptionCode ec = 0;
    float nativeValue(value.toFloat(exec));
    if (exec->hadException())
        return;
    impl.setY(nativeValue, ec);
    setDOMException(exec, ec);
}


void setJSSVGGlyphRefElementDx(ExecState* exec, JSObject* /* baseObject */, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
    JSValue value = JSValue::decode(encodedValue);
    UNUSED_PARAM(exec);
    JSSVGGlyphRefElement* castedThis = jsDynamicCast<JSSVGGlyphRefElement*>(JSValue::decode(thisValue));
    if (!castedThis) {
        throwVMTypeError(exec);
        return;
    }
    SVGGlyphRefElement& impl = castedThis->impl();
    ExceptionCode ec = 0;
    float nativeValue(value.toFloat(exec));
    if (exec->hadException())
        return;
    impl.setDx(nativeValue, ec);
    setDOMException(exec, ec);
}


void setJSSVGGlyphRefElementDy(ExecState* exec, JSObject* /* baseObject */, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
    JSValue value = JSValue::decode(encodedValue);
    UNUSED_PARAM(exec);
    JSSVGGlyphRefElement* castedThis = jsDynamicCast<JSSVGGlyphRefElement*>(JSValue::decode(thisValue));
    if (!castedThis) {
        throwVMTypeError(exec);
        return;
    }
    SVGGlyphRefElement& impl = castedThis->impl();
    ExceptionCode ec = 0;
    float nativeValue(value.toFloat(exec));
    if (exec->hadException())
        return;
    impl.setDy(nativeValue, ec);
    setDOMException(exec, ec);
}


JSValue JSSVGGlyphRefElement::getConstructor(VM& vm, JSGlobalObject* globalObject)
{
    return getDOMConstructor<JSSVGGlyphRefElementConstructor>(vm, jsCast<JSDOMGlobalObject*>(globalObject));
}


}

#endif // ENABLE(SVG) && ENABLE(SVG_FONTS)
