コード例 #1
0
EncodedJSValue JSC_HOST_CALL jsSVGColorPrototypeFunctionSetColor(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSSVGColor::s_info))
        return throwVMTypeError(exec);
    JSSVGColor* castedThis = static_cast<JSSVGColor*>(asObject(thisValue));
    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSVGColor::s_info);
    SVGColor* imp = static_cast<SVGColor*>(castedThis->impl());
    if (exec->argumentCount() < 3)
        return throwVMError(exec, createSyntaxError(exec, "Not enough arguments"));
    ExceptionCode ec = 0;
    unsigned short colorType(exec->argument(0).toUInt32(exec));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    const String& rgbColor(ustringToString(exec->argument(1).toString(exec)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    const String& iccColor(ustringToString(exec->argument(2).toString(exec)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());

    imp->setColor(colorType, rgbColor, iccColor, ec);
    setDOMException(exec, ec);
    return JSValue::encode(jsUndefined());
}
コード例 #2
0
static v8::Handle<v8::Value> setColorCallback(const v8::Arguments& args)
{
    if (args.Length() < 3)
        return throwNotEnoughArgumentsError(args.GetIsolate());
    SVGColor* imp = V8SVGColor::toNative(args.Holder());
    ExceptionCode ec = 0;
    {
    V8TRYCATCH(int, colorType, toUInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
    V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, rgbColor, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
    V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, iccColor, MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined));
    imp->setColor(colorType, rgbColor, iccColor, ec);
    if (UNLIKELY(ec))
        goto fail;
    return v8Undefined();
    }
    fail:
    return setDOMException(ec, args.GetIsolate());
}
コード例 #3
0
ファイル: JSSVGColor.cpp プロジェクト: FilipBE/qtextended
JSValue* JSSVGColorPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
{
    if (!thisObj->inherits(&JSSVGColor::info))
      return throwError(exec, TypeError);

    SVGColor* imp = static_cast<SVGColor*>(static_cast<JSSVGColor*>(thisObj)->impl());

    switch (id) {
    case JSSVGColor::SetRGBColorFuncNum: {
        ExceptionCode ec = 0;
        String rgbColor = args[0]->toString(exec);

        imp->setRGBColor(rgbColor, ec);
        setDOMException(exec, ec);
        return jsUndefined();
    }
    case JSSVGColor::SetRGBColorICCColorFuncNum: {
        ExceptionCode ec = 0;
        String rgbColor = args[0]->toString(exec);
        String iccColor = args[1]->toString(exec);

        imp->setRGBColorICCColor(rgbColor, iccColor, ec);
        setDOMException(exec, ec);
        return jsUndefined();
    }
    case JSSVGColor::SetColorFuncNum: {
        ExceptionCode ec = 0;
        unsigned short colorType = args[0]->toInt32(exec);
        String rgbColor = args[1]->toString(exec);
        String iccColor = args[2]->toString(exec);

        imp->setColor(colorType, rgbColor, iccColor, ec);
        setDOMException(exec, ec);
        return jsUndefined();
    }
    }
    return 0;
}