void ElementRuleCollector::appendCSSOMWrapperForRule(StyleRule* rule)
{
    // FIXME: There should be no codepath that creates a CSSOMWrapper without a parent stylesheet or rule because
    // then that codepath can lead to the CSSStyleSheet contents not getting correctly copied when the rule is modified
    // through the wrapper (e.g. rule.selectorText="div"). Right now, the inspector uses the pointers for identity though,
    // so calling CSSStyleSheet->willMutateRules breaks the inspector.
    CSSStyleSheet* sheet = m_includeStyleSheet == IncludeStyleSheetInCSSOMWrapper ? findStyleSheet(m_context.element()->document().styleEngine(), rule) : 0;
    RefPtr<CSSRule> cssRule = rule->createCSSOMWrapper(sheet);
    if (sheet)
        sheet->registerExtraChildRuleCSSOMWrapper(cssRule);
    ensureRuleList()->rules().append(cssRule);
}