box-sizing.js 1.3 KB

123456789101112131415161718192021
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.contentBox = exports.paddingBox = void 0;
  4. var length_percentage_1 = require("../css/types/length-percentage");
  5. var paddingBox = function (element) {
  6. var bounds = element.bounds;
  7. var styles = element.styles;
  8. return bounds.add(styles.borderLeftWidth, styles.borderTopWidth, -(styles.borderRightWidth + styles.borderLeftWidth), -(styles.borderTopWidth + styles.borderBottomWidth));
  9. };
  10. exports.paddingBox = paddingBox;
  11. var contentBox = function (element) {
  12. var styles = element.styles;
  13. var bounds = element.bounds;
  14. var paddingLeft = length_percentage_1.getAbsoluteValue(styles.paddingLeft, bounds.width);
  15. var paddingRight = length_percentage_1.getAbsoluteValue(styles.paddingRight, bounds.width);
  16. var paddingTop = length_percentage_1.getAbsoluteValue(styles.paddingTop, bounds.width);
  17. var paddingBottom = length_percentage_1.getAbsoluteValue(styles.paddingBottom, bounds.width);
  18. return bounds.add(paddingLeft + styles.borderLeftWidth, paddingTop + styles.borderTopWidth, -(styles.borderRightWidth + styles.borderLeftWidth + paddingLeft + paddingRight), -(styles.borderTopWidth + styles.borderBottomWidth + paddingTop + paddingBottom));
  19. };
  20. exports.contentBox = contentBox;
  21. //# sourceMappingURL=box-sizing.js.map