public interface CSSUnit
CSS numeric units.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final shortFont-relative length (cap).static final shortFont-relative length (ch).static final shortLength (cm).static final shortAngle (deg).static final shortResolution (dpcm).static final shortResolution (dpi).static final shortResolution (dppx).static final shortFont-relative length (em).static final shortFont-relative length (ex).static final shortFlexible length (fr).static final shortAngle (grad).static final shortFrequency (Hz).static final shortFont-relative length (ic).static final shortLength (in).static final shortInvalid CSS unit.static final shortFrequency (kHz).static final shortFont-relative length (lh).static final shortLength (mm).static final shortTime (ms).static final shortDimensionless number.static final shortNumber with an unknown dimension.static final shortLength (pc).static final shortPercentage.static final shortLength (pt).static final shortLength (px).static final shortLength (Q).static final shortAngle (rad).static final shortFont-relative length (rch).static final shortFont-relative length (rem).static final shortFont-relative length (rex).static final shortFont-relative length (ric).static final shortFont-relative length (rlh).static final shortTime (s).static final shortAngle (turn).static final shortViewport-percentage length (vb).static final shortViewport-percentage length (vh).static final shortViewport-percentage length (vi).static final shortViewport-percentage length (vmax).static final shortViewport-percentage length (vmin).static final shortViewport-percentage length (vw). -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic StringdimensionUnitString(short unitType) Gives the dimension unit string associated to the given CSS unit type.static booleanisAngleUnitType(short unitType) Check whether the given unit is an angle.static booleanisLengthUnitType(short unitType) Check whether the given unit is a length.static booleanisRelativeLengthUnitType(short unitType) Check whether the given unit is a relative length.static booleanisResolutionUnitType(short unitType) Check whether the given unit is a resolution unit.static booleanisTimeUnitType(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 aCSSUnitone.
-