about summary refs log tree commit diff stats
path: root/src/css
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-11-20 17:36:21 +0100
committerbptato <nincsnevem662@gmail.com>2022-11-20 17:36:21 +0100
commit7d6c75e4c737e51f997f2ac02001fad1a5627ca2 (patch)
treef315fb6e576e1b68e254be26d30d61473c91b3c8 /src/css
parent06fbb9bc967e11151fdd1311437248cf9bc25706 (diff)
downloadchawan-7d6c75e4c737e51f997f2ac02001fad1a5627ca2.tar.gz
Terminal refactorings
Diffstat (limited to 'src/css')
-rw-r--r--src/css/values.nim36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/css/values.nim b/src/css/values.nim
index f323ba8b..249bfa37 100644
--- a/src/css/values.nim
+++ b/src/css/values.nim
@@ -4,7 +4,7 @@ import strutils
 
 import css/cssparser
 import css/selectorparser
-import io/term
+import io/window
 import types/color
 import utils/twtstr
 
@@ -247,26 +247,26 @@ macro `{}=`*(vals: CSSComputedValues, s: string, v: typed): untyped =
 func inherited(t: CSSPropertyType): bool =
   return InheritedArray[t]
 
-func em_to_px(em: float64, term: TermAttributes): int =
-  int(em * float64(term.ppl))
+func em_to_px(em: float64, window: WindowAttributes): int =
+  int(em * float64(window.ppl))
 
-func ch_to_px(ch: float64, term: TermAttributes): int =
-  int(ch * float64(term.ppc))
+func ch_to_px(ch: float64, window: WindowAttributes): int =
+  int(ch * float64(window.ppc))
 
 # 水 width, we assume it's 2 chars
-func ic_to_px(ic: float64, term: TermAttributes): int =
-  int(ic * float64(term.ppc) * 2)
+func ic_to_px(ic: float64, window: WindowAttributes): int =
+  int(ic * float64(window.ppc) * 2)
 
 # x-letter height, we assume it's em/2
-func ex_to_px(ex: float64, term: TermAttributes): int =
-  int(ex * float64(term.ppc) / 2)
+func ex_to_px(ex: float64, window: WindowAttributes): int =
+  int(ex * float64(window.ppc) / 2)
 
-func px*(l: CSSLength, term: TermAttributes, p: int): int {.inline.} =
+func px*(l: CSSLength, window: WindowAttributes, p: int): int {.inline.} =
   case l.unit
-  of UNIT_EM, UNIT_REM: em_to_px(l.num, term)
-  of UNIT_CH: ch_to_px(l.num, term)
-  of UNIT_IC: ic_to_px(l.num, term)
-  of UNIT_EX: ex_to_px(l.num, term)
+  of UNIT_EM, UNIT_REM: em_to_px(l.num, window)
+  of UNIT_CH: ch_to_px(l.num, window)
+  of UNIT_IC: ic_to_px(l.num, window)
+  of UNIT_EX: ex_to_px(l.num, window)
   of UNIT_PERC: int(p / 100 * l.num)
   of UNIT_PX: int(l.num)
   of UNIT_CM: int(l.num * 37.8)
@@ -274,10 +274,10 @@ func px*(l: CSSLength, term: TermAttributes, p: int): int {.inline.} =
   of UNIT_IN: int(l.num * 96)
   of UNIT_PC: int(l.num * 96 / 6)
   of UNIT_PT: int(l.num * 96 / 72)
-  of UNIT_VW: int(term.width_px / 100 * l.num)
-  of UNIT_VH: int(term.height_px / 100 * l.num)
-  of UNIT_VMIN: int(min(term.width_px, term.width_px) / 100 * l.num)
-  of UNIT_VMAX: int(max(term.width_px, term.width_px) / 100 * l.num)
+  of UNIT_VW: int(window.width_px / 100 * l.num)
+  of UNIT_VH: int(window.height_px / 100 * l.num)
+  of UNIT_VMIN: int(min(window.width_px, window.width_px) / 100 * l.num)
+  of UNIT_VMAX: int(max(window.width_px, window.width_px) / 100 * l.num)
 
 func listMarker*(t: CSSListStyleType, i: int): string =
   case t