box-sizing.js 1.2 KB

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