/*
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"
#include "JSCanvasGradient.h"
#include <wtf/GetPtr.h>
#include "CanvasGradient.h"
#include "PlatformString.h"
using namespace KJS;
namespace WebCore {
/* Hash table for prototype */
static const HashEntry JSCanvasGradientPrototypeTableEntries[] =
{
{ "addColorStop", JSCanvasGradient::AddColorStopFuncNum, DontDelete|Function, 2, 0 }
};
static const HashTable JSCanvasGradientPrototypeTable =
{
2, 1, JSCanvasGradientPrototypeTableEntries, 1
};
const ClassInfo JSCanvasGradientPrototype::info = { "CanvasGradientPrototype", 0, &JSCanvasGradientPrototypeTable, 0 };
JSObject* JSCanvasGradientPrototype::self(ExecState* exec)
{
return KJS::cacheGlobalObject<JSCanvasGradientPrototype>(exec, "[[JSCanvasGradient.prototype]]");
}
bool JSCanvasGradientPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
return getStaticFunctionSlot<JSCanvasGradientPrototypeFunction, JSObject>(exec, &JSCanvasGradientPrototypeTable, this, propertyName, slot);
}
const ClassInfo JSCanvasGradient::info = { "CanvasGradient", 0, 0, 0 };
JSCanvasGradient::JSCanvasGradient(ExecState* exec, CanvasGradient* impl)
: m_impl(impl)
{
setPrototype(JSCanvasGradientPrototype::self(exec));
}
JSCanvasGradient::~JSCanvasGradient()
{
ScriptInterpreter::forgetDOMObject(m_impl.get());
}
JSValue* JSCanvasGradientPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
{
if (!thisObj->inherits(&JSCanvasGradient::info))
return throwError(exec, TypeError);
CanvasGradient* imp = static_cast<CanvasGradient*>(static_cast<JSCanvasGradient*>(thisObj)->impl());
switch (id) {
case JSCanvasGradient::AddColorStopFuncNum: {
float offset = args[0]->toFloat(exec);
String color = args[1]->toString(exec);
imp->addColorStop(offset, color);
return jsUndefined();
}
}
return 0;
}
KJS::JSValue* toJS(KJS::ExecState* exec, CanvasGradient* obj)
{
return KJS::cacheDOMObject<CanvasGradient, JSCanvasGradient>(exec, obj);
}
CanvasGradient* toCanvasGradient(KJS::JSValue* val)
{
return val->isObject(&JSCanvasGradient::info) ? static_cast<JSCanvasGradient*>(val)->impl() : 0;
}
}