webengine/osswebengine/DerivedSources/WebCore/JSSVGPathSegLinetoRel.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 17 Dec 2009 09:20:16 +0200
changeset 25 0ed94ceaa377
parent 0 dd21522fd290
permissions -rw-r--r--
Revision: 200948 Kit: 200951

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

#include <wtf/GetPtr.h>

#include "SVGPathSegLineto.h"

using namespace KJS;

namespace WebCore {

/* Hash table */

static const HashEntry JSSVGPathSegLinetoRelTableEntries[] =
{
    { "y", JSSVGPathSegLinetoRel::YAttrNum, DontDelete, 0, 0 },
    { "x", JSSVGPathSegLinetoRel::XAttrNum, DontDelete, 0, 0 }
};

static const HashTable JSSVGPathSegLinetoRelTable = 
{
    2, 2, JSSVGPathSegLinetoRelTableEntries, 2
};

/* Hash table for prototype */

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

static const HashTable JSSVGPathSegLinetoRelPrototypeTable = 
{
    2, 1, JSSVGPathSegLinetoRelPrototypeTableEntries, 1
};

const ClassInfo JSSVGPathSegLinetoRelPrototype::info = { "SVGPathSegLinetoRelPrototype", 0, &JSSVGPathSegLinetoRelPrototypeTable, 0 };

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

const ClassInfo JSSVGPathSegLinetoRel::info = { "SVGPathSegLinetoRel", &JSSVGPathSeg::info, &JSSVGPathSegLinetoRelTable, 0 };

JSSVGPathSegLinetoRel::JSSVGPathSegLinetoRel(ExecState* exec, SVGPathSegLinetoRel* impl)
    : JSSVGPathSeg(exec, impl)
{
    setPrototype(JSSVGPathSegLinetoRelPrototype::self(exec));
}

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

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

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

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

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

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

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

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