diff options
| author | bptato <nincsnevem662@gmail.com> | 2024-03-01 14:01:10 +0100 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2024-03-01 14:01:10 +0100 |
| commit | e0574a00c2c001671be825e55fecb741238b438b (patch) | |
| tree | b2d534c451324297c8c1029b6a40096051b505b8 /src | |
| parent | 87ba9a87be15abbe06837f1519cfb76f4bf759f3 (diff) | |
| download | chawan-e0574a00c2c001671be825e55fecb741238b438b.tar.gz | |
css: remove caption-side: left, right, fix caption-side: bottom
left/right never really worked correctly, is non-standard, and the
only browser that supported it (Firefox) removed it years ago.
bottom was adding the table width to its offset instead of the height,
that is now fixed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/css/values.nim | 9 | ||||
| -rw-r--r-- | src/layout/engine.nim | 17 |
2 files changed, 3 insertions, 23 deletions
diff --git a/src/css/values.nim b/src/css/values.nim index 88a5df34..47919aee 100644 --- a/src/css/values.nim +++ b/src/css/values.nim @@ -107,9 +107,8 @@ type LIST_STYLE_POSITION_OUTSIDE, LIST_STYLE_POSITION_INSIDE CSSCaptionSide* = enum - CAPTION_SIDE_TOP, CAPTION_SIDE_BOTTOM, CAPTION_SIDE_LEFT, - CAPTION_SIDE_RIGHT, CAPTION_SIDE_BLOCK_START, CAPTION_SIDE_BLOCK_END, - CAPTION_SIDE_INLINE_START, CAPTION_SIDE_INLINE_END + CAPTION_SIDE_TOP, CAPTION_SIDE_BOTTOM, CAPTION_SIDE_BLOCK_START, + CAPTION_SIDE_BLOCK_END, CSSBorderCollapse* = enum BORDER_COLLAPSE_SEPARATE, BORDER_COLLAPSE_COLLAPSE @@ -1025,12 +1024,8 @@ func cssCaptionSide(cval: CSSComponentValue): Opt[CSSCaptionSide] = const CaptionSideMap = { "top": CAPTION_SIDE_TOP, "bottom": CAPTION_SIDE_BOTTOM, - "left": CAPTION_SIDE_LEFT, - "right": CAPTION_SIDE_RIGHT, "block-start": CAPTION_SIDE_BLOCK_START, "block-end": CAPTION_SIDE_BLOCK_END, - "inline-start": CAPTION_SIDE_INLINE_START, - "inline-end": CAPTION_SIDE_INLINE_END } return cssIdent(CaptionSideMap, cval) diff --git a/src/layout/engine.nim b/src/layout/engine.nim index c0b29e5e..7e65bac6 100644 --- a/src/layout/engine.nim +++ b/src/layout/engine.nim @@ -2028,25 +2028,10 @@ proc addTableCaption(ctx: TableContext, table: BlockBox, of CAPTION_SIDE_BOTTOM, CAPTION_SIDE_BLOCK_END: let caption = lctx.buildTableCaption(ctx.caption, stretch(table.size.w), maxContent()) - caption.offset.y += table.size.w + caption.offset.y += table.size.h table.nested.add(caption) table.size.h += caption.size.h table.size.w = max(table.size.w, caption.size.w) - of CAPTION_SIDE_LEFT, CAPTION_SIDE_INLINE_START: - let caption = lctx.buildTableCaption(ctx.caption, - fitContent(sizes.space.w), fitContent(table.size.h)) - for r in table.nested: - r.offset.x += caption.size.w - table.nested.insert(caption, 0) - table.size.w += caption.size.w - table.size.h = max(table.size.h, caption.size.h) - of CAPTION_SIDE_RIGHT, CAPTION_SIDE_INLINE_END: - let caption = lctx.buildTableCaption(ctx.caption, - fitContent(sizes.space.w), fitContent(table.size.h)) - caption.offset.x += table.size.w - table.nested.add(caption) - table.size.w += caption.size.w - table.size.h = max(table.size.h, caption.size.h) # Table layout. We try to emulate w3m's behavior here: # 1. Calculate minimum and preferred width of each column |