JSValue* jsSVGTextContentElementPrototypeFunctionSelectSubString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) { if (!thisValue->isObject(&JSSVGTextContentElement::s_info)) return throwError(exec, TypeError); JSSVGTextContentElement* castedThisObj = static_cast<JSSVGTextContentElement*>(thisValue); SVGTextContentElement* imp = static_cast<SVGTextContentElement*>(castedThisObj->impl()); ExceptionCode ec = 0; unsigned offset = args.at(exec, 0)->toInt32(exec); unsigned length = args.at(exec, 1)->toInt32(exec); imp->selectSubString(offset, length, ec); setDOMException(exec, ec); return jsUndefined(); }
JSValue JSC_HOST_CALL jsSVGTextContentElementPrototypeFunctionSelectSubString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { UNUSED_PARAM(args); if (!thisValue.inherits(&JSSVGTextContentElement::s_info)) return throwError(exec, TypeError); JSSVGTextContentElement* castedThisObj = static_cast<JSSVGTextContentElement*>(asObject(thisValue)); SVGTextContentElement* imp = static_cast<SVGTextContentElement*>(castedThisObj->impl()); ExceptionCode ec = 0; int offset = args.at(0).toInt32(exec); if (offset < 0) { setDOMException(exec, INDEX_SIZE_ERR); return jsUndefined(); } int length = args.at(1).toInt32(exec); if (length < 0) { setDOMException(exec, INDEX_SIZE_ERR); return jsUndefined(); } imp->selectSubString(offset, length, ec); setDOMException(exec, ec); return jsUndefined(); }
JSValue* JSSVGTextContentElementPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args) { if (!thisObj->inherits(&JSSVGTextContentElement::info)) return throwError(exec, TypeError); SVGTextContentElement* imp = static_cast<SVGTextContentElement*>(static_cast<JSSVGTextContentElement*>(thisObj)->impl()); switch (id) { case JSSVGTextContentElement::GetNumberOfCharsFuncNum: { KJS::JSValue* result = jsNumber(imp->getNumberOfChars()); return result; } case JSSVGTextContentElement::GetComputedTextLengthFuncNum: { KJS::JSValue* result = jsNumber(imp->getComputedTextLength()); return result; } case JSSVGTextContentElement::GetSubStringLengthFuncNum: { ExceptionCode ec = 0; bool offsetOk; unsigned offset = args[0]->toInt32(exec, offsetOk); if (!offsetOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } bool lengthOk; unsigned length = args[1]->toInt32(exec, lengthOk); if (!lengthOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } KJS::JSValue* result = jsNumber(imp->getSubStringLength(offset, length, ec)); setDOMException(exec, ec); return result; } case JSSVGTextContentElement::GetStartPositionOfCharFuncNum: { ExceptionCode ec = 0; bool offsetOk; unsigned offset = args[0]->toInt32(exec, offsetOk); if (!offsetOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<FloatPoint>(imp->getStartPositionOfChar(offset, ec))); setDOMException(exec, ec); return result; } case JSSVGTextContentElement::GetEndPositionOfCharFuncNum: { ExceptionCode ec = 0; bool offsetOk; unsigned offset = args[0]->toInt32(exec, offsetOk); if (!offsetOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<FloatPoint>(imp->getEndPositionOfChar(offset, ec))); setDOMException(exec, ec); return result; } case JSSVGTextContentElement::GetExtentOfCharFuncNum: { ExceptionCode ec = 0; bool offsetOk; unsigned offset = args[0]->toInt32(exec, offsetOk); if (!offsetOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<FloatRect>(imp->getExtentOfChar(offset, ec))); setDOMException(exec, ec); return result; } case JSSVGTextContentElement::GetRotationOfCharFuncNum: { ExceptionCode ec = 0; bool offsetOk; unsigned offset = args[0]->toInt32(exec, offsetOk); if (!offsetOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } KJS::JSValue* result = jsNumber(imp->getRotationOfChar(offset, ec)); setDOMException(exec, ec); return result; } case JSSVGTextContentElement::GetCharNumAtPositionFuncNum: { FloatPoint point = toSVGPoint(args[0]); KJS::JSValue* result = jsNumber(imp->getCharNumAtPosition(point)); return result; } case JSSVGTextContentElement::SelectSubStringFuncNum: { ExceptionCode ec = 0; bool offsetOk; unsigned offset = args[0]->toInt32(exec, offsetOk); if (!offsetOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } bool lengthOk; unsigned length = args[1]->toInt32(exec, lengthOk); if (!lengthOk) { setDOMException(exec, TYPE_MISMATCH_ERR); return jsUndefined(); } imp->selectSubString(offset, length, ec); setDOMException(exec, ec); return jsUndefined(); } case JSSVGTextContentElement::HasExtensionFuncNum: { String extension = args[0]->toString(exec); KJS::JSValue* result = jsBoolean(imp->hasExtension(extension)); return result; } } return 0; }