public final class ValueConstants extends Object
CSSValue instances.| Constructor and Description |
|---|
ValueConstants() |
| Modifier and Type | Method and Description |
|---|---|
static Float |
absoluteLengthToPixels(short type,
float value)
Converts a length in an absolute unit to CSS pixels.
|
static boolean |
isAbsoluteUnit(short type)
Returns true if the specified type absolute (even if we have a computed
value for it), meaning that either the value can be used directly (e.g.
|
static boolean |
isNumber(short cssPrimitiveType)
Deprecated.
Only used by the broken DOMInspector.
|
static String |
stringForSACPrimitiveType(short type)
Given a unit constant like
CSSPrimitiveValue.CSS_EMS
will return the unit suffix like em. |
public static String stringForSACPrimitiveType(short type)
CSSPrimitiveValue.CSS_EMS
will return the unit suffix like em.
FIXME: Not exhaustive.public static Float absoluteLengthToPixels(short type, float value)
Unlike LengthValue.calcFloatProportionalValue(com.openhtmltopdf.css.style.CalculatedStyle, com.openhtmltopdf.css.constants.CSSName, java.lang.String, float, short, float, com.openhtmltopdf.css.style.CssContext),
which converts to dots and therefore needs a style and a context, this only handles the
units whose conversion is fixed by CSS, and so needs neither. Useful where a length turns
up outside a styled element, such as the width attribute of an SVG that is
being used as an image.
A unitless number is treated as pixels, as CSS and SVG both do.
type - the unit, one of the CSSPrimitiveValue constantsvalue - the length in that unitpublic static boolean isAbsoluteUnit(short type)
type - The CSSValue type to check.@Deprecated public static boolean isNumber(short cssPrimitiveType)
Copyright © 2004–2026. All rights reserved.