diff options
author | bptato <nincsnevem662@gmail.com> | 2024-06-29 01:35:27 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-06-29 01:36:23 +0200 |
commit | e7786e39e38ddf5ec75b95cc19e1bee108cd37d2 (patch) | |
tree | 883ae78b9ba24bf487ddeeba7bebf9af68cc9f36 /src | |
parent | 1ecddcefe61103846aa1a3fcbaa11178aa7a2ec1 (diff) | |
download | chawan-e7786e39e38ddf5ec75b95cc19e1bee108cd37d2.tar.gz |
layout: fix image baseline
I doubt this is correct, but at least it's less broken than previously
Diffstat (limited to 'src')
-rw-r--r-- | src/layout/engine.nim | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim index c01ef61e..f0513644 100644 --- a/src/layout/engine.nim +++ b/src/layout/engine.nim @@ -1372,15 +1372,10 @@ proc addInlineBlock(ictx: var InlineContext; state: var InlineState; proc addInlineImage(ictx: var InlineContext; state: var InlineState; bmp: Bitmap; padding: LayoutUnit) = - let h = int(bmp.height).toLayoutUnit().ceilTo(ictx.cellHeight) - let iastate = InlineAtomState( - vertalign: state.fragment.computed{"vertical-align"}, - baseline: h - ) let atom = InlineAtom( t: iatImage, bmp: bmp, - size: size(w = int(bmp.width), h = h), #TODO overflow + size: size(w = int(bmp.width), h = int(bmp.height)), #TODO overflow ) let computed = state.fragment.computed let lctx = ictx.lctx @@ -1396,6 +1391,10 @@ proc addInlineImage(ictx: var InlineContext; state: var InlineState; # maintain aspect ratio atom.size.w = atom.size.w div atom.size.h * h atom.size.h = h + let iastate = InlineAtomState( + vertalign: state.fragment.computed{"vertical-align"}, + baseline: atom.size.h + ) discard ictx.addAtom(state, iastate, atom) func calcLineHeight(computed: CSSComputedValues; lctx: LayoutContext): |