-
Notifications
You must be signed in to change notification settings - Fork 759
Open
Description
It seems hard for a viewport to have a degenerate ratio, so I guess @media (aspect-ratio) is mostly fine. But we have a problem for @container (aspect-ratio), there is no interoperability. Testcase
First, how should aspect-ratio be evaluated in boolean context?
Typically that checks if the condition is true for any non-zero value. Is that 0 / 1 for ratios? I'm not convinced this makes much sense, one of these options seems better:
- Check if any ratio would evaluate to true
- Check if any ratio different than
0 / 0would evaluate to true - Check if any non-degenerate ratio would evaluate to true
Also, how to compare ratios?
I think we could say 0/a = 0/b < c/d = e/f < g/0 = h/0 for any a,b,c,d,e,f,g,h > 0 s.t. c*f = d*e.
Then the tricky part is comparing with 0 / 0.
Some proposals:
- We consider ratios in the [0,∞] interval, plus a special 0/0 value outside the interval. Strict inequalities between 0/0 and other ratios are false.
- We consider ratios in the [0,∞] interval, with 0/0 being an indeterminate value in the interval. Most comparisons with 0/0 are unknown, but some inequalities with the limits of the interval are known.
- Like 1 or 2, but using unknown for ratios that are not comparable, i.e. when none of =, < and > would be true.
- Like 3, but using unknown when comparing a degenerate ratio with itself.
I think I'm leaning towards the 1st one.
Some notes from the implemented behaviors that I have observed:
- Evaluating
min-aspect-ratioandmax-aspect-ratioin a boolean context produces unknown as defined in the spec. aspect-ratio: <ratio>is a synonym ofaspect-ratio = <ratio>,min-aspect-ratio: <ratio>is a synonym ofaspect-ratio >= <ratio>, andmax-aspect-ratio: <ratio>is a synonym ofaspect-ratio <= <ratio>.- Ratios are broken in Blink, e.g.
1and1 / 1have different behaviors, same for0and0 / 1.
tbjgolden and bleper
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Needs Edits
