Re: [csswg-drafts] [css-values] Add round()/floor()/ceil() functions (#2513)

Hi,

Found this thread while searching for solutions to a problem that seems fairly similar to comment 3. Awesome to see these new functions will eventually make it into my browser.

Firstly, was curious what very rough timeline I'd be looking at in terms of going "oh, <browser> can do that now" :)? IOW, if I were to add a "revisit this" date to my mental calendar, would that be in say 2024, or halfway through 2023, or maybe even late 2022...? Etc. (I appreciate the general separation between spec and implementation (where dates become more concrete), hence the "rough")

Also, after considering the functionality being added, I wondered if these new features may not actually solve for my use-case as implemented. Sometimes my slightly handwavy mental models of certain aspects of CSS leads me down dead ends, but I wonder if the way I interpreted things here may actually be interesting.

I happen to currently have a <canvas> taking up maximal space on one side of a page, with a small legend to the side of it. I wanted the canvas to track the width of the page (with some JS handling internal resizing and repainting on resize) with the legend taking up whatever space it naturally wanted to (size of text plus padding etc). I imagined being able to use these new functions to do something like `round(100%, 1px)`... but then I realized, maybe that wouldn't quite work.

As currently specified.

I find myself hitting the walls of the percentage sizing model semi-frequently, and perhaps I've done that here (I should probably go read it...). I mention this use case in case I haven't gone completely off the deep end (in terms of "there's no semantically sensible spot in the usage model to slot this into"), because if it were reasonable to do this sort of thing (maybe where the percentage has a known size to work with in a parent somewhere?) it would make it possible to have my cake and eat it too: I'd be able to a) have the box model natively size my elements *while* b) locking my canvas' to a non-fractional width and thus eliminate antialiasing and blur.

Now, off to implement some sort of hacky workaround in JS involving leaving a dedicated width for the legend...

-- 
GitHub Notification of comment by exikyut
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2513#issuecomment-993098455 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 14 December 2021 02:32:28 UTC