Implement CSS Values Level 4 Mathematical Functions |
|||
Issue description<b>Chrome Version : <Copy from: 'about:version'></b> URLs (if applicable) : https://github.com/whatwg/html/pull/3084 Other browsers tested: Apple is implementing presently, according to Tab Currently Chromium supports `calc()` as a CSS mathematical function. The CSS Values and Units Level 4 Specification describes a list of math functions [1] consisting of `calc()` in addition to `min()` and `max()`. Apple has started implementing this. This motivation for opening this bug is the recent reference to the aforementioned mathematical functions in the HTML Standard [2], which supports the appearance of mathematical functions in the `sizes` attribute on <img> elements. [1]: https://drafts.csswg.org/css-values/#math-function [2]: https://github.com/whatwg/html/pull/3084 & https://github.com/w3c/web-platform-tests/pull/10167
,
Mar 26 2018
Ok, makes sense; that's what I was thinking but wasn't sure the best way to allocate the components.
,
Mar 27 2018
https://developers.google.com/web/updates/2018/03/cssom#CSSUnitValue CSS Typed Object Model support `min()` and `max()` ? >> new CSSMathMax(CSS.percent(80), CSS.px(12)).toString(); // "max(80%, 12px)"
,
Mar 27 2018
Hmm, if I understand you correctly, that's not what my intention was with this issue. My intention was to file a bug to catalyze the implementation of `min()` and `max()` mathematical functions described in the spec; for example:
`div { width: min(100%, 800px); }`
Or better yet (and the motivation behind this issue):
`<img srcset="..." sizes="max(40%, 300px)"`.
Hopefully that makes sense.
,
Apr 4 2018
,
Apr 5 2018
Of course 594mantou@gmail.com, that should indeed translate to the typed OM you mention, but I'm assuming the underlying CSS functions (that eventually get exposed to the typed OM) will need implemented and that's the primary purpose of this issue.
,
Oct 25
Mobile safari has min() and max() and webkit's example page for dealing with notches uses it: https://webkit.org/blog/7929/designing-websites-for-iphone-x/ ...only to find that chrome hasn't gotten around to it yet, so I have to try to find some other solution. I can't seem to get the values of css custom properties from javascript when they're inside shadowRoots either :/ (I was hoping to be able to use Math.max(), but no joy).
,
Nov 8
Can I suggest that this issue should have a higher priority?
I am struggling to find a way to do something like this:
padding-left: max(env(safe-area-inset-left), var(--padding-left));
It's also stopping me from using max() for iPhone too, though I should probably use the method in the above blog:
@supports(padding: max(0px)) {
Is there some way of doing this on Chrome that I'm missing?
,
Dec 12
+tabatkins@, as I'm not exactly sure who this might fall under implementation-wise, and what the priority of it should be. |
|||
►
Sign in to add a comment |
|||
Comment 1 by schenney@chromium.org
, Mar 26 2018