Class BiDiFlipper
java.lang.Object
com.google.common.css.compiler.ast.DefaultTreeVisitor
com.google.common.css.compiler.passes.BiDiFlipper
- All Implemented Interfaces:
AtRuleHandler,CssCompilerPass,CssTreeVisitor
Compiler pass that BiDi flips all the flippable nodes.
TODO(user): Need to add a function to return tree before flipping.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBiDiFlipper(MutatingVisitController visitController, boolean swapLtrRtlInUrl, boolean swapLeftRightInUrl) BiDiFlipper(MutatingVisitController visitController, boolean swapLtrRtlInUrl, boolean swapLeftRightInUrl, boolean shouldFlipConstantReferences) -
Method Summary
Modifier and TypeMethodDescriptionbooleanenterDeclaration(CssDeclarationNode declarationNode) Called before visiting aCssDeclarationNode's sub treesstatic StringflipLiteralValue(String value) Performs appropriate replacements needed for BiDi flipping a literal value.protected <T extends CssValueNode>
TflipNode(T tNode) Returns flipped node after making appropriate replacements needed for BiDi flipping, if the node is either a LiteralNode or PropertyNode.static StringflipPercentageValue(String value) Returns a formatted string representing 100% - value.voidrunPass()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, 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, leaveFunctionNode, 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
-
RIGHT
- See Also:
-
BORDER_RADIUS_PROPERTIES
-
FOUR_PART_PROPERTIES_THAT_SHOULD_FLIP
public static final com.google.common.collect.ImmutableSet<String> FOUR_PART_PROPERTIES_THAT_SHOULD_FLIPSet of properties whose property values may flip if they match the four-part pattern.
-
-
Constructor Details
-
BiDiFlipper
public BiDiFlipper(MutatingVisitController visitController, boolean swapLtrRtlInUrl, boolean swapLeftRightInUrl, boolean shouldFlipConstantReferences) -
BiDiFlipper
public BiDiFlipper(MutatingVisitController visitController, boolean swapLtrRtlInUrl, boolean swapLeftRightInUrl)
-
-
Method Details
-
flipPercentageValue
Returns a formatted string representing 100% - value. Neither the input nor the output contains a%. -
flipLiteralValue
Performs appropriate replacements needed for BiDi flipping a literal value. -
flipNode
Returns flipped node after making appropriate replacements needed for BiDi flipping, if the node is either a LiteralNode or PropertyNode. Eg: PropertyNode 'padding-right' would become 'padding-left'.Subclasses can override to provide custom flipping behavior.
-
enterDeclaration
Description copied from interface:CssTreeVisitorCalled before visiting aCssDeclarationNode's sub trees- Specified by:
enterDeclarationin interfaceCssTreeVisitor- Overrides:
enterDeclarationin classDefaultTreeVisitor
-
runPass
public void runPass()- Specified by:
runPassin interfaceCssCompilerPass
-