예제 #1
0
JSValue JSC_HOST_CALL jsSVGPaintPrototypeFunctionSetPaint(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.inherits(&JSSVGPaint::s_info))
        return throwError(exec, TypeError);
    JSSVGPaint* castedThisObj = static_cast<JSSVGPaint*>(asObject(thisValue));
    SVGPaint* imp = static_cast<SVGPaint*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    SVGPaint::SVGPaintType paintType = static_cast<SVGPaint::SVGPaintType>(args.at(0).toInt32(exec));
    const UString& uri = args.at(1).toString(exec);
    const UString& rgbColor = args.at(2).toString(exec);
    const UString& iccColor = args.at(3).toString(exec);

    imp->setPaint(paintType, uri, rgbColor, iccColor, ec);
    setDOMException(exec, ec);
    return jsUndefined();
}
예제 #2
0
static v8::Handle<v8::Value> setPaintCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.SVGPaint.setPaint");
    if (args.Length() < 4)
        return throwError("Not enough arguments", V8Proxy::TypeError);
    SVGPaint* imp = V8SVGPaint::toNative(args.Holder());
    ExceptionCode ec = 0;
    {
    EXCEPTION_BLOCK(int, paintType, toUInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)));
    STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, uri, MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined));
    STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, rgbColor, MAYBE_MISSING_PARAMETER(args, 2, MissingIsUndefined));
    STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, iccColor, MAYBE_MISSING_PARAMETER(args, 3, MissingIsUndefined));
    imp->setPaint(paintType, uri, rgbColor, iccColor, ec);
    if (UNLIKELY(ec))
        goto fail;
    return v8::Handle<v8::Value>();
    }
    fail:
    V8Proxy::setDOMException(ec);
    return v8::Handle<v8::Value>();
}