Class LengthValue
- java.lang.Object
-
- com.openhtmltopdf.css.style.DerivedValue
-
- com.openhtmltopdf.css.style.derived.LengthValue
-
- All Implemented Interfaces:
FSDerivedValue
public class LengthValue extends DerivedValue
-
-
Field Summary
Fields Modifier and Type Field Description private float
_lengthAsFloat
The specified length value, as a float; pulled from the CSS textprivate short
_lengthPrimitiveType
The specified primitive SAC data type given for this length, from the CSS textprivate CalculatedStyle
_style
private static float
CM__PER__IN
private static int
MM__PER__CM
private static float
PC__PER__PT
private static float
PT__PER__IN
-
Constructor Summary
Constructors Constructor Description LengthValue(CalculatedStyle style, CSSName name, PropertyValue value)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description float
asFloat()
static float
calcFloatProportionalValue(CalculatedStyle style, CSSName cssName, java.lang.String stringValue, float relVal, short primitiveType, float baseValue, CssContext ctx)
float
getFloatProportionalTo(CSSName cssName, float baseValue, CssContext ctx)
Computes a relative unit (e.g.short
getLengthPrimitiveType()
private CalculatedStyle
getStyle()
boolean
hasAbsoluteUnit()
boolean
isDependentOnFontSize()
-
Methods inherited from class com.openhtmltopdf.css.style.DerivedValue
asColor, asIdentValue, asString, asStringArray, getCssSacUnitType, getStringValue, isAbsoluteUnit, isDeclaredInherit, isIdent
-
-
-
-
Field Detail
-
MM__PER__CM
private static final int MM__PER__CM
- See Also:
- Constant Field Values
-
CM__PER__IN
private static final float CM__PER__IN
- See Also:
- Constant Field Values
-
PT__PER__IN
private static final float PT__PER__IN
- See Also:
- Constant Field Values
-
PC__PER__PT
private static final float PC__PER__PT
- See Also:
- Constant Field Values
-
_lengthAsFloat
private float _lengthAsFloat
The specified length value, as a float; pulled from the CSS text
-
_style
private CalculatedStyle _style
-
_lengthPrimitiveType
private short _lengthPrimitiveType
The specified primitive SAC data type given for this length, from the CSS text
-
-
Constructor Detail
-
LengthValue
public LengthValue(CalculatedStyle style, CSSName name, PropertyValue value)
-
-
Method Detail
-
getLengthPrimitiveType
public short getLengthPrimitiveType()
-
asFloat
public float asFloat()
- Specified by:
asFloat
in interfaceFSDerivedValue
- Overrides:
asFloat
in classDerivedValue
-
getFloatProportionalTo
public float getFloatProportionalTo(CSSName cssName, float baseValue, CssContext ctx)
Computes a relative unit (e.g. percentage) as an absolute value, using the input value. Used for such properties whose parent value cannot be known before layout/render- Specified by:
getFloatProportionalTo
in interfaceFSDerivedValue
- Overrides:
getFloatProportionalTo
in classDerivedValue
- Parameters:
cssName
- Name of the propertybaseValue
-ctx
-- Returns:
- the absolute value or computed absolute value
-
hasAbsoluteUnit
public boolean hasAbsoluteUnit()
- Specified by:
hasAbsoluteUnit
in interfaceFSDerivedValue
- Overrides:
hasAbsoluteUnit
in classDerivedValue
-
isDependentOnFontSize
public boolean isDependentOnFontSize()
- Specified by:
isDependentOnFontSize
in interfaceFSDerivedValue
- Overrides:
isDependentOnFontSize
in classDerivedValue
-
calcFloatProportionalValue
public static float calcFloatProportionalValue(CalculatedStyle style, CSSName cssName, java.lang.String stringValue, float relVal, short primitiveType, float baseValue, CssContext ctx)
-
getStyle
private CalculatedStyle getStyle()
-
-