nehan
Version:
Html layout engine for paged-media written in Typescript
31 lines • 1.04 kB
JavaScript
import { Utils, CssCascade, } from "./public-api";
export class LogicalPos {
constructor(value) {
this.before = value.before;
this.end = value.end;
this.after = value.after;
this.start = value.start;
}
static load(element) {
let value = {};
value.before = this.loadEach(element, "before");
value.end = this.loadEach(element, "end");
value.after = this.loadEach(element, "after");
value.start = this.loadEach(element, "start");
return new LogicalPos(value);
}
static loadEach(element, prop) {
let value = CssCascade.getValue(element, prop);
return (value === "auto") ? undefined : Utils.atoi(value, 10);
}
hasValue() {
return (this.before !== undefined ||
this.end !== undefined ||
this.after !== undefined ||
this.start !== undefined);
}
acceptCssEvaluator(visitor) {
return visitor.visitLogicalPos(this);
}
}
//# sourceMappingURL=logical-pos.js.map