Class UnsafeMergeRulesetNodes

  • All Implemented Interfaces:
    CssCompilerPass

    public class UnsafeMergeRulesetNodes
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      UnsafeMergeRulesetNodes​(CssTree tree, boolean byPartition, boolean skipping)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void runPass()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • 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