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 Details

    • 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 Details

    • setReferencedRules

      public void setReferencedRules(Set<String> referencedRules, 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
    • enterBlock

      public boolean enterBlock(CssBlockNode block)
      Description copied from interface: CssTreeVisitor
      Called before visiting a CssBlockNode's sub trees
      Specified by:
      enterBlock in interface CssTreeVisitor
      Overrides:
      enterBlock in class DefaultTreeVisitor
    • runPass

      public void runPass()
      Specified by:
      runPass in interface CssCompilerPass