line-height.js 876 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.computeLineHeight = exports.lineHeight = void 0;
  4. var parser_1 = require("../syntax/parser");
  5. var length_percentage_1 = require("../types/length-percentage");
  6. exports.lineHeight = {
  7. name: 'line-height',
  8. initialValue: 'normal',
  9. prefix: false,
  10. type: 4 /* TOKEN_VALUE */
  11. };
  12. var computeLineHeight = function (token, fontSize) {
  13. if (parser_1.isIdentToken(token) && token.value === 'normal') {
  14. return 1.2 * fontSize;
  15. }
  16. else if (token.type === 17 /* NUMBER_TOKEN */) {
  17. return fontSize * token.number;
  18. }
  19. else if (length_percentage_1.isLengthPercentage(token)) {
  20. return length_percentage_1.getAbsoluteValue(token, fontSize);
  21. }
  22. return fontSize;
  23. };
  24. exports.computeLineHeight = computeLineHeight;
  25. //# sourceMappingURL=line-height.js.map