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

#include "Document.h"
#include "Frame.h"
#include "SVGDocumentExtensions.h"
#include "SVGElement.h"
#include "SVGAnimatedTemplate.h"
#include "JSSVGRadialGradientElement.h"

#include <wtf/GetPtr.h>

#include "JSSVGAnimatedLength.h"
#include "SVGRadialGradientElement.h"

using namespace KJS;

namespace WebCore {

/* Hash table */

static const HashEntry JSSVGRadialGradientElementTableEntries[] =
{
    { "fx", JSSVGRadialGradientElement::FxAttrNum, DontDelete|ReadOnly, 0, 0 },
    { 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0 },
    { "cy", JSSVGRadialGradientElement::CyAttrNum, DontDelete|ReadOnly, 0, &JSSVGRadialGradientElementTableEntries[6] },
    { "cx", JSSVGRadialGradientElement::CxAttrNum, DontDelete|ReadOnly, 0, &JSSVGRadialGradientElementTableEntries[5] },
    { "r", JSSVGRadialGradientElement::RAttrNum, DontDelete|ReadOnly, 0, 0 },
    { "fy", JSSVGRadialGradientElement::FyAttrNum, DontDelete|ReadOnly, 0, 0 }
};

static const HashTable JSSVGRadialGradientElementTable = 
{
    2, 7, JSSVGRadialGradientElementTableEntries, 5
};

/* Hash table for prototype */

static const HashEntry JSSVGRadialGradientElementPrototypeTableEntries[] =
{
    { 0, 0, 0, 0, 0 }
};

static const HashTable JSSVGRadialGradientElementPrototypeTable = 
{
    2, 1, JSSVGRadialGradientElementPrototypeTableEntries, 1
};

const ClassInfo JSSVGRadialGradientElementPrototype::info = { "SVGRadialGradientElementPrototype", 0, &JSSVGRadialGradientElementPrototypeTable, 0 };

JSObject* JSSVGRadialGradientElementPrototype::self(ExecState* exec)
{
    return KJS::cacheGlobalObject<JSSVGRadialGradientElementPrototype>(exec, "[[JSSVGRadialGradientElement.prototype]]");
}

const ClassInfo JSSVGRadialGradientElement::info = { "SVGRadialGradientElement", &JSSVGGradientElement::info, &JSSVGRadialGradientElementTable, 0 };

JSSVGRadialGradientElement::JSSVGRadialGradientElement(ExecState* exec, SVGRadialGradientElement* impl)
    : JSSVGGradientElement(exec, impl)
{
    setPrototype(JSSVGRadialGradientElementPrototype::self(exec));
}

bool JSSVGRadialGradientElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSSVGRadialGradientElement, JSSVGGradientElement>(exec, &JSSVGRadialGradientElementTable, this, propertyName, slot);
}

JSValue* JSSVGRadialGradientElement::getValueProperty(ExecState* exec, int token) const
{
    switch (token) {
    case CxAttrNum: {
        SVGRadialGradientElement* imp = static_cast<SVGRadialGradientElement*>(impl());

        ASSERT(exec && exec->dynamicInterpreter());

        RefPtr<SVGAnimatedLength> obj = imp->cxAnimated();
        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
        if (activeFrame) {
            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
            if (extensions) {
                if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))
                    ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);
                else
                    extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);
            }
        }

        return toJS(exec, obj.get());
    }
    case CyAttrNum: {
        SVGRadialGradientElement* imp = static_cast<SVGRadialGradientElement*>(impl());

        ASSERT(exec && exec->dynamicInterpreter());

        RefPtr<SVGAnimatedLength> obj = imp->cyAnimated();
        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
        if (activeFrame) {
            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
            if (extensions) {
                if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))
                    ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);
                else
                    extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);
            }
        }

        return toJS(exec, obj.get());
    }
    case RAttrNum: {
        SVGRadialGradientElement* imp = static_cast<SVGRadialGradientElement*>(impl());

        ASSERT(exec && exec->dynamicInterpreter());

        RefPtr<SVGAnimatedLength> obj = imp->rAnimated();
        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
        if (activeFrame) {
            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
            if (extensions) {
                if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))
                    ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);
                else
                    extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);
            }
        }

        return toJS(exec, obj.get());
    }
    case FxAttrNum: {
        SVGRadialGradientElement* imp = static_cast<SVGRadialGradientElement*>(impl());

        ASSERT(exec && exec->dynamicInterpreter());

        RefPtr<SVGAnimatedLength> obj = imp->fxAnimated();
        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
        if (activeFrame) {
            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
            if (extensions) {
                if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))
                    ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);
                else
                    extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);
            }
        }

        return toJS(exec, obj.get());
    }
    case FyAttrNum: {
        SVGRadialGradientElement* imp = static_cast<SVGRadialGradientElement*>(impl());

        ASSERT(exec && exec->dynamicInterpreter());

        RefPtr<SVGAnimatedLength> obj = imp->fyAnimated();
        Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
        if (activeFrame) {
            SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
            if (extensions) {
                if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))
                    ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);
                else
                    extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);
            }
        }

        return toJS(exec, obj.get());
    }
    }
    return 0;
}


}

#endif // ENABLE(SVG)
