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.CssCompilerPassCompiler pass that collects external styles declared with the@externalat-rule.This pass also removes the
@externalnodes from the AST.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringEXTERNAL_AT_RULE
-
Constructor Summary
Constructors Constructor Description ExternalClassesCollector(com.google.gwt.thirdparty.common.css.compiler.ast.MutatingVisitController visitController, com.google.gwt.thirdparty.common.css.compiler.ast.ErrorManager errorManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanenterClassSelector(com.google.gwt.thirdparty.common.css.compiler.ast.CssClassSelectorNode classSelector)com.google.gwt.thirdparty.guava.common.collect.ImmutableSet<java.lang.String>getExternalClassNames(java.util.Set<java.lang.String> styleClassesSet, java.util.Set<java.lang.String> orphanClassName)Returns an immutable set of external class names that should not be renamed.voidleaveUnknownAtRule(com.google.gwt.thirdparty.common.css.compiler.ast.CssUnknownAtRuleNode node)voidrunPass()-
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 Detail
-
EXTERNAL_AT_RULE
public static final java.lang.String EXTERNAL_AT_RULE
- See Also:
- Constant Field Values
-
-
Method Detail
-
runPass
public void runPass()
- Specified by:
runPassin 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:
enterClassSelectorin interfacecom.google.gwt.thirdparty.common.css.compiler.ast.CssTreeVisitor- Overrides:
enterClassSelectorin 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:
leaveUnknownAtRulein interfacecom.google.gwt.thirdparty.common.css.compiler.ast.AtRuleHandler- Overrides:
leaveUnknownAtRulein classcom.google.gwt.thirdparty.common.css.compiler.ast.DefaultTreeVisitor
-
getExternalClassNames
public com.google.gwt.thirdparty.guava.common.collect.ImmutableSet<java.lang.String> getExternalClassNames(java.util.Set<java.lang.String> styleClassesSet, java.util.Set<java.lang.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@externalas well as all of the class names fromstyleClassesSetthat 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
@externalrelated 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.
-
-