style: Fix container orientation evaluation

Allow keyword evaluators to return unknown.

Do you know of a good test to extend here? Otherwise I can add a new
one, though I gotta run atm.

Differential Revision: https://phabricator.services.mozilla.com/D165630
This commit is contained in:
Emilio Cobos Álvarez 2022-12-29 13:02:37 +00:00 committed by Martin Robinson
parent 2389650734
commit d30400d3ea
4 changed files with 20 additions and 13 deletions

View file

@ -4,6 +4,9 @@
//! Common feature values between media and container features.
use app_units::Au;
use euclid::default::Size2D;
/// The orientation media / container feature.
/// https://drafts.csswg.org/mediaqueries-5/#orientation
/// https://drafts.csswg.org/css-contain-3/#orientation
@ -17,10 +20,7 @@ pub enum Orientation {
impl Orientation {
/// A helper to evaluate a orientation query given a generic size getter.
pub fn eval<T>(size: euclid::default::Size2D<T>, value: Option<Self>) -> bool
where
T: PartialOrd,
{
pub fn eval(size: Size2D<Au>, value: Option<Self>) -> bool {
let query_orientation = match value {
Some(v) => v,
None => return true,