diff options
author | bptato <nincsnevem662@gmail.com> | 2023-01-02 21:19:46 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-01-02 21:19:46 +0100 |
commit | 62983cdc609aacc47ade0a8a4a4c6b85dd26199a (patch) | |
tree | ab0518ac0f556a499107887fb524beddb80ba104 /src/css | |
parent | f2bf1572456412f109d06c6a49e34cfbe924bbfa (diff) | |
download | chawan-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.nim | 6 |
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 |