static v8::Handle<v8::Value> rulesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    CSSStyleSheet* imp = V8CSSStyleSheet::toNative(info.Holder());
    RefPtr<CSSRuleList> result = imp->rules();
    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(), "rules", wrapper);
    }
    return wrapper;
}
Пример #2
0
static v8::Handle<v8::Value> rulesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.CSSStyleSheet.rules._get");
    CSSStyleSheet* imp = V8CSSStyleSheet::toNative(info.Holder());
    RefPtr<CSSRuleList> result = imp->rules();
    v8::Handle<v8::Value> wrapper = result.get() ? getDOMObjectMap().get(result.get()) : v8::Handle<v8::Value>();
    if (wrapper.IsEmpty()) {
        wrapper = toV8(result.get());
        if (!wrapper.IsEmpty())
            V8DOMWrapper::setNamedHiddenReference(info.Holder(), "rules", wrapper);
    }
    return wrapper;
}
Пример #3
0
JSValue* JSCSSStyleSheet::getValueProperty(ExecState* exec, int token) const
{
    switch (token) {
    case OwnerRuleAttrNum: {
        CSSStyleSheet* imp = static_cast<CSSStyleSheet*>(impl());
        return toJS(exec, WTF::getPtr(imp->ownerRule()));
    }
    case CssRulesAttrNum: {
        CSSStyleSheet* imp = static_cast<CSSStyleSheet*>(impl());
        return toJS(exec, WTF::getPtr(imp->cssRules()));
    }
    case RulesAttrNum: {
        CSSStyleSheet* imp = static_cast<CSSStyleSheet*>(impl());
        return toJS(exec, WTF::getPtr(imp->rules()));
    }
    }
    return 0;
}