aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2025-01-09 20:58:21 +0100
committerbptato <nincsnevem662@gmail.com>2025-01-09 21:31:10 +0100
commitf269971cc52f534f1deeceb5cfb0049dee4dcc93 (patch)
tree818ea1b10e277bef60d257b171a20df965c519fa /src
parent8c769fc302a04737f1060fdcc0fab16a733d94c9 (diff)
downloadchawan-f269971cc52f534f1deeceb5cfb0049dee4dcc93.tar.gz
ua.css: improve select rendering
Regular select is now rendered as flex, and does not wrap. This gets rid of the pointless whitespace before/after options. multiple still looks weird, but maybe a bit less? Probably we should just render it with pseudo-checkboxes, and drop the special mode from select.nim.
Diffstat (limited to 'src')
-rw-r--r--src/css/cascade.nim5
-rw-r--r--src/local/container.nim4
2 files changed, 7 insertions, 2 deletions
diff --git a/src/css/cascade.nim b/src/css/cascade.nim
index 2bcff009..273a344c 100644
--- a/src/css/cascade.nim
+++ b/src/css/cascade.nim
@@ -176,6 +176,11 @@ proc applyPresHints(computed: CSSValues; element: Element;
let input = HTMLInputElement(element)
if input.inputType in InputTypeWithSize:
map_size
+ of TAG_SELECT:
+ let select = HTMLSelectElement(element)
+ if select.attrb(satMultiple):
+ let size = element.attrulgz(satSize).get(4)
+ set_cv cptHeight, length, resolveLength(cuEm, float64(size), attrs)
else: discard
type
diff --git a/src/local/container.nim b/src/local/container.nim
index abd9bbf0..7ba1a4bf 100644
--- a/src/local/container.nim
+++ b/src/local/container.nim
@@ -1600,8 +1600,8 @@ proc displaySelect(container: Container; selectResult: SelectResult) =
selectResult.multiple,
selectResult.options,
selectResult.selected,
- container.acursorx,
- container.acursory,
+ max(container.acursorx - 1, 0),
+ max(container.acursory - 1, 0),
container.width,
container.height,
selectFinish,