Class ResolveCustomFunctionNodes
java.lang.Object
com.google.common.css.compiler.ast.DefaultTreeVisitor
com.google.common.css.compiler.passes.ResolveCustomFunctionNodes
- All Implemented Interfaces:
AtRuleHandler,CssCompilerPass,CssTreeVisitor
- Direct Known Subclasses:
ResolveCustomFunctionNodesForChunks
This compiler pass replaces
CssCustomFunctionNode instances with the
list of nodes returned by the GssFunction.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionResolveCustomFunctionNodes(MutatingVisitController visitController, ErrorManager errorManager, Map<String, GssFunction> functionMap) Constructs the pass.ResolveCustomFunctionNodes(MutatingVisitController visitController, ErrorManager errorManager, Map<String, GssFunction> functionMap, boolean allowUnknownFunctions) Constructs the pass.ResolveCustomFunctionNodes(MutatingVisitController visitController, ErrorManager errorManager, Map<String, GssFunction> functionMap, boolean allowUnknownFunctions, Set<String> allowedNonStandardFunctions) Constructs the pass. -
Method Summary
Modifier and TypeMethodDescriptionprotected List<CssValueNode>evaluateFunction(CssCustomFunctionNode node, GssFunction function, List<CssValueNode> arguments, ErrorManager errorManager) Evaluates the given function node.voidleaveFunctionNode(CssFunctionNode functionNode) Called after visiting aCssFunctionNode's sub trees.voidrunPass()Methods inherited from class com.google.common.css.compiler.ast.DefaultTreeVisitor
enterArgumentNode, enterAttributeSelector, enterBlock, enterCharSet, enterClassSelector, enterCombinator, enterComponent, enterCompositeValueNode, enterCompositeValueNodeOperator, enterConditionalBlock, enterConditionalRule, enterDeclaration, 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, leaveIdSelector, leaveImportBlock, leaveImportRule, leaveKey, leaveKeyBlock, leaveKeyframeRuleset, leaveKeyframesRule, leaveMediaRule, leaveMediaTypeListDelimiter, leaveMixin, leaveMixinDefinition, leavePageRule, leavePageSelector, leavePropertyValue, leaveProvideNode, leavePseudoClass, leavePseudoElement, leaveRequireNode, leaveRuleset, leaveSelector, leaveSelectorBlock, leaveTree, leaveUnknownAtRule, leaveValueNode
-
Field Details
-
functionMap
-
-
Constructor Details
-
ResolveCustomFunctionNodes
public ResolveCustomFunctionNodes(MutatingVisitController visitController, ErrorManager errorManager, Map<String, GssFunction> functionMap) Constructs the pass.- Parameters:
visitController- The visit controllererrorManager- The error managerfunctionMap- The map from function names to resolve to GSS functions
-
ResolveCustomFunctionNodes
public ResolveCustomFunctionNodes(MutatingVisitController visitController, ErrorManager errorManager, Map<String, GssFunction> functionMap, boolean allowUnknownFunctions) Constructs the pass.- Parameters:
visitController- The visit controllererrorManager- The error managerfunctionMap- The map from function names to resolve to GSS functionsallowUnknownFunctions- Whether to allow unknown function calls, leaving them as is, instead of reporting an error
-
ResolveCustomFunctionNodes
public ResolveCustomFunctionNodes(MutatingVisitController visitController, ErrorManager errorManager, Map<String, GssFunction> functionMap, boolean allowUnknownFunctions, Set<String> allowedNonStandardFunctions) Constructs the pass.- Parameters:
visitController- The visit controllererrorManager- The error managerfunctionMap- The map from function names to resolve to GSS functionsallowUnknownFunctions- Whether to allow unknown function calls, leaving them as is, instead of reporting an errorallowedNonStandardFunctions- functions that should not yield a warning if they appear in a stylesheet
-
-
Method Details
-
leaveFunctionNode
Description copied from interface:CssTreeVisitorCalled after visiting aCssFunctionNode's sub trees.- Specified by:
leaveFunctionNodein interfaceCssTreeVisitor- Overrides:
leaveFunctionNodein classDefaultTreeVisitor
-
evaluateFunction
protected List<CssValueNode> evaluateFunction(CssCustomFunctionNode node, GssFunction function, List<CssValueNode> arguments, ErrorManager errorManager) throws GssFunctionException Evaluates the given function node.Subclasses may sublcass this method to change the evaluation process in some circumstances.
- Parameters:
node- the function node to evaluatefunction- the GSS function matching this nodearguments- the arguments of this nodeerrorManager- the error manager passed into the GSS function call- Returns:
- the result of the evaluation as a list of value nodes
- Throws:
GssFunctionException- if the function call is invalidRuntimeException- if the function call fails to complete
-
runPass
public void runPass()- Specified by:
runPassin interfaceCssCompilerPass
-