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

#include <wtf/GetPtr.h>

#include "SVGPathSegCurvetoQuadratic.h"

using namespace KJS;

namespace WebCore {

/* Hash table */

static const HashEntry JSSVGPathSegCurvetoQuadraticRelTableEntries[] =
{
    { "y", JSSVGPathSegCurvetoQuadraticRel::YAttrNum, DontDelete, 0, 0 },
    { "x", JSSVGPathSegCurvetoQuadraticRel::XAttrNum, DontDelete, 0, 0 },
    { "x1", JSSVGPathSegCurvetoQuadraticRel::X1AttrNum, DontDelete, 0, 0 },
    { "y1", JSSVGPathSegCurvetoQuadraticRel::Y1AttrNum, DontDelete, 0, 0 }
};

static const HashTable JSSVGPathSegCurvetoQuadraticRelTable = 
{
    2, 4, JSSVGPathSegCurvetoQuadraticRelTableEntries, 4
};

/* Hash table for prototype */

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

static const HashTable JSSVGPathSegCurvetoQuadraticRelPrototypeTable = 
{
    2, 1, JSSVGPathSegCurvetoQuadraticRelPrototypeTableEntries, 1
};

const ClassInfo JSSVGPathSegCurvetoQuadraticRelPrototype::info = { "SVGPathSegCurvetoQuadraticRelPrototype", 0, &JSSVGPathSegCurvetoQuadraticRelPrototypeTable, 0 };

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

const ClassInfo JSSVGPathSegCurvetoQuadraticRel::info = { "SVGPathSegCurvetoQuadraticRel", &JSSVGPathSeg::info, &JSSVGPathSegCurvetoQuadraticRelTable, 0 };

JSSVGPathSegCurvetoQuadraticRel::JSSVGPathSegCurvetoQuadraticRel(ExecState* exec, SVGPathSegCurvetoQuadraticRel* impl)
    : JSSVGPathSeg(exec, impl)
{
    setPrototype(JSSVGPathSegCurvetoQuadraticRelPrototype::self(exec));
}

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

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

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

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

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

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

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

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

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

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

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

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