JSValue* JSSVGLengthPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args) { if (!thisObj->inherits(&JSSVGLength::info)) return throwError(exec, TypeError); JSSVGLength* castedThisObj = static_cast<JSSVGLength*>(thisObj); JSSVGPODTypeWrapper<SVGLength>* wrapper = castedThisObj->impl(); SVGLength imp(*wrapper); switch (id) { case JSSVGLength::NewValueSpecifiedUnitsFuncNum: { unsigned short unitType = args[0]->toInt32(exec); float valueInSpecifiedUnits = args[1]->toFloat(exec); imp.newValueSpecifiedUnits(unitType, valueInSpecifiedUnits); wrapper->commitChange(exec, imp); if (castedThisObj->context()) castedThisObj->context()->notifyAttributeChange(); return jsUndefined(); } case JSSVGLength::ConvertToSpecifiedUnitsFuncNum: { unsigned short unitType = args[0]->toInt32(exec); imp.convertToSpecifiedUnits(unitType); wrapper->commitChange(exec, imp); if (castedThisObj->context()) castedThisObj->context()->notifyAttributeChange(); return jsUndefined(); } } return 0; }
JSValue* JSSVGLength::convertToSpecifiedUnits(ExecState* exec, const ArgList& args) { JSSVGPODTypeWrapper<SVGLength>* wrapper = impl(); SVGLength imp(*wrapper); imp.convertToSpecifiedUnits(args.at(exec, 0)->toInt32(exec), context()); wrapper->commitChange(imp, context()); return jsUndefined(); }