-
Notifications
You must be signed in to change notification settings - Fork 60
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
Define the fitness distance for all required constrains. #722
Conversation
Booleans are also not covered. |
Would be good to add some tests and see what implementations are doing. |
@guidou Can you add your two cents? |
I think this change is correct (wasn't the spec written this way in the past?), but booleans need to be added to step 6. |
This CL defines the fitness distance also for boolean constraints and for required constrains whose value contains a member named 'ideal' in addition to members named 'exact', 'max' and/or 'min'.
969ce69
to
6952350
Compare
Done. |
I am pretty sure this is inline with what all implementations are doing but it is worth checking. |
Done in web-platform-tests/wpt#25493 |
This CL defines the fitness distance also for required constrains whose
value contains a member named 'ideal' in addition to members named
'exact', 'max' and/or 'min'.
Lets take a width constraint
{ideal: 1920, min: 320}
as an example and lets assume that the browser supports the constraint and that there are settings dictionaries which satisfy the constraint (so fitness distance algorithm steps 1 and 2 can be ignores).Then,
thus the fitness distance is undefined.
Clearly, the step 5 should apply and the fitness distance should be positive infinity for settings dictionaries with width less than 320, 0 for settings dictionaries with width of 1920 and |actual - 1920| / max(|actual|, 1920) for other settings dictionaries.