Exemplo n.º 1
0
JSValue* jsCSSPrimitiveValuePrototypeFunctionGetRGBColorValue(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
    if (!thisValue->isObject(&JSCSSPrimitiveValue::s_info))
        return throwError(exec, TypeError);
    JSCSSPrimitiveValue* castedThisObj = static_cast<JSCSSPrimitiveValue*>(thisValue);
    CSSPrimitiveValue* imp = static_cast<CSSPrimitiveValue*>(castedThisObj->impl());
    ExceptionCode ec = 0;


    KJS::JSValue* result = getJSRGBColor(exec, imp->getRGBColorValue(ec));
    setDOMException(exec, ec);
    return result;
}
Exemplo n.º 2
0
JSValue* JSSVGColor::getValueProperty(ExecState* exec, int token) const
{
    switch (token) {
    case ColorTypeAttrNum: {
        SVGColor* imp = static_cast<SVGColor*>(impl());

        return jsNumber(imp->colorType());
    }
    case RgbColorAttrNum: {
        SVGColor* imp = static_cast<SVGColor*>(impl());

        return getJSRGBColor(exec, imp->rgbColor());
    }
    case ConstructorAttrNum:
        return getConstructor(exec);
    }
    return 0;
}