resolveFontSize static method

CSSLengthValue resolveFontSize(
  1. String fontSize,
  2. RenderStyle renderStyle,
  3. String propertyName
)

Implementation

static CSSLengthValue resolveFontSize(String fontSize, RenderStyle renderStyle, String propertyName) {
  switch (fontSize) {
    case 'xx-small':
      return CSSLengthValue(3 / 5 * 16, CSSLengthType.PX);
    case 'x-small':
      return CSSLengthValue(3 / 4 * 16, CSSLengthType.PX);
    case 'small':
      return CSSLengthValue(8 / 9 * 16, CSSLengthType.PX);
    case 'medium':
      return CSSLengthValue(16, CSSLengthType.PX);
    case 'large':
      return CSSLengthValue(6 / 5 * 16, CSSLengthType.PX);
    case 'x-large':
      return CSSLengthValue(3 / 2 * 16, CSSLengthType.PX);
    case 'xx-large':
      return CSSLengthValue(2 / 1 * 16, CSSLengthType.PX);
    case 'xxx-large':
      return CSSLengthValue(3 / 1 * 16, CSSLengthType.PX);
    case 'smaller':
      return CSSLengthValue(5 / 6, CSSLengthType.EM, renderStyle, propertyName);
    case 'larger':
      return CSSLengthValue(6 / 5, CSSLengthType.EM, renderStyle, propertyName);
    default:
      return CSSLength.parseLength(fontSize, renderStyle, propertyName);
  }
}