diff options
author | bptato <nincsnevem662@gmail.com> | 2022-06-18 12:53:07 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-06-18 12:53:07 +0200 |
commit | 71b19f37d09d0bb8eb18468b4c3dd40e9f9c7dca (patch) | |
tree | e48f81de8477da2a0a31883ad18dbc54cd451072 /src | |
parent | 36064a80eb40320621c971fb21818aa1b3de4945 (diff) | |
download | chawan-71b19f37d09d0bb8eb18468b4c3dd40e9f9c7dca.tar.gz |
Apply inline dimensions for inline blocks too
Diffstat (limited to 'src')
-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] |