Package com.google.gwt.resources.gss
Class ExternalClassesCollector
java.lang.Object
com.google.gwt.thirdparty.common.css.compiler.ast.DefaultTreeVisitor
com.google.gwt.resources.gss.ExternalClassesCollector
- All Implemented Interfaces:
com.google.gwt.thirdparty.common.css.compiler.ast.AtRuleHandler
,com.google.gwt.thirdparty.common.css.compiler.ast.CssCompilerPass
,com.google.gwt.thirdparty.common.css.compiler.ast.CssTreeVisitor
public class ExternalClassesCollector
extends com.google.gwt.thirdparty.common.css.compiler.ast.DefaultTreeVisitor
implements com.google.gwt.thirdparty.common.css.compiler.ast.CssCompilerPass
Compiler pass that collects external styles declared with the
@external
at-rule.
This pass also removes the @external
nodes from the AST.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionExternalClassesCollector
(com.google.gwt.thirdparty.common.css.compiler.ast.MutatingVisitController visitController, com.google.gwt.thirdparty.common.css.compiler.ast.ErrorManager errorManager) -
Method Summary
Modifier and TypeMethodDescriptionboolean
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()
Methods inherited from class com.google.gwt.thirdparty.common.css.compiler.ast.DefaultTreeVisitor
enterArgumentNode, enterAttributeSelector, enterBlock, 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, 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, leaveValueNode, visit
-
Field Details
-
EXTERNAL_AT_RULE
- See Also:
-
-
Constructor Details
-
ExternalClassesCollector
public ExternalClassesCollector(com.google.gwt.thirdparty.common.css.compiler.ast.MutatingVisitController visitController, com.google.gwt.thirdparty.common.css.compiler.ast.ErrorManager errorManager)
-
-
Method Details
-
runPass
public void runPass()- Specified by:
runPass
in interfacecom.google.gwt.thirdparty.common.css.compiler.ast.CssCompilerPass
-
enterClassSelector
public boolean enterClassSelector(com.google.gwt.thirdparty.common.css.compiler.ast.CssClassSelectorNode classSelector) - Specified by:
enterClassSelector
in interfacecom.google.gwt.thirdparty.common.css.compiler.ast.CssTreeVisitor
- Overrides:
enterClassSelector
in classcom.google.gwt.thirdparty.common.css.compiler.ast.DefaultTreeVisitor
-
leaveUnknownAtRule
public void leaveUnknownAtRule(com.google.gwt.thirdparty.common.css.compiler.ast.CssUnknownAtRuleNode node) - Specified by:
leaveUnknownAtRule
in interfacecom.google.gwt.thirdparty.common.css.compiler.ast.AtRuleHandler
- Overrides:
leaveUnknownAtRule
in classcom.google.gwt.thirdparty.common.css.compiler.ast.DefaultTreeVisitor
-
getExternalClassNames
public 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. The returned set contains all complete class names defined with@external
as well as all of the class names fromstyleClassesSet
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 */
- Parameters:
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.- Returns:
- an immutable set of class names. Note that the returned names are not prefixed with "."; they are the raw name.
-