Class StyleUtil
java.lang.Object
com.itextpdf.styledxmlparser.util.StyleUtil
Utility class for resolving parent-inheritance of style and attribute declarations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionList to store the properties whose value can depend on parent or element font-size -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleancheckInheritance(String styleProperty, Set<IStyleInheritance> inheritanceRules) Check all inheritance rule-sets to see if the passed property is inheritablemergeParentStyleDeclaration(Map<String, String> styles, String styleProperty, String parentPropValue, String parentFontSizeString, Set<IStyleInheritance> inheritanceRules) Merge parent CSS declarations.private static booleanvalueIsOfMeasurement(String value, String measurement) Check to see if the passed value is a measurement of the type based on the passed measurement symbol string
-
Field Details
-
fontSizeDependentPercentage
-
-
Constructor Details
-
StyleUtil
private StyleUtil()
-
-
Method Details
-
mergeParentStyleDeclaration
public static Map<String,String> mergeParentStyleDeclaration(Map<String, String> styles, String styleProperty, String parentPropValue, String parentFontSizeString, Set<IStyleInheritance> inheritanceRules) Merge parent CSS declarations.- Parameters:
styles- the styles mapstyleProperty- the CSS propertyparentPropValue- the parent properties valueparentFontSizeString- is a font size of parent elementinheritanceRules- set of inheritance rules- Returns:
- a map of updated styles after merging parent and child style declarations
-
checkInheritance
private static boolean checkInheritance(String styleProperty, Set<IStyleInheritance> inheritanceRules) Check all inheritance rule-sets to see if the passed property is inheritable- Parameters:
styleProperty- property identifier to checkinheritanceRules- a set of inheritance rules- Returns:
- True if the property is inheritable by one of the rule-sets, false if it is not marked as inheritable in all rule-sets
-
valueIsOfMeasurement
Check to see if the passed value is a measurement of the type based on the passed measurement symbol string- Parameters:
value- string containing value to checkmeasurement- measurement symbol (e.g. % for relative, px for pixels)- Returns:
- True if the value is numerical and ends with the measurement symbol, false otherwise
-