line-height.js 946 B

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