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

#include <wtf/GetPtr.h>

#include "SVGPathSegCurvetoCubic.h"

using namespace KJS;

namespace WebCore {

/* Hash table */

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

static const HashTable JSSVGPathSegCurvetoCubicRelTable = 
{
    2, 7, JSSVGPathSegCurvetoCubicRelTableEntries, 6
};

/* Hash table for prototype */

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

static const HashTable JSSVGPathSegCurvetoCubicRelPrototypeTable = 
{
    2, 1, JSSVGPathSegCurvetoCubicRelPrototypeTableEntries, 1
};

const ClassInfo JSSVGPathSegCurvetoCubicRelPrototype::info = { "SVGPathSegCurvetoCubicRelPrototype", 0, &JSSVGPathSegCurvetoCubicRelPrototypeTable, 0 };

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

const ClassInfo JSSVGPathSegCurvetoCubicRel::info = { "SVGPathSegCurvetoCubicRel", &JSSVGPathSeg::info, &JSSVGPathSegCurvetoCubicRelTable, 0 };

JSSVGPathSegCurvetoCubicRel::JSSVGPathSegCurvetoCubicRel(ExecState* exec, SVGPathSegCurvetoCubicRel* impl)
    : JSSVGPathSeg(exec, impl)
{
    setPrototype(JSSVGPathSegCurvetoCubicRelPrototype::self(exec));
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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