public interface CSSUnit
CSS numeric units.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final short
Font-relative length (cap
).static final short
Font-relative length (ch
).static final short
Length (cm
).static final short
Angle (deg
).static final short
Resolution (dpcm
).static final short
Resolution (dpi
).static final short
Resolution (dppx
).static final short
Font-relative length (em
).static final short
Font-relative length (ex
).static final short
Flexible length (fr
).static final short
Angle (grad
).static final short
Frequency (Hz
).static final short
Font-relative length (ic
).static final short
Length (in
).static final short
Invalid CSS unit.static final short
Frequency (kHz
).static final short
Font-relative length (lh
).static final short
Length (mm
).static final short
Time (ms
).static final short
Dimensionless number.static final short
Number with an unknown dimension.static final short
Length (pc
).static final short
Percentage.static final short
Length (pt
).static final short
Length (px
).static final short
Length (Q
).static final short
Angle (rad
).static final short
Font-relative length (rch
).static final short
Font-relative length (rem
).static final short
Font-relative length (rex
).static final short
Font-relative length (ric
).static final short
Font-relative length (rlh
).static final short
Time (s
).static final short
Angle (turn
).static final short
Viewport-percentage length (vb
).static final short
Viewport-percentage length (vh
).static final short
Viewport-percentage length (vi
).static final short
Viewport-percentage length (vmax
).static final short
Viewport-percentage length (vmin
).static final short
Viewport-percentage length (vw
). -
Method Summary
Modifier and TypeMethodDescriptionstatic String
dimensionUnitString
(short unitType) Gives the dimension unit string associated to the given CSS unit type.static boolean
isAngleUnitType
(short unitType) Check whether the given unit is an angle.static boolean
isLengthUnitType
(short unitType) Check whether the given unit is a length.static boolean
isRelativeLengthUnitType
(short unitType) Check whether the given unit is a relative length.static boolean
isResolutionUnitType
(short unitType) Check whether the given unit is a resolution unit.static boolean
isTimeUnitType
(short unitType) Check whether the given unit is a time.
-
Field Details
-
CSS_NUMBER
static final short CSS_NUMBERDimensionless number.- See Also:
-
CSS_OTHER
static final short CSS_OTHERNumber with an unknown dimension.- See Also:
-
CSS_PERCENTAGE
static final short CSS_PERCENTAGEPercentage.- See Also:
-
CSS_PX
static final short CSS_PXLength (px
).- See Also:
-
CSS_IN
static final short CSS_INLength (in
).- See Also:
-
CSS_PC
static final short CSS_PCLength (pc
).- See Also:
-
CSS_PT
static final short CSS_PTLength (pt
).- See Also:
-
CSS_CM
static final short CSS_CMLength (cm
).- See Also:
-
CSS_MM
static final short CSS_MMLength (mm
).- See Also:
-
CSS_QUARTER_MM
static final short CSS_QUARTER_MMLength (Q
).- See Also:
-
CSS_EM
static final short CSS_EMFont-relative length (em
).- See Also:
-
CSS_EX
static final short CSS_EXFont-relative length (ex
).- See Also:
-
CSS_CAP
static final short CSS_CAPFont-relative length (cap
).- See Also:
-
CSS_CH
static final short CSS_CHFont-relative length (ch
).- See Also:
-
CSS_IC
static final short CSS_ICFont-relative length (ic
).- See Also:
-
CSS_LH
static final short CSS_LHFont-relative length (lh
).- See Also:
-
CSS_REM
static final short CSS_REMFont-relative length (rem
).- See Also:
-
CSS_RLH
static final short CSS_RLHFont-relative length (rlh
).- See Also:
-
CSS_REX
static final short CSS_REXFont-relative length (rex
).- See Also:
-
CSS_RCH
static final short CSS_RCHFont-relative length (rch
).- See Also:
-
CSS_RIC
static final short CSS_RICFont-relative length (ric
).- See Also:
-
CSS_VB
static final short CSS_VBViewport-percentage length (vb
).- See Also:
-
CSS_VH
static final short CSS_VHViewport-percentage length (vh
).- See Also:
-
CSS_VI
static final short CSS_VIViewport-percentage length (vi
).- See Also:
-
CSS_VMAX
static final short CSS_VMAXViewport-percentage length (vmax
).- See Also:
-
CSS_VMIN
static final short CSS_VMINViewport-percentage length (vmin
).- See Also:
-
CSS_VW
static final short CSS_VWViewport-percentage length (vw
).- See Also:
-
CSS_DPI
static final short CSS_DPIResolution (dpi
).- See Also:
-
CSS_DPCM
static final short CSS_DPCMResolution (dpcm
).- See Also:
-
CSS_DPPX
static final short CSS_DPPXResolution (dppx
).- See Also:
-
CSS_FR
static final short CSS_FRFlexible length (fr
). Note that it is not a length.- See Also:
-
CSS_DEG
static final short CSS_DEGAngle (deg
).- See Also:
-
CSS_RAD
static final short CSS_RADAngle (rad
).- See Also:
-
CSS_GRAD
static final short CSS_GRADAngle (grad
).- See Also:
-
CSS_TURN
static final short CSS_TURNAngle (turn
).- See Also:
-
CSS_S
static final short CSS_STime (s
).- See Also:
-
CSS_MS
static final short CSS_MSTime (ms
).- See Also:
-
CSS_HZ
static final short CSS_HZFrequency (Hz
).- See Also:
-
CSS_KHZ
static final short CSS_KHZFrequency (kHz
).- See Also:
-
CSS_INVALID
static final short CSS_INVALIDInvalid CSS unit.- See Also:
-
-
Method Details
-
isLengthUnitType
static boolean isLengthUnitType(short unitType) Check whether the given unit is a length.Percentage is not considered an explicit length.
- Parameters:
unitType
- the unit type.- Returns:
- true if the unit is a length.
-
isRelativeLengthUnitType
static boolean isRelativeLengthUnitType(short unitType) Check whether the given unit is a relative length.- Parameters:
unitType
- the unit type.- Returns:
- true if the unit is a relative length.
-
isAngleUnitType
static boolean isAngleUnitType(short unitType) Check whether the given unit is an angle.- Parameters:
unitType
- the unit type.- Returns:
- true if the unit is an angle.
-
isTimeUnitType
static boolean isTimeUnitType(short unitType) Check whether the given unit is a time.- Parameters:
unitType
- the unit type.- Returns:
- true if the unit is a time.
-
isResolutionUnitType
static boolean isResolutionUnitType(short unitType) Check whether the given unit is a resolution unit.- Parameters:
unitType
- the unit type.- Returns:
- true if the unit is a resolution unit.
-
dimensionUnitString
Gives the dimension unit string associated to the given CSS unit type.- Parameters:
unitType
- the CSS primitive unit type.- Returns:
- the unit string.
- Throws:
DOMException
- INVALID_ACCESS_ERR if the unit is not aCSSUnit
one.
-