nehan
Version:
Html layout engine for paged-media written in Typescript
46 lines • 2.33 kB
JavaScript
import { LogicalPos, LogicalSize, Display, Position, WritingMode, Font, Color, LogicalBoxEdge, LogicalFloat, LogicalTextAlign, LogicalVerticalAlign, LogicalBackgroundPos, TextCombineUpright, TextOrientation, TextEmphasis, OverflowWrap, WordBreak, Content, ListStyle, WhiteSpace, PageBreakBefore, PageBreakAfter, BorderCollapse, CssLoader, } from "./public-api";
export class BoxEnv {
constructor(element) {
this.element = element;
this.color = Color.load(element);
this.measure = LogicalSize.loadMeasure(element);
this.extent = LogicalSize.loadExtent(element);
this.float = LogicalFloat.load(element);
this.display = this.loadDisplay(element);
this.position = Position.load(element);
this.absPos = LogicalPos.load(element);
this.writingMode = WritingMode.load(element);
this.font = Font.load(element);
this.edge = this.loadEdge(element, this.display);
this.verticalAlign = LogicalVerticalAlign.load(element);
this.textAlign = LogicalTextAlign.load(element);
this.textCombineUpright = TextCombineUpright.load(element);
this.textOrientation = TextOrientation.load(element);
this.textEmphasis = TextEmphasis.load(element);
this.overflowWrap = OverflowWrap.load(element);
this.wordBreak = WordBreak.load(element);
this.content = Content.load(element);
this.listStyle = ListStyle.load(element);
this.whiteSpace = WhiteSpace.load(element);
this.pageBreakBefore = PageBreakBefore.load(element);
this.pageBreakAfter = PageBreakAfter.load(element);
this.backgroundPos = LogicalBackgroundPos.load(element);
this.borderCollapse = BorderCollapse.load(element);
}
loadDisplay(element) {
const display = Display.load(element);
if (element.tagName === "a" && display.isInlineLevel()) {
const firstElement = element.firstElementChild;
if (!firstElement) {
return display;
}
CssLoader.load(firstElement);
return Display.load(firstElement);
}
return display;
}
loadEdge(element, display) {
return display.isNone() ? LogicalBoxEdge.none : LogicalBoxEdge.load(element);
}
}
//# sourceMappingURL=box-env.js.map