Class AutoExpandBrowserPrefix
java.lang.Object
com.google.common.css.compiler.ast.DefaultTreeVisitor
com.google.common.css.compiler.passes.AutoExpandBrowserPrefix
- All Implemented Interfaces:
AtRuleHandler,CssCompilerPass,CssTreeVisitor
A compiler pass that automatically detects certain properties that need additional
browser specific property declarations, and adds them.
The properties to be matched for expansion are provided by the
BrowserPrefixGenerator.
This mechanism is an alternative to using conventional mixins. Problems with conventional mixins: - developers have to always remember to use the mixin consistently - they have to go find the appropriate mixins - the framework has to to verify the code and ensure mixins were used correctly Automation addresses all of the above issues.
Currently three most common cases are handled: #1 Matching and replacing only the property name. Eg. flex-grow: VALUE; #2 Matching property name and value, replacing the value. Eg. display: flex; #3 Matching property name and value where value is a function, replacing the function name. Eg. background-image: linear-gradient(ARGS);
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanenterDeclaration(CssDeclarationNode declaration) Called before visiting aCssDeclarationNode's sub treesbooleanCalled before visiting aCssMixinDefinitionNode's sub treesprotected com.google.common.collect.ImmutableList<CssDeclarationNode>getNonFunctionValueMatches(BrowserPrefixRule rule, CssDeclarationNode declaration) voidCalled after visiting aCssMixinDefinitionNode's sub treesvoidrunPass()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, 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, leavePageRule, leavePageSelector, leavePropertyValue, leaveProvideNode, leavePseudoClass, leavePseudoElement, leaveRequireNode, leaveRuleset, leaveSelector, leaveSelectorBlock, leaveTree, leaveUnknownAtRule, leaveValueNode
-
Field Details
-
ALTERNATE
- See Also:
-
-
Constructor Details
-
AutoExpandBrowserPrefix
-
-
Method Details
-
enterMixinDefinition
Description copied from interface:AtRuleHandlerCalled before visiting aCssMixinDefinitionNode's sub trees- Specified by:
enterMixinDefinitionin interfaceAtRuleHandler- Overrides:
enterMixinDefinitionin classDefaultTreeVisitor- Parameters:
node- node
-
leaveMixinDefinition
Description copied from interface:AtRuleHandlerCalled after visiting aCssMixinDefinitionNode's sub trees- Specified by:
leaveMixinDefinitionin interfaceAtRuleHandler- Overrides:
leaveMixinDefinitionin classDefaultTreeVisitor- Parameters:
node- node
-
enterDeclaration
Description copied from interface:CssTreeVisitorCalled before visiting aCssDeclarationNode's sub trees- Specified by:
enterDeclarationin interfaceCssTreeVisitor- Overrides:
enterDeclarationin classDefaultTreeVisitor
-
getNonFunctionValueMatches
protected com.google.common.collect.ImmutableList<CssDeclarationNode> getNonFunctionValueMatches(BrowserPrefixRule rule, CssDeclarationNode declaration) -
runPass
public void runPass()- Specified by:
runPassin interfaceCssCompilerPass
-