diff -r 000000000000 -r dd21522fd290 webengine/osswebengine/DerivedSources/WebCore/JSCanvasGradient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webengine/osswebengine/DerivedSources/WebCore/JSCanvasGradient.cpp Mon Mar 30 12:54:55 2009 +0300 @@ -0,0 +1,98 @@ +/* + 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 + +#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(exec, "[[JSCanvasGradient.prototype]]"); +} + +bool JSCanvasGradientPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticFunctionSlot(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(static_cast(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(exec, obj); +} +CanvasGradient* toCanvasGradient(KJS::JSValue* val) +{ + return val->isObject(&JSCanvasGradient::info) ? static_cast(val)->impl() : 0; +} + +}