public class CSSReducer extends Object implements ICSSCodeGenResult
Modifier and Type | Field and Description |
---|---|
static String |
DATA_ARRAY
The base name of CSS data array.
|
static String |
FACTORY_FUNCTIONS
The base name of CSS Factory Functions.
|
static String |
FONTFACE_ARRAY
The base name of CSS FontFace list.
|
static String |
INHERITING_STYLES
The base name of CSS Inheriting Styles.
|
static Name |
NAME_DATA_ARRAY
AET name for
var data:Array . |
static Name |
NAME_FACTORY_FUNCTIONS
ABC
Name forpublic static var factoryFunctions:Object = generateFactoryFunctions(); |
static Name |
NAME_FONTFACE_ARRAY
AET name for
var data:Array . |
Constructor and Description |
---|
CSSReducer(IFlexProject project,
ICSSDocument cssDocument,
IABCVisitor abcVisitor,
CSSCompilationSession session,
boolean isDefaultFactory,
int styleTagIndex)
Create a CSS reducer.
|
public static final String FONTFACE_ARRAY
public static final String FACTORY_FUNCTIONS
public static final String INHERITING_STYLES
public static final String DATA_ARRAY
public static final Name NAME_DATA_ARRAY
var data:Array
.public static final Name NAME_FONTFACE_ARRAY
var data:Array
.public static final Name NAME_FACTORY_FUNCTIONS
Name
forpublic static var factoryFunctions:Object = generateFactoryFunctions();
public CSSReducer(IFlexProject project, ICSSDocument cssDocument, IABCVisitor abcVisitor, CSSCompilationSession session, boolean isDefaultFactory, int styleTagIndex)
project
- Owner project.cssDocument
- CSS DOM tree.abcVisitor
- IABCVisitor
to which generated ABC constructs
are added.session
- CSS compilation session data.isDefaultFactory
- If true, the generated code will register the
styles with ICSSRuntimeConstants.DEFAULT_FACTORY
.public Pair.PairOfInstructionLists reduceDocument(ICSSNode site, Pair.PairOfInstructionLists namespaceList, Pair.PairOfInstructionLists ruleList)
StyleDateClass
.site
- ICSSDocument
node.namespaceList
- Instructions to create array and closure for
namespace declarations.ruleList
- Instructions to create array and closure for rules.public InstructionList getClassInitializationInstructions()
getClassInitializationInstructions
in interface ICSSCodeGenResult
InstructionList
containing instructions for
initializing the CSS data structures. This method does not append
returnvoid
instructions to the end of the instruction list.public void visitClassTraits(ITraitsVisitor classTraitsVisitor)
ICSSCodeGenResult
ITraitsVisitor
.visitClassTraits
in interface ICSSCodeGenResult
classTraitsVisitor
- ITraitsVisitor
to which traits for the
css data structures are added.public Pair.PairOfInstructionLists reduceNamespaceDefinition(ICSSNode site)
public Pair.PairOfInstructionLists reduceNamespaceList(ICSSNode site, List<Pair.PairOfInstructionLists> namespaces)
public Pair.PairOfInstructionLists reduceProperty(ICSSNode site)
For example: fontSize : 12;
will be translated into
ActionScript:
this.fontSize = 12;
The ABC instructions for this statement are:
getlocal0 pushint 12 setproperty fontSize
getlocal0
will put "this" on the stack, then the property value
is put on the stack. Finally, setproperty
will assign "12" to
"fontSize".
The code generation is based on the assumption that the CSS DOM tree has been semantically checked, so that the validity of the property name and type is not re-checked in the BURM.
public Pair.PairOfInstructionLists reducePropertyList(ICSSNode site, List<Pair.PairOfInstructionLists> properties)
public Pair.InstructionListAndClosure reduceRule(ICSSNode site, Pair.InstructionListAndClosure selector, Pair.PairOfInstructionLists propertyList)
propertyList
into the
selector
's closure map.site
- ICSSRule
node.selector
- Instructions to construct the array data, and a map of
named closures.propertyList
- Instructions to create array and closure that set the
properties.public Pair.InstructionListAndString reduceSelector(ICSSNode site)
public Pair.PairOfInstructionLists reduceRuleList(ICSSNode site, List<Pair.InstructionListAndClosure> rules)
public Pair.InstructionListAndClosure reduceSelectorGroup(ICSSNode site, List<Pair.InstructionListAndString> selectors)
The array reduction is instruction list. The closure reduction is a map.
The keys in the map are the resolved selector names that will be used as
names for the generated closures. The values in the map are all null.
They will be populated in the parent tree, because the MethodInfo
for the closure bodies come from a sibling "properties" tree.
public Pair.PairOfInstructionLists reduceFontFaceList(ICSSNode site, List<Pair.PairOfInstructionLists> fontFaces)
public Pair.PairOfInstructionLists reduceFontFace(ICSSNode site)
public Pair.PairOfInstructionLists reduceMediaQuery(ICSSNode site, List<Pair.PairOfInstructionLists> conditions)
public Pair.PairOfInstructionLists reduceMediaQueryCondition(ICSSNode site)
public Set<ICompilerProblem> getProblems()
Copyright © 2016 The Apache Software Foundation. All rights reserved.