about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-06-29 20:35:11 +0200
committerbptato <nincsnevem662@gmail.com>2024-06-29 20:35:11 +0200
commit96d3d12445c9a2e3bb00c0c242bdec6d37b11084 (patch)
treec404b2f3cc84ef706c82a7ba5f7403fd7d6593c5
parent29983d266000941606f5a51090268953bc0ab19f (diff)
downloadchawan-96d3d12445c9a2e3bb00c0c242bdec6d37b11084.tar.gz
cascade: support align=left, align=right on img
-rw-r--r--src/css/cascade.nim16
1 files 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: