/* 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 "SVGElement.h" #include "JSSVGColor.h" #include #include "JSRGBColor.h" #include "SVGColor.h" #include #include using namespace JSC; namespace WebCore { ASSERT_CLASS_FITS_IN_CELL(JSSVGColor) /* Hash table */ static const HashTableValue JSSVGColorTableValues[4] = { { "colorType", DontDelete|ReadOnly, (intptr_t)jsSVGColorColorType, (intptr_t)0 }, { "rgbColor", DontDelete|ReadOnly, (intptr_t)jsSVGColorRgbColor, (intptr_t)0 }, { "constructor", DontEnum|ReadOnly, (intptr_t)jsSVGColorConstructor, (intptr_t)0 }, { 0, 0, 0, 0 } }; static const HashTable JSSVGColorTable = #if ENABLE(PERFECT_HASH_SIZE) { 3, JSSVGColorTableValues, 0 }; #else { 8, 7, JSSVGColorTableValues, 0 }; #endif /* Hash table for constructor */ static const HashTableValue JSSVGColorConstructorTableValues[5] = { { "SVG_COLORTYPE_UNKNOWN", DontDelete|ReadOnly, (intptr_t)jsSVGColorSVG_COLORTYPE_UNKNOWN, (intptr_t)0 }, { "SVG_COLORTYPE_RGBCOLOR", DontDelete|ReadOnly, (intptr_t)jsSVGColorSVG_COLORTYPE_RGBCOLOR, (intptr_t)0 }, { "SVG_COLORTYPE_RGBCOLOR_ICCCOLOR", DontDelete|ReadOnly, (intptr_t)jsSVGColorSVG_COLORTYPE_RGBCOLOR_ICCCOLOR, (intptr_t)0 }, { "SVG_COLORTYPE_CURRENTCOLOR", DontDelete|ReadOnly, (intptr_t)jsSVGColorSVG_COLORTYPE_CURRENTCOLOR, (intptr_t)0 }, { 0, 0, 0, 0 } }; static const HashTable JSSVGColorConstructorTable = #if ENABLE(PERFECT_HASH_SIZE) { 3, JSSVGColorConstructorTableValues, 0 }; #else { 8, 7, JSSVGColorConstructorTableValues, 0 }; #endif class JSSVGColorConstructor : public DOMObject { public: JSSVGColorConstructor(ExecState* exec) : DOMObject(JSSVGColorConstructor::createStructure(exec->lexicalGlobalObject()->objectPrototype())) { putDirect(exec->propertyNames().prototype, JSSVGColorPrototype::self(exec), None); } virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); virtual const ClassInfo* classInfo() const { return &s_info; } static const ClassInfo s_info; static PassRefPtr createStructure(JSValuePtr proto) { return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance)); } }; const ClassInfo JSSVGColorConstructor::s_info = { "SVGColorConstructor", 0, &JSSVGColorConstructorTable, 0 }; bool JSSVGColorConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { return getStaticValueSlot(exec, &JSSVGColorConstructorTable, this, propertyName, slot); } /* Hash table for prototype */ static const HashTableValue JSSVGColorPrototypeTableValues[8] = { { "SVG_COLORTYPE_UNKNOWN", DontDelete|ReadOnly, (intptr_t)jsSVGColorSVG_COLORTYPE_UNKNOWN, (intptr_t)0 }, { "SVG_COLORTYPE_RGBCOLOR", DontDelete|ReadOnly, (intptr_t)jsSVGColorSVG_COLORTYPE_RGBCOLOR, (intptr_t)0 }, { "SVG_COLORTYPE_RGBCOLOR_ICCCOLOR", DontDelete|ReadOnly, (intptr_t)jsSVGColorSVG_COLORTYPE_RGBCOLOR_ICCCOLOR, (intptr_t)0 }, { "SVG_COLORTYPE_CURRENTCOLOR", DontDelete|ReadOnly, (intptr_t)jsSVGColorSVG_COLORTYPE_CURRENTCOLOR, (intptr_t)0 }, { "setRGBColor", DontDelete|Function, (intptr_t)jsSVGColorPrototypeFunctionSetRGBColor, (intptr_t)1 }, { "setRGBColorICCColor", DontDelete|Function, (intptr_t)jsSVGColorPrototypeFunctionSetRGBColorICCColor, (intptr_t)2 }, { "setColor", DontDelete|Function, (intptr_t)jsSVGColorPrototypeFunctionSetColor, (intptr_t)3 }, { 0, 0, 0, 0 } }; static const HashTable JSSVGColorPrototypeTable = #if ENABLE(PERFECT_HASH_SIZE) { 255, JSSVGColorPrototypeTableValues, 0 }; #else { 17, 15, JSSVGColorPrototypeTableValues, 0 }; #endif const ClassInfo JSSVGColorPrototype::s_info = { "SVGColorPrototype", 0, &JSSVGColorPrototypeTable, 0 }; JSObject* JSSVGColorPrototype::self(ExecState* exec) { return getDOMPrototype(exec); } bool JSSVGColorPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { return getStaticPropertySlot(exec, &JSSVGColorPrototypeTable, this, propertyName, slot); } const ClassInfo JSSVGColor::s_info = { "SVGColor", &JSCSSValue::s_info, &JSSVGColorTable, 0 }; JSSVGColor::JSSVGColor(PassRefPtr structure, PassRefPtr impl) : JSCSSValue(structure, impl) { } JSObject* JSSVGColor::createPrototype(ExecState* exec) { return new (exec) JSSVGColorPrototype(JSSVGColorPrototype::createStructure(JSCSSValuePrototype::self(exec))); } bool JSSVGColor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { return getStaticValueSlot(exec, &JSSVGColorTable, this, propertyName, slot); } JSValuePtr jsSVGColorColorType(ExecState* exec, const Identifier&, const PropertySlot& slot) { SVGColor* imp = static_cast(static_cast(asObject(slot.slotBase()))->impl()); return jsNumber(exec, imp->colorType()); } JSValuePtr jsSVGColorRgbColor(ExecState* exec, const Identifier&, const PropertySlot& slot) { SVGColor* imp = static_cast(static_cast(asObject(slot.slotBase()))->impl()); return getJSRGBColor(exec, imp->rgbColor()); } JSValuePtr jsSVGColorConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot) { return static_cast(asObject(slot.slotBase()))->getConstructor(exec); } JSValuePtr JSSVGColor::getConstructor(ExecState* exec) { return getDOMConstructor(exec); } JSValuePtr jsSVGColorPrototypeFunctionSetRGBColor(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args) { if (!thisValue->isObject(&JSSVGColor::s_info)) return throwError(exec, TypeError); JSSVGColor* castedThisObj = static_cast(asObject(thisValue)); SVGColor* imp = static_cast(castedThisObj->impl()); ExceptionCode ec = 0; const UString& rgbColor = args.at(exec, 0)->toString(exec); imp->setRGBColor(rgbColor, ec); setDOMException(exec, ec); return jsUndefined(); } JSValuePtr jsSVGColorPrototypeFunctionSetRGBColorICCColor(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args) { if (!thisValue->isObject(&JSSVGColor::s_info)) return throwError(exec, TypeError); JSSVGColor* castedThisObj = static_cast(asObject(thisValue)); SVGColor* imp = static_cast(castedThisObj->impl()); ExceptionCode ec = 0; const UString& rgbColor = args.at(exec, 0)->toString(exec); const UString& iccColor = args.at(exec, 1)->toString(exec); imp->setRGBColorICCColor(rgbColor, iccColor, ec); setDOMException(exec, ec); return jsUndefined(); } JSValuePtr jsSVGColorPrototypeFunctionSetColor(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args) { if (!thisValue->isObject(&JSSVGColor::s_info)) return throwError(exec, TypeError); JSSVGColor* castedThisObj = static_cast(asObject(thisValue)); SVGColor* imp = static_cast(castedThisObj->impl()); ExceptionCode ec = 0; unsigned short colorType = args.at(exec, 0)->toInt32(exec); const UString& rgbColor = args.at(exec, 1)->toString(exec); const UString& iccColor = args.at(exec, 2)->toString(exec); imp->setColor(colorType, rgbColor, iccColor, ec); setDOMException(exec, ec); return jsUndefined(); } // Constant getters JSValuePtr jsSVGColorSVG_COLORTYPE_UNKNOWN(ExecState* exec, const Identifier&, const PropertySlot&) { return jsNumber(exec, static_cast(0)); } JSValuePtr jsSVGColorSVG_COLORTYPE_RGBCOLOR(ExecState* exec, const Identifier&, const PropertySlot&) { return jsNumber(exec, static_cast(1)); } JSValuePtr jsSVGColorSVG_COLORTYPE_RGBCOLOR_ICCCOLOR(ExecState* exec, const Identifier&, const PropertySlot&) { return jsNumber(exec, static_cast(2)); } JSValuePtr jsSVGColorSVG_COLORTYPE_CURRENTCOLOR(ExecState* exec, const Identifier&, const PropertySlot&) { return jsNumber(exec, static_cast(3)); } } #endif // ENABLE(SVG)