resolveLineHeight static method

CSSLengthValue? resolveLineHeight(
  1. String value,
  2. RenderStyle renderStyle,
  3. String propertyName
)

Implementation

static CSSLengthValue? resolveLineHeight(String value, RenderStyle renderStyle, String propertyName) {
  if (value.isNotEmpty) {
    if (CSSLength.isNonNegativeLength(value) || CSSPercentage.isNonNegativePercentage(value)) {
      CSSLengthValue lineHeight = CSSLength.parseLength(value, renderStyle, propertyName);
      // Line-height 0 and negative value is considered invalid.
      if (lineHeight.computedValue != double.infinity && lineHeight.computedValue > 0) {
        return lineHeight;
      }
    } else if (value == NORMAL) {
      return CSSLengthValue.normal;
    } else if (CSSNumber.isNumber(value)){
      double? multipliedNumber = double.tryParse(value);
      if (multipliedNumber != null) {
        return CSSLengthValue(multipliedNumber, CSSLengthType.EM, renderStyle, propertyName);
      }
    }
  }
}