about summary refs log tree commit diff stats
path: root/src/css
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-07-27 19:14:56 +0200
committerbptato <nincsnevem662@gmail.com>2024-07-27 19:14:56 +0200
commit0e7475d302ee27024db978822c3747c3afb638c9 (patch)
tree97ab7319580e25702d13cc20a1a390e843770f4b /src/css
parentb1a01e172232d66c5dee061931fb6b14159862d2 (diff)
downloadchawan-0e7475d302ee27024db978822c3747c3afb638c9.tar.gz
cascade: add some presentational hints
* top/middle/bottom for img, remove redundant display: block for floats
  (they get blockified anyway)
* map align for p too, not just div
Diffstat (limited to 'src/css')
-rw-r--r--src/css/cascade.nim10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/css/cascade.nim b/src/css/cascade.nim
index bfe36c7b..149ce4f0 100644
--- a/src/css/cascade.nim
+++ b/src/css/cascade.nim
@@ -156,10 +156,14 @@ func calcPresentationalHints(element: Element): CSSComputedValues =
     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
+    of "top":
+      set_cv "vertical-align", CSSVerticalAlign(keyword: VerticalAlignTop)
+    of "middle":
+      set_cv "vertical-align", CSSVerticalAlign(keyword: VerticalAlignMiddle)
+    of "bottom":
+      set_cv "vertical-align", CSSVerticalAlign(keyword: VerticalAlignBottom)
   template map_table_align =
     case element.attr(satAlign).toLowerAscii()
     of "left":
@@ -215,7 +219,7 @@ func calcPresentationalHints(element: Element): CSSComputedValues =
     set_cv "-cha-bgcolor-is-canvas", true
 
   case element.tagType
-  of TAG_DIV:
+  of TAG_DIV, TAG_P:
     map_align
   of TAG_TABLE:
     map_height_nozero