diff options
-rw-r--r-- | src/css/render.nim | 44 | ||||
-rw-r--r-- | test/layout/visibility-inline-child.expected | 1 | ||||
-rw-r--r-- | test/layout/visibility-inline-child.html | 4 |
3 files changed, 28 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() diff --git a/test/layout/visibility-inline-child.expected b/test/layout/visibility-inline-child.expected new file mode 100644 index 00000000..4359b247 --- /dev/null +++ b/test/layout/visibility-inline-child.expected @@ -0,0 +1 @@ + visible diff --git a/test/layout/visibility-inline-child.html b/test/layout/visibility-inline-child.html new file mode 100644 index 00000000..f4849ab4 --- /dev/null +++ b/test/layout/visibility-inline-child.html @@ -0,0 +1,4 @@ +<span><span style="visibility: hidden">hidden +<div style="display: inline-block"> +<div style="visibility: visible"> +visible |