-
Notifications
You must be signed in to change notification settings - Fork 673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-values-4] Simplification algorithm should possibly return single child for min/max #9559
Comments
You are right (see 56fb598). But I think I remember some discussions about preserving |
Could it be related to #7456? Should the Min node in |
No, this issue is about my misunderstandings (which still hold to this day) regarding the simplification of a Product node, and more generally, about the whole parsing/simplification procedures. I think I was thinking to #4399.
To be honest, I do not know what should be the serialization as a component of a specified value, for |
Did a quick test across browsers to check how they serialize the specified style: Firefox: I'm not sure how important this is though.. |
(Sorry to have temporarily closed the issue, due to a typing error.) Chrome now outputs I was trying to figure out which part of the simplification algo would allow FF to simplify edit Actually, FF should not simplify |
Note that removing a Sum node does not change the functional structure of the value; it just means that you don't have a silly But it does appear that browsers do exactly that simplification now, so I'm fine with making it. (And I'm not really sure why I removed the Min/Max simplification in 56fb598#diff-fc1c32de78d227c8f0c8008469824444d1ba7f027e48a336125017d40b8f6f6fL4283; the minutes in #4399 don't suggest we stop doing that.) |
The CSS Working Group just discussed
The full IRC log of that discussion<fantasai> scribe+<fantasai> TabAtkins: Several years ago, we discussed simplifying calculation trees <fantasai> TabAtkins: we agreed to aggressively simplify, e.g. min() if same units simplifies out <fantasai> TabAtkins: as part of changes, I ended up removing the spec text about min() or max() with single argument <fantasai> TabAtkins: I'm not sure why I dropped that spec text, I suspect it was an accident <fantasai> TabAtkins: today all browsers do aggressively drop single-arg min()/max() <fantasai> TabAtkins: e.g. min(5px) + 10px becomes 15px <fantasai> TabAtkins: Chrome recently also aligned on this behavior <dbaron> +1 to specifying what everyone does, seems like reasonable behavior. <fantasai> TabAtkins: so I suggest we resolve on browser behavior, that single-arg min/max functions can be dropped from calc tree <dbaron> (I think sakhapov recently wrote some reasonably major changes to calc() simplification in Chrome, to align with the spec.) <fantasai> TabAtkins: even if the unit cannot yet be resolved <fantasai> +1 from me <fantasai> RESOLVED: Restore text simplifying out single-arg min/max functions |
As far as I can tell, the reason I removed the explicit "min()/max() is dropped if it has only one child" is that I figured it was covered by the generic "replace a node with its result if you can", and just didn't realize that the restrictions I placed on that clause ("in the canonical unit") would be too restrictive. Anyway, restored now; as part of the special min/max "partial simplification" it'll replace itself with its sole child regardless of whether the child is fully resolveable yet. |
Step 5 for min/max of simplify a calculation tree currently states:
I might miss something, but this seems to simplify the children of the Min or Max node, but if you're left with only one child it seems to return the Min/Max node with a single child.
Should it not return the child in this case? I belive an earlier version of the spec did the same as the step for Sum nodes:
The text was updated successfully, but these errors were encountered: