diff options
author | bptato <nincsnevem662@gmail.com> | 2025-01-29 19:39:31 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2025-01-29 19:45:06 +0100 |
commit | dfb3453b3c1220f0efa50aff8d57c27da86a543f (patch) | |
tree | e1c3df46c6b5a3d84524e8b8e5e8a0d720c18ee8 /src | |
parent | 95cafdfbed807053325cdf08027e45256356106f (diff) | |
download | chawan-dfb3453b3c1220f0efa50aff8d57c27da86a543f.tar.gz |
render: fix OOB panic with scroll container outside the canvas
clipBox must not be allowed to start outside the canvas, or paintBackground will happily try to setTextStr in a negative position.
Diffstat (limited to 'src')
-rw-r--r-- | src/css/render.nim | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/css/render.nim b/src/css/render.nim index 4d86c73c..e7cd3595 100644 --- a/src/css/render.nim +++ b/src/css/render.nim @@ -456,7 +456,7 @@ proc renderBlockBox(grid: var FlexibleGrid; state: var RenderState; clipBox.start.x = max(offset.x, clipBox.start.x) clipBox.send.x = min(offset.x + box.state.size.w, clipBox.send.x) else: # scroll like - clipBox.start.x = min(offset.x, clipBox.start.x) + clipBox.start.x = max(min(offset.x, clipBox.start.x), 0) clipBox.send.x = max(offset.x + box.state.size.w, clipBox.start.x) if overflowY in OverflowHiddenLike: clipBox.start.y = max(offset.y, clipBox.start.y) |