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

#include <wtf/GetPtr.h>

#include "SVGPathSegCurvetoCubic.h"

using namespace KJS;

namespace WebCore {

/* Hash table */

static const HashEntry JSSVGPathSegCurvetoCubicAbsTableEntries[] =
{
    { "x1", JSSVGPathSegCurvetoCubicAbs::X1AttrNum, DontDelete, 0, 0 },
    { "x2", JSSVGPathSegCurvetoCubicAbs::X2AttrNum, DontDelete, 0, &JSSVGPathSegCurvetoCubicAbsTableEntries[6] },
    { 0, 0, 0, 0, 0 },
    { "y1", JSSVGPathSegCurvetoCubicAbs::Y1AttrNum, DontDelete, 0, 0 },
    { "y", JSSVGPathSegCurvetoCubicAbs::YAttrNum, DontDelete, 0, 0 },
    { "x", JSSVGPathSegCurvetoCubicAbs::XAttrNum, DontDelete, 0, 0 },
    { "y2", JSSVGPathSegCurvetoCubicAbs::Y2AttrNum, DontDelete, 0, 0 }
};

static const HashTable JSSVGPathSegCurvetoCubicAbsTable = 
{
    2, 7, JSSVGPathSegCurvetoCubicAbsTableEntries, 6
};

/* Hash table for prototype */

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

static const HashTable JSSVGPathSegCurvetoCubicAbsPrototypeTable = 
{
    2, 1, JSSVGPathSegCurvetoCubicAbsPrototypeTableEntries, 1
};

const ClassInfo JSSVGPathSegCurvetoCubicAbsPrototype::info = { "SVGPathSegCurvetoCubicAbsPrototype", 0, &JSSVGPathSegCurvetoCubicAbsPrototypeTable, 0 };

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

const ClassInfo JSSVGPathSegCurvetoCubicAbs::info = { "SVGPathSegCurvetoCubicAbs", &JSSVGPathSeg::info, &JSSVGPathSegCurvetoCubicAbsTable, 0 };

JSSVGPathSegCurvetoCubicAbs::JSSVGPathSegCurvetoCubicAbs(ExecState* exec, SVGPathSegCurvetoCubicAbs* impl)
    : JSSVGPathSeg(exec, impl)
{
    setPrototype(JSSVGPathSegCurvetoCubicAbsPrototype::self(exec));
}

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

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

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

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

        return jsNumber(imp->x1());
    }
    case Y1AttrNum: {
        SVGPathSegCurvetoCubicAbs* imp = static_cast<SVGPathSegCurvetoCubicAbs*>(impl());

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

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

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

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

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

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

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

        imp->setX1(value->toFloat(exec));
        break;
    }
    case Y1AttrNum: {
        SVGPathSegCurvetoCubicAbs* imp = static_cast<SVGPathSegCurvetoCubicAbs*>(impl());

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

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

        imp->setY2(value->toFloat(exec));
        break;
    }
    }
    SVGPathSegCurvetoCubicAbs* imp = static_cast<SVGPathSegCurvetoCubicAbs*>(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)
