static v8::Handle<v8::Value> cssRulesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    CSSStyleSheet* imp = V8CSSStyleSheet::toNative(info.Holder());
    RefPtr<CSSRuleList> result = imp->cssRules();
    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(), "cssRules", wrapper);
    }
    return wrapper;
}
Beispiel #2
0
static v8::Handle<v8::Value> cssRulesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.CSSStyleSheet.cssRules._get");
    CSSStyleSheet* imp = V8CSSStyleSheet::toNative(info.Holder());
    RefPtr<CSSRuleList> result = imp->cssRules();
    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(), "cssRules", wrapper);
    }
    return wrapper;
}
Beispiel #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;
}
void CSSStyleSheet::addSubresourceStyleURLs(ListHashSet<KURL>& urls)
{
    Deque<CSSStyleSheet*> styleSheetQueue;
    styleSheetQueue.append(this);

    while (!styleSheetQueue.isEmpty()) {
        CSSStyleSheet* styleSheet = styleSheetQueue.first();
        styleSheetQueue.removeFirst();

        RefPtr<CSSRuleList> ruleList = styleSheet->cssRules();

        for (unsigned i = 0; i < ruleList->length(); ++i) {
            CSSRule* rule = ruleList->item(i);
            if (rule->isImportRule()) {
                if (CSSStyleSheet* ruleStyleSheet = static_cast<CSSImportRule*>(rule)->styleSheet())
                    styleSheetQueue.append(ruleStyleSheet);
            }
            rule->addSubresourceStyleURLs(urls);
        }
    }
}