about summary refs log tree commit diff stats
path: root/src/css
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-01-02 21:19:46 +0100
committerbptato <nincsnevem662@gmail.com>2023-01-02 21:19:46 +0100
commit62983cdc609aacc47ade0a8a4a4c6b85dd26199a (patch)
treeab0518ac0f556a499107887fb524beddb80ba104 /src/css
parentf2bf1572456412f109d06c6a49e34cfbe924bbfa (diff)
downloadchawan-62983cdc609aacc47ade0a8a4a4c6b85dd26199a.tar.gz
dom: add better attribute reflection
Instead of creating a new function for each attribute, use a single
magic function for reflected attributes.
Diffstat (limited to 'src/css')
-rw-r--r--src/css/cascade.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/css/cascade.nim b/src/css/cascade.nim
index acf2ddf4..68b9ebee 100644
--- a/src/css/cascade.nim
+++ b/src/css/cascade.nim
@@ -160,8 +160,10 @@ func calcPresentationalHints(element: Element): CSSComputedValues =
     map_text
   of TAG_TEXTAREA:
     let textarea = HTMLTextAreaElement(element)
-    set_cv "width", CSSLength(unit: UNIT_CH, num: float64(textarea.cols))
-    set_cv "height", CSSLength(unit: UNIT_EM, num: float64(textarea.rows))
+    let cols = textarea.attri("cols").get(20)
+    let rows = textarea.attri("rows").get(1)
+    set_cv "width", CSSLength(unit: UNIT_CH, num: float64(cols))
+    set_cv "height", CSSLength(unit: UNIT_EM, num: float64(rows))
   of TAG_FONT:
     map_color
   else: discard