diff options
author | bptato <nincsnevem662@gmail.com> | 2024-12-10 19:08:56 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-12-10 19:37:34 +0100 |
commit | 7805af294d8596dfda295bf18ea703202e0569e0 (patch) | |
tree | 9fde75b49bebca6386df472710df8a38fbf28251 /src | |
parent | 42a78d217e900a4240a443d4a18fd22f2afebce1 (diff) | |
download | chawan-7805af294d8596dfda295bf18ea703202e0569e0.tar.gz |
render: apply visibility to inline boxes
Diffstat (limited to 'src')
-rw-r--r-- | src/css/render.nim | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/src/css/render.nim b/src/css/render.nim index d7d57e35..fb96ceb6 100644 --- a/src/css/render.nim +++ b/src/css/render.nim @@ -360,28 +360,30 @@ proc renderInlineFragment(grid: var FlexibleGrid; state: var RenderState; of iatInlineBlock: grid.renderBlockBox(state, atom.innerbox, offset + atom.offset) of iatWord: - grid.setRowWord(state, atom, offset, format, fragment.node) + if fragment.computed{"visibility"} == VisibilityVisible: + grid.setRowWord(state, atom, offset, format, fragment.node) of iatImage: - let x1 = offset.x.toInt - let y1 = offset.y.toInt - let x2 = (offset.x + atom.size.w).toInt - let y2 = (offset.y + atom.size.h).toInt - # "paint" background, i.e. add formatting (but don't actually color it) - grid.paintBackground(state, defaultColor, x1, y1, x2, y2, fragment.node, - noPaint = true) - let x = (offset.x div state.attrs.ppc).toInt - let y = (offset.y div state.attrs.ppl).toInt - let offx = (offset.x - x.toLayoutUnit * state.attrs.ppc).toInt - let offy = (offset.y - y.toLayoutUnit * state.attrs.ppl).toInt - state.images.add(PosBitmap( - x: x, - y: y, - offx: offx, - offy: offy, - width: atom.size.w.toInt, - height: atom.size.h.toInt, - bmp: atom.bmp - )) + if fragment.computed{"visibility"} == VisibilityVisible: + let x1 = offset.x.toInt + let y1 = offset.y.toInt + let x2 = (offset.x + atom.size.w).toInt + let y2 = (offset.y + atom.size.h).toInt + # add StyledNode to background (but don't actually color it) + grid.paintBackground(state, defaultColor, x1, y1, x2, y2, + fragment.node, noPaint = true) + let x = (offset.x div state.attrs.ppc).toInt + let y = (offset.y div state.attrs.ppl).toInt + let offx = (offset.x - x.toLayoutUnit * state.attrs.ppc).toInt + let offy = (offset.y - y.toLayoutUnit * state.attrs.ppl).toInt + state.images.add(PosBitmap( + x: x, + y: y, + offx: offx, + offy: offy, + width: atom.size.w.toInt, + height: atom.size.h.toInt, + bmp: atom.bmp + )) if position notin PositionStaticLike and stSplitEnd in fragment.splitType: discard state.absolutePos.pop() |