Class UnsafeMergeRulesetNodes

java.lang.Object
com.google.common.css.compiler.passes.UnsafeMergeRulesetNodes
All Implemented Interfaces:
CssCompilerPass

public class UnsafeMergeRulesetNodes extends Object implements CssCompilerPass
Compiler pass that merges rulesets aggressively. The ordering of the rulesets ensures that shorthand properties appear before their detailed properties, and that the ordering of conflicting shorthand properties is preserved. It assumes all other ordering is irrelevant. When the MarkRemovableRulesetNodes pass is run before this pass, the assumptions of this pass will be valid if no DOM element matches two or more selectors of the same specificity with conflicting declarations. For example, selectors .FOO and .BAR might conflict if these classes co-occur on a DOM element. As another example, .FOO span and .BAR span might conflict say if a span DOM element has a parent with a FOO class and a grandparent with a BAR class.
  • Constructor Details

    • UnsafeMergeRulesetNodes

      public UnsafeMergeRulesetNodes(CssTree tree, boolean byPartition, boolean skipping)
      Constructor.

      This pass runs in two modes, depending on the value of byPartition. If byPartition is true, all declarations on a selector are first grouped by their partition (as defined by CssPropertyNode.getPartition()). Then, selectors which have the same declarations for a partition are grouped together into a ruleset. If byPartition is false (recommended), partitioning is only performed on order-dependent partitions (as defined by ORDER_DEPENDENT_PARTITIONS.

      Parameters:
      tree - the tree to run the pass on
      byPartition - whether to group all declarations by partition (and not just the ones such as border where order matters)
      skipping - whether to skip certain properties as defined by SkippingTreeVisitor
  • Method Details