public class ExternalClassesCollector
extends com.google.gwt.thirdparty.common.css.compiler.ast.DefaultTreeVisitor
implements com.google.gwt.thirdparty.common.css.compiler.ast.CssCompilerPass
@external
at-rule.
This pass also removes the @external
nodes from the AST.
Modifier and Type | Field and Description |
---|---|
static String |
EXTERNAL_AT_RULE |
Constructor and Description |
---|
ExternalClassesCollector(com.google.gwt.thirdparty.common.css.compiler.ast.MutatingVisitController visitController,
com.google.gwt.thirdparty.common.css.compiler.ast.ErrorManager errorManager) |
Modifier and Type | Method and Description |
---|---|
boolean |
enterClassSelector(com.google.gwt.thirdparty.common.css.compiler.ast.CssClassSelectorNode classSelector) |
com.google.gwt.thirdparty.guava.common.collect.ImmutableSet<String> |
getExternalClassNames(Set<String> styleClassesSet,
Set<String> orphanClassName)
Returns an immutable set of external class names that should not be renamed.
|
void |
leaveUnknownAtRule(com.google.gwt.thirdparty.common.css.compiler.ast.CssUnknownAtRuleNode node) |
void |
runPass() |
enterArgumentNode, enterAttributeSelector, enterBlock, enterCombinator, enterComponent, enterCompositeValueNode, enterCompositeValueNodeOperator, enterConditionalBlock, enterConditionalRule, enterDeclaration, enterDeclarationBlock, enterDefinition, enterFontFace, 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, leaveClassSelector, leaveCombinator, leaveComponent, leaveCompositeValueNode, leaveCompositeValueNodeOperator, leaveConditionalBlock, leaveConditionalRule, leaveDeclaration, leaveDeclarationBlock, leaveDefinition, leaveFontFace, leaveFunctionNode, leaveIdSelector, leaveImportBlock, leaveImportRule, leaveKey, leaveKeyBlock, leaveKeyframeRuleset, leaveKeyframesRule, leaveMediaRule, leaveMediaTypeListDelimiter, leaveMixin, leaveMixinDefinition, leavePageRule, leavePageSelector, leavePropertyValue, leaveProvideNode, leavePseudoClass, leavePseudoElement, leaveRequireNode, leaveRuleset, leaveSelector, leaveSelectorBlock, leaveTree, leaveValueNode, visit
public static final String EXTERNAL_AT_RULE
public ExternalClassesCollector(com.google.gwt.thirdparty.common.css.compiler.ast.MutatingVisitController visitController, com.google.gwt.thirdparty.common.css.compiler.ast.ErrorManager errorManager)
public void runPass()
runPass
in interface com.google.gwt.thirdparty.common.css.compiler.ast.CssCompilerPass
public boolean enterClassSelector(com.google.gwt.thirdparty.common.css.compiler.ast.CssClassSelectorNode classSelector)
enterClassSelector
in interface com.google.gwt.thirdparty.common.css.compiler.ast.CssTreeVisitor
enterClassSelector
in class com.google.gwt.thirdparty.common.css.compiler.ast.DefaultTreeVisitor
public void leaveUnknownAtRule(com.google.gwt.thirdparty.common.css.compiler.ast.CssUnknownAtRuleNode node)
leaveUnknownAtRule
in interface com.google.gwt.thirdparty.common.css.compiler.ast.AtRuleHandler
leaveUnknownAtRule
in class com.google.gwt.thirdparty.common.css.compiler.ast.DefaultTreeVisitor
public com.google.gwt.thirdparty.guava.common.collect.ImmutableSet<String> getExternalClassNames(Set<String> styleClassesSet, Set<String> orphanClassName)
@external
as well as all of the class names from
styleClassesSet
that match prefixes defined with @external
.
The set will contain also the class names that are not in the AST anymore (defined in a
conditional node that has been evaluated to false) and are not associated to a java method.
That doesn't make sense to rename these class names because they are not in the final css
and javascript. Moreover we handle the case where an @external
related to these
style classes has been removed from the AST (because it was also defined in a conditional
node evaluated to false) and the compiler doesn't have to throw and error for this case.
/ * conditional node evaluated to false at compile time */
styleClassesSet
- a set of class names that should be filtered to
return those matching external prefixes. Note that the passed-in set is not
modified.orphanClassName
- a set of class names that aren't associated to a java method of the
CssResource interface.Copyright © 2018. All rights reserved.