CSSRuleList* CSSStyleSheet::cssRules() { if (!canAccessRules()) return nullptr; if (!m_ruleListCSSOMWrapper) m_ruleListCSSOMWrapper = StyleSheetCSSRuleList::create(this); return m_ruleListCSSOMWrapper.get(); }
RefPtr<CSSRuleList> CSSStyleSheet::cssRules() { if (!canAccessRules()) return nullptr; if (!m_ruleListCSSOMWrapper) m_ruleListCSSOMWrapper = std::make_unique<StyleSheetCSSRuleList>(this); return m_ruleListCSSOMWrapper.get(); }
PassRefPtr<CSSRuleList> CSSStyleSheet::cssRules() { if (!canAccessRules()) return 0; if (!m_ruleListCSSOMWrapper) m_ruleListCSSOMWrapper = adoptPtr(new StyleSheetCSSRuleList(this)); return m_ruleListCSSOMWrapper.get(); }
RefPtr<CSSRuleList> CSSStyleSheet::rules() { if (!canAccessRules()) return nullptr; // IE behavior. RefPtr<StaticCSSRuleList> ruleList = StaticCSSRuleList::create(); unsigned ruleCount = length(); for (unsigned i = 0; i < ruleCount; ++i) ruleList->rules().append(item(i)); return ruleList; }
RefPtr<CSSRuleList> CSSStyleSheet::rules() { if (!canAccessRules()) return nullptr; // IE behavior. RefPtr<StaticCSSRuleList> nonCharsetRules = StaticCSSRuleList::create(); unsigned ruleCount = length(); for (unsigned i = 0; i < ruleCount; ++i) { CSSRule* rule = item(i); if (rule->type() == CSSRule::CHARSET_RULE) continue; nonCharsetRules->rules().append(rule); } return nonCharsetRules; }