bool JSCSSRuleListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
    JSCSSRuleList* jsCSSRuleList = static_cast<JSCSSRuleList*>(handle.get().asCell());
    if (!jsCSSRuleList->hasCustomProperties())
        return false;
    if (CSSStyleSheet* styleSheet = jsCSSRuleList->impl()->styleSheet())
        return visitor.containsOpaqueRoot(root(styleSheet));
    if (CSSRule* cssRule = jsCSSRuleList->impl()->item(0))
        return visitor.containsOpaqueRoot(root(cssRule));
    return false;
}
Esempio n. 2
0
JSValue* jsCSSRuleListPrototypeFunctionItem(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
    if (!thisValue->isObject(&JSCSSRuleList::s_info))
        return throwError(exec, TypeError);
    JSCSSRuleList* castedThisObj = static_cast<JSCSSRuleList*>(thisValue);
    CSSRuleList* imp = static_cast<CSSRuleList*>(castedThisObj->impl());
    unsigned index = args.at(exec, 0)->toInt32(exec);


    JSC::JSValue* result = toJS(exec, WTF::getPtr(imp->item(index)));
    return result;
}
JSValue* JSCSSRuleList::indexGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
{
    JSCSSRuleList* thisObj = static_cast<JSCSSRuleList*>(slot.slotBase());
    return toJS(exec, static_cast<CSSRuleList*>(thisObj->impl())->item(slot.index()));
}