pub trait CssRulesHelpers {
    // Required method
    fn insert_rule(
        &self,
        lock: &SharedRwLock,
        rule: &str,
        parent_stylesheet_contents: &StylesheetContents,
        index: usize,
        nested: CssRuleTypes,
        loader: Option<&dyn StylesheetLoader>,
        allow_import_rules: AllowImportRules
    ) -> Result<CssRule, RulesMutateError>;
}
Expand description

A trait to implement helpers for Arc<Locked<CssRules>>.

Required Methods§

source

fn insert_rule( &self, lock: &SharedRwLock, rule: &str, parent_stylesheet_contents: &StylesheetContents, index: usize, nested: CssRuleTypes, loader: Option<&dyn StylesheetLoader>, allow_import_rules: AllowImportRules ) -> Result<CssRule, RulesMutateError>

https://drafts.csswg.org/cssom/#insert-a-css-rule

Written in this funky way because parsing an @import rule may cause us to clone a stylesheet from the same document due to caching in the CSS loader.

TODO(emilio): We could also pass the write guard down into the loader instead, but that seems overkill.

Implementors§