/*
    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 "JSSVGPathSegCurvetoCubicSmoothRel.h"

#include <wtf/GetPtr.h>

#include "SVGPathSegCurvetoCubicSmooth.h"

using namespace KJS;

namespace WebCore {

/* Hash table */

static const HashEntry JSSVGPathSegCurvetoCubicSmoothRelTableEntries[] =
{
    { "y", JSSVGPathSegCurvetoCubicSmoothRel::YAttrNum, DontDelete, 0, 0 },
    { "x", JSSVGPathSegCurvetoCubicSmoothRel::XAttrNum, DontDelete, 0, &JSSVGPathSegCurvetoCubicSmoothRelTableEntries[4] },
    { 0, 0, 0, 0, 0 },
    { "y2", JSSVGPathSegCurvetoCubicSmoothRel::Y2AttrNum, DontDelete, 0, 0 },
    { "x2", JSSVGPathSegCurvetoCubicSmoothRel::X2AttrNum, DontDelete, 0, 0 }
};

static const HashTable JSSVGPathSegCurvetoCubicSmoothRelTable = 
{
    2, 5, JSSVGPathSegCurvetoCubicSmoothRelTableEntries, 4
};

/* Hash table for prototype */

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

static const HashTable JSSVGPathSegCurvetoCubicSmoothRelPrototypeTable = 
{
    2, 1, JSSVGPathSegCurvetoCubicSmoothRelPrototypeTableEntries, 1
};

const ClassInfo JSSVGPathSegCurvetoCubicSmoothRelPrototype::info = { "SVGPathSegCurvetoCubicSmoothRelPrototype", 0, &JSSVGPathSegCurvetoCubicSmoothRelPrototypeTable, 0 };

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

const ClassInfo JSSVGPathSegCurvetoCubicSmoothRel::info = { "SVGPathSegCurvetoCubicSmoothRel", &JSSVGPathSeg::info, &JSSVGPathSegCurvetoCubicSmoothRelTable, 0 };

JSSVGPathSegCurvetoCubicSmoothRel::JSSVGPathSegCurvetoCubicSmoothRel(ExecState* exec, SVGPathSegCurvetoCubicSmoothRel* impl)
    : JSSVGPathSeg(exec, impl)
{
    setPrototype(JSSVGPathSegCurvetoCubicSmoothRelPrototype::self(exec));
}

bool JSSVGPathSegCurvetoCubicSmoothRel::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSSVGPathSegCurvetoCubicSmoothRel, JSSVGPathSeg>(exec, &JSSVGPathSegCurvetoCubicSmoothRelTable, this, propertyName, slot);
}

JSValue* JSSVGPathSegCurvetoCubicSmoothRel::getValueProperty(ExecState* exec, int token) const
{
    switch (token) {
    case XAttrNum: {
        SVGPathSegCurvetoCubicSmoothRel* imp = static_cast<SVGPathSegCurvetoCubicSmoothRel*>(impl());

        return jsNumber(imp->x());
    }
    case YAttrNum: {
        SVGPathSegCurvetoCubicSmoothRel* imp = static_cast<SVGPathSegCurvetoCubicSmoothRel*>(impl());

        return jsNumber(imp->y());
    }
    case X2AttrNum: {
        SVGPathSegCurvetoCubicSmoothRel* imp = static_cast<SVGPathSegCurvetoCubicSmoothRel*>(impl());

        return jsNumber(imp->x2());
    }
    case Y2AttrNum: {
        SVGPathSegCurvetoCubicSmoothRel* imp = static_cast<SVGPathSegCurvetoCubicSmoothRel*>(impl());

        return jsNumber(imp->y2());
    }
    }
    return 0;
}

void JSSVGPathSegCurvetoCubicSmoothRel::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr)
{
    lookupPut<JSSVGPathSegCurvetoCubicSmoothRel, JSSVGPathSeg>(exec, propertyName, value, attr, &JSSVGPathSegCurvetoCubicSmoothRelTable, this);
}

void JSSVGPathSegCurvetoCubicSmoothRel::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/)
{
    switch (token) {
    case XAttrNum: {
        SVGPathSegCurvetoCubicSmoothRel* imp = static_cast<SVGPathSegCurvetoCubicSmoothRel*>(impl());

        imp->setX(value->toFloat(exec));
        break;
    }
    case YAttrNum: {
        SVGPathSegCurvetoCubicSmoothRel* imp = static_cast<SVGPathSegCurvetoCubicSmoothRel*>(impl());

        imp->setY(value->toFloat(exec));
        break;
    }
    case X2AttrNum: {
        SVGPathSegCurvetoCubicSmoothRel* imp = static_cast<SVGPathSegCurvetoCubicSmoothRel*>(impl());

        imp->setX2(value->toFloat(exec));
        break;
    }
    case Y2AttrNum: {
        SVGPathSegCurvetoCubicSmoothRel* imp = static_cast<SVGPathSegCurvetoCubicSmoothRel*>(impl());

        imp->setY2(value->toFloat(exec));
        break;
    }
    }
    SVGPathSegCurvetoCubicSmoothRel* imp = static_cast<SVGPathSegCurvetoCubicSmoothRel*>(impl());

    ASSERT(exec && exec->dynamicInterpreter());
    Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
    if (!activeFrame)
        return;

    SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
    if (extensions && extensions->hasGenericContext<SVGPathSeg>(imp)) {
        const SVGElement* context = extensions->genericContext<SVGPathSeg>(imp);
        ASSERT(context);

        context->notifyAttributeChange();
    }

}


}

#endif // ENABLE(SVG)
