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

#include <wtf/GetPtr.h>

#include "JSSVGPreserveAspectRatio.h"
#include "SVGPreserveAspectRatio.h"

using namespace KJS;

namespace WebCore {

/* Hash table */

static const HashEntry JSSVGAnimatedPreserveAspectRatioTableEntries[] =
{
    { "baseVal", JSSVGAnimatedPreserveAspectRatio::BaseValAttrNum, DontDelete|ReadOnly, 0, 0 },
    { "animVal", JSSVGAnimatedPreserveAspectRatio::AnimValAttrNum, DontDelete|ReadOnly, 0, 0 }
};

static const HashTable JSSVGAnimatedPreserveAspectRatioTable = 
{
    2, 2, JSSVGAnimatedPreserveAspectRatioTableEntries, 2
};

/* Hash table for prototype */

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

static const HashTable JSSVGAnimatedPreserveAspectRatioPrototypeTable = 
{
    2, 1, JSSVGAnimatedPreserveAspectRatioPrototypeTableEntries, 1
};

const ClassInfo JSSVGAnimatedPreserveAspectRatioPrototype::info = { "SVGAnimatedPreserveAspectRatioPrototype", 0, &JSSVGAnimatedPreserveAspectRatioPrototypeTable, 0 };

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

const ClassInfo JSSVGAnimatedPreserveAspectRatio::info = { "SVGAnimatedPreserveAspectRatio", 0, &JSSVGAnimatedPreserveAspectRatioTable, 0 };

JSSVGAnimatedPreserveAspectRatio::JSSVGAnimatedPreserveAspectRatio(ExecState* exec, SVGAnimatedPreserveAspectRatio* impl)
    : m_impl(impl)
{
    setPrototype(JSSVGAnimatedPreserveAspectRatioPrototype::self(exec));
}

JSSVGAnimatedPreserveAspectRatio::~JSSVGAnimatedPreserveAspectRatio()
{
    SVGDocumentExtensions::forgetGenericContext<SVGAnimatedPreserveAspectRatio>(m_impl.get());
    ScriptInterpreter::forgetDOMObject(m_impl.get());
}

bool JSSVGAnimatedPreserveAspectRatio::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSSVGAnimatedPreserveAspectRatio, KJS::DOMObject>(exec, &JSSVGAnimatedPreserveAspectRatioTable, this, propertyName, slot);
}

JSValue* JSSVGAnimatedPreserveAspectRatio::getValueProperty(ExecState* exec, int token) const
{
    switch (token) {
    case BaseValAttrNum: {
        SVGAnimatedPreserveAspectRatio* imp = static_cast<SVGAnimatedPreserveAspectRatio*>(impl());

        return toJS(exec, WTF::getPtr(imp->baseVal()));
    }
    case AnimValAttrNum: {
        SVGAnimatedPreserveAspectRatio* imp = static_cast<SVGAnimatedPreserveAspectRatio*>(impl());

        return toJS(exec, WTF::getPtr(imp->animVal()));
    }
    }
    return 0;
}

KJS::JSValue* toJS(KJS::ExecState* exec, SVGAnimatedPreserveAspectRatio* obj)
{
    return KJS::cacheDOMObject<SVGAnimatedPreserveAspectRatio, JSSVGAnimatedPreserveAspectRatio>(exec, obj);
}
SVGAnimatedPreserveAspectRatio* toSVGAnimatedPreserveAspectRatio(KJS::JSValue* val)
{
    return val->isObject(&JSSVGAnimatedPreserveAspectRatio::info) ? static_cast<JSSVGAnimatedPreserveAspectRatio*>(val)->impl() : 0;
}

}

#endif // ENABLE(SVG)
