diff options
Diffstat (limited to 'src/layout/engine.nim')
-rw-r--r-- | src/layout/engine.nim | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim index fc9d14db..630f1e36 100644 --- a/src/layout/engine.nim +++ b/src/layout/engine.nim @@ -464,6 +464,12 @@ proc buildBlock(box: BlockBoxBuilder, parent: BlockContext, selfcontained = fals proc buildInlines(bctx: BlockContext, inlines: seq[BoxBuilder]): InlineContext proc buildBlocks(bctx: BlockContext, blocks: seq[BoxBuilder], node: Node) +proc applyInlineDimensions(bctx: BlockContext) = + bctx.height += bctx.inline.height + if bctx.compheight.issome: + bctx.height = bctx.compheight.get + bctx.width = max(bctx.width, bctx.inline.maxwidth) + proc buildInlineBlock(builder: InlineBlockBoxBuilder, parent: InlineContext, parentblock: BlockContext): InlineBlock = assert builder.content != nil result = parentblock.newInlineBlock(builder) @@ -472,6 +478,7 @@ proc buildInlineBlock(builder: InlineBlockBoxBuilder, parent: InlineContext, par if blockbuilder.inlinelayout: # Builder only contains inline boxes. result.bctx.inline = result.bctx.buildInlines(blockbuilder.children) + result.bctx.applyInlineDimensions() result.bctx.positionInlines(false) else: # Builder only contains block boxes. @@ -560,12 +567,6 @@ proc buildInlines(bctx: BlockContext, inlines: seq[BoxBuilder]): InlineContext = return ictx -proc applyInlineDimensions(bctx: BlockContext) = - bctx.height += bctx.inline.height - if bctx.compheight.issome: - bctx.height = bctx.compheight.get - bctx.width = max(bctx.width, bctx.inline.maxwidth) - proc buildListItem(builder: ListItemBoxBuilder, parent: BlockContext, selfcontained = false): ListItem = result = parent.newListItem(builder) var tmp: seq[BoxBuilder] |