Class RemoveVendorSpecificProperties
- java.lang.Object
-
- com.google.common.css.compiler.ast.DefaultTreeVisitor
-
- com.google.common.css.compiler.passes.RemoveVendorSpecificProperties
-
- All Implemented Interfaces:
AtRuleHandler,CssCompilerPass,CssTreeVisitor
public class RemoveVendorSpecificProperties extends DefaultTreeVisitor implements CssCompilerPass
ACssCompilerPassthat removes all vendor-specific properties, except for oneVendorthat is specified in the constructor. This is designed to facilitate creating a vendor-specific stylesheet. For example, suppose you have the following CSS:.button { border-radius: 2px; -moz-border-radius: 2px; -webkit-border-radius: 2px; }If
Vendor.WEBKITwere specified as the "vendor to keep" when running this pass, then the resulting CSS would be:.button { border-radius: 2px; -webkit-border-radius: 2px; }border-radiuswould not be removed because it is not a vendor-specific property, and-webkit-border-radiuswould not be removed becauseVendor.WEBKITwas specified as the "vendor to keep." Only-moz-border-radiusis removed because it is vendor-specific, but it is not the whitelisted vendor. If there were properties prefixed with "-o-" for Opera or "-ms-" for Microsoft, then those would have been removed, as well.
-
-
Constructor Summary
Constructors Constructor Description RemoveVendorSpecificProperties(Vendor vendorToKeep, MutatingVisitController visitController)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanenterDeclaration(CssDeclarationNode declarationNode)Checks whether thePropertyofdeclarationNodeis a vendor-specific property that does not matchvendorToKeep.voidrunPass()-
Methods inherited from class com.google.common.css.compiler.ast.DefaultTreeVisitor
enterArgumentNode, enterAttributeSelector, enterBlock, enterCharSet, enterClassSelector, enterCombinator, enterComponent, enterCompositeValueNode, enterCompositeValueNodeOperator, enterConditionalBlock, enterConditionalRule, enterDeclarationBlock, enterDefinition, enterFontFace, enterForLoop, enterFunctionNode, enterIdSelector, enterImportBlock, enterImportRule, enterKey, enterKeyBlock, enterKeyframeRuleset, enterKeyframesRule, enterMediaRule, enterMediaTypeListDelimiter, enterMixin, enterMixinDefinition, enterPageRule, enterPageSelector, enterPropertyValue, enterProvideNode, enterPseudoClass, enterPseudoElement, enterRequireNode, enterRuleset, enterSelector, enterSelectorBlock, enterTree, enterUnknownAtRule, enterValueNode, leaveArgumentNode, leaveAttributeSelector, leaveBlock, leaveCharSet, leaveClassSelector, leaveCombinator, leaveComponent, leaveCompositeValueNode, leaveCompositeValueNodeOperator, leaveConditionalBlock, leaveConditionalRule, leaveDeclaration, leaveDeclarationBlock, leaveDefinition, leaveFontFace, leaveForLoop, leaveFunctionNode, leaveIdSelector, leaveImportBlock, leaveImportRule, leaveKey, leaveKeyBlock, leaveKeyframeRuleset, leaveKeyframesRule, leaveMediaRule, leaveMediaTypeListDelimiter, leaveMixin, leaveMixinDefinition, leavePageRule, leavePageSelector, leavePropertyValue, leaveProvideNode, leavePseudoClass, leavePseudoElement, leaveRequireNode, leaveRuleset, leaveSelector, leaveSelectorBlock, leaveTree, leaveUnknownAtRule, leaveValueNode
-
-
-
-
Constructor Detail
-
RemoveVendorSpecificProperties
public RemoveVendorSpecificProperties(@Nonnull Vendor vendorToKeep, MutatingVisitController visitController)- Parameters:
vendorToKeep- determines the vendor for whose vendor-specific properties will not be stripped. This parameter may not be null: if there is no such venor, then this pass should not be used.visitController- to facilitate traversing the AST
-
-
Method Detail
-
enterDeclaration
public boolean enterDeclaration(CssDeclarationNode declarationNode)
Checks whether thePropertyofdeclarationNodeis a vendor-specific property that does not matchvendorToKeep. If so, then the declaration is removed.- Specified by:
enterDeclarationin interfaceCssTreeVisitor- Overrides:
enterDeclarationin classDefaultTreeVisitor
-
runPass
public void runPass()
- Specified by:
runPassin interfaceCssCompilerPass
-
-