From 96d3d12445c9a2e3bb00c0c242bdec6d37b11084 Mon Sep 17 00:00:00 2001 From: bptato Date: Sat, 29 Jun 2024 20:35:11 +0200 Subject: cascade: support align=left, align=right on img --- src/css/cascade.nim | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/css/cascade.nim b/src/css/cascade.nim index f39a335c..bfb5b172 100644 --- a/src/css/cascade.nim +++ b/src/css/cascade.nim @@ -152,10 +152,18 @@ func calcPresentationalHints(element: Element): CSSComputedValues = of "center", "middle": set_cv "text-align", TextAlignChaCenter of "left": set_cv "text-align", TextAlignChaLeft of "right": set_cv "text-align", TextAlignChaRight + template map_img_align = + case element.attr(satAlign).toLowerAscii() + of "left": + set_cv "float", FloatLeft + set_cv "display", DisplayBlock + of "right": + set_cv "float", FloatRight + set_cv "display", DisplayBlock template map_table_align = case element.attr(satAlign).toLowerAscii() of "left": - set_cv "float", FloatLeft + set_cv "float", FloatLeft of "right": set_cv "float", FloatRight of "center": @@ -229,7 +237,11 @@ func calcPresentationalHints(element: Element): CSSComputedValues = map_align of TAG_COL: map_width - of TAG_IMG, TAG_CANVAS: + of TAG_IMG: + map_width + map_height + map_img_align + of TAG_CANVAS: map_width map_height of TAG_HTML: -- cgit 1.4.1-2-gfad0