Class MarkRemovableRulesetNodes

  • All Implemented Interfaces:
    AtRuleHandler, CssCompilerPass, CssTreeVisitor
    Direct Known Subclasses:
    MarkRemovableRulesetNodesForChunk

    public class MarkRemovableRulesetNodes
    extends SkippingTreeVisitor
    implements CssCompilerPass
    Compiler pass that marks the ruleset nodes that should be removed from the tree.

    This pass assumes that each ruleset node contains exactly one declaration and one selector. This pass should be preceded by SplitRulesetNodes pass. This pass skips over nodes in the body that are not ruleset nodes and ignores all their children including ruleset nodes. So, in particular, all ruleset nodes contained within @media rules will be ignored.

    • Constructor Detail

      • MarkRemovableRulesetNodes

        public MarkRemovableRulesetNodes​(CssTree tree)
        Creates a new pass over the specified tree.
      • MarkRemovableRulesetNodes

        public MarkRemovableRulesetNodes​(CssTree tree,
                                         boolean skipping)
        Creates a new pass over the specified tree.
        Parameters:
        skipping - whether to skip over rulesets containing properties that might make them unsafe to modify (see SkippingTreeVisitor)
    • Method Detail

      • setReferencedRules

        public void setReferencedRules​(java.util.Set<java.lang.String> referencedRules,
                                       java.lang.String prefixOfReferencedRules)
        Sets the reference rules.
        Parameters:
        referencedRules - the set of referenced rules, which, since it is aliased, is expected not to change while this pass is in progress
        prefixOfReferencedRules - the prefix to match when looking for unreferenced rules