Class StyleUtil
- java.lang.Object
-
- com.itextpdf.styledxmlparser.util.StyleUtil
-
public final class StyleUtil extends java.lang.Object
Utility class for resolving parent-inheritance of style and attribute declarations.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.List<java.lang.String>
fontSizeDependentPercentage
List to store the properties whose value can depend on parent or element font-size
-
Constructor Summary
Constructors Modifier Constructor Description private
StyleUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static boolean
checkInheritance(java.lang.String styleProperty, java.util.Set<IStyleInheritance> inheritanceRules)
Check all inheritance rule-sets to see if the passed property is inheritablestatic java.util.Map<java.lang.String,java.lang.String>
mergeParentStyleDeclaration(java.util.Map<java.lang.String,java.lang.String> styles, java.lang.String styleProperty, java.lang.String parentPropValue, java.lang.String parentFontSizeString, java.util.Set<IStyleInheritance> inheritanceRules)
Merge parent CSS declarations.private static boolean
valueIsOfMeasurement(java.lang.String value, java.lang.String measurement)
Check to see if the passed value is a measurement of the type based on the passed measurement symbol string
-
-
-
Method Detail
-
mergeParentStyleDeclaration
public static java.util.Map<java.lang.String,java.lang.String> mergeParentStyleDeclaration(java.util.Map<java.lang.String,java.lang.String> styles, java.lang.String styleProperty, java.lang.String parentPropValue, java.lang.String parentFontSizeString, java.util.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(java.lang.String styleProperty, java.util.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
private static boolean valueIsOfMeasurement(java.lang.String value, java.lang.String measurement)
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
-
-