From ce95d6c7648c17885daba80b042b36d800e89b34 Mon Sep 17 00:00:00 2001 From: bptato Date: Sat, 2 Mar 2024 04:00:16 +0100 Subject: layout: fix float exclusion of other floats > The right outer edge of a left-floating box may not be to the right > of the left outer edge of any right-floating box that is next to > it. Analogous rules hold for right-floating elements. says the standard therefore it does not really matter where the beginning of the float is; if it's float: left, then `left' must be set to the right edge, and if it's float: right, then `right' must be set to the left edge. (this was breaking some negative margin float abominations such that floats were suddenly overlapping and that's certainly not what we want) --- src/layout/engine.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/layout') diff --git a/src/layout/engine.nim b/src/layout/engine.nim index 7e65bac6..28ade1c5 100644 --- a/src/layout/engine.nim +++ b/src/layout/engine.nim @@ -1229,9 +1229,9 @@ func findNextFloatOffset(bctx: BlockContext, offset: Offset, size: Size, let ey2 = ex.offset.y + ex.size.h if cy2 >= ex.offset.y and y < ey2: let ex2 = ex.offset.x + ex.size.w - if left + size.w >= ex.offset.x and left < ex2: + if ex.t == FLOAT_LEFT and left < ex2: left = ex2 - if right + size.w > ex.offset.x and right <= ex2: + if ex.t == FLOAT_RIGHT and right > ex.offset.x: right = ex.offset.x miny = min(ey2, miny) if right - left >= size.w or miny == high(LayoutUnit): -- cgit 1.4.1-2-gfad0