mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
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:
parent
2389650734
commit
d30400d3ea
4 changed files with 20 additions and 13 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue