Re: [csswg-drafts] [css-values] if() function (#3455)

> as long as width is the viewport width.

Yes, because viewport width can't be specified (in `em`s or any other unit!), so there's no dependency to worry about. ^_^ I was referring to the width of an element in my comment (because that's the sort of thing *you* were referring to in your examples).

> Has there ever been a proposal / consideration of being able to define units, or capture values at a certain stage? That would maybe take CSS authors halfway. [snip example]

There've been proposals, but inserting dependencies between elements in *layout* is just as fraught as dependencies between properties in the cascade.  We very carefully design the layout algorithms to be solvable based on specific pieces of layout information being passed up and down the tree; if arbitrary layout information can move around the tree and influence other properties, we suddenly have a vastly more complicated situation to deal with. In the limit (which you hit pretty much immediately), we have to abandon the layout algorithms as written completely, and instead rephrase everything in terms of a constraint solver, letting the arbitrary new layout dependencies introduced by the author just fall out as they may.  Arbitrary constraint solvers are, unfortunately, much slower in the general case than the layout algorithms are, so doing so would slow down all pages as well.


-------

Tangent: be careful with your units invention - [`ch` is *already* a valid unit](https://drafts.csswg.org/css-values/#ch), so I was really confused by your example for a while. ^_^

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

Received on Friday, 21 December 2018 00:48:28 UTC