JSValue jsSVGColorRgbColor(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSSVGColor* castedThis = static_cast<JSSVGColor*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    SVGColor* imp = static_cast<SVGColor*>(castedThis->impl());
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->rgbColor()));
    return result;
}
static v8::Handle<v8::Value> rgbColorAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    SVGColor* imp = V8SVGColor::toNative(info.Holder());
    RefPtr<RGBColor> result = imp->rgbColor();
    v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapper(result.get(), info.GetIsolate())) : v8Undefined();
    if (wrapper.IsEmpty()) {
        wrapper = toV8(result.get(), info.Holder(), info.GetIsolate());
        if (!wrapper.IsEmpty())
            V8DOMWrapper::setNamedHiddenReference(info.Holder(), "rgbColor", wrapper);
    }
    return wrapper;
}
Beispiel #3
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;
}