Пример #1
0
EncodedJSValue JSC_HOST_CALL jsSVGNumberListPrototypeFunctionReplaceItem(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSSVGNumberList::s_info))
        return throwVMTypeError(exec);
    JSSVGNumberList* castedThis = static_cast<JSSVGNumberList*>(asObject(thisValue));
    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSVGNumberList::s_info);
    SVGListPropertyTearOff<SVGNumberList> * imp = static_cast<SVGListPropertyTearOff<SVGNumberList> *>(castedThis->impl());
    if (exec->argumentCount() < 2)
        return throwVMError(exec, createSyntaxError(exec, "Not enough arguments"));
    ExceptionCode ec = 0;
    if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(&JSSVGNumber::s_info))
        return throwVMTypeError(exec);
    SVGPropertyTearOff<float>* item(toSVGNumber(exec->argument(0)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    unsigned index(exec->argument(1).toUInt32(exec));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());


    JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->replaceItem(item, index, ec)));
    setDOMException(exec, ec);
    return JSValue::encode(result);
}
InterpolationValue SVGNumberInterpolationType::maybeConvertSVGValue(
    const SVGPropertyBase& svgValue) const {
  if (svgValue.type() != AnimatedNumber)
    return nullptr;
  return InterpolationValue(
      InterpolableNumber::create(toSVGNumber(svgValue).value()));
}