From 274845fc14e4cd40616a71ec8ae3da4d159934da Mon Sep 17 00:00:00 2001 From: quasicomputational Date: Sat, 22 Dec 2018 19:41:33 +0000 Subject: [PATCH] style: Implement the 'overflow-inline' media query. Bug: 1422235 Reviewed-by: emilio --- components/style/gecko/media_features.rs | 30 +++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/components/style/gecko/media_features.rs b/components/style/gecko/media_features.rs index ede01f3b1b9..29f5b61816f 100644 --- a/components/style/gecko/media_features.rs +++ b/components/style/gecko/media_features.rs @@ -327,6 +327,28 @@ fn eval_overflow_block(device: &Device, query_value: Option) -> b } } +#[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)] +#[repr(u8)] +enum OverflowInline { + None, + Scroll, +} + +/// https://drafts.csswg.org/mediaqueries-4/#mf-overflow-inline +fn eval_overflow_inline(device: &Device, query_value: Option) -> bool { + // See the note in eval_overflow_block. + let scrolling = device.media_type() != MediaType::print(); + let query_value = match query_value { + Some(v) => v, + None => return scrolling, + }; + + match query_value { + OverflowInline::None => !scrolling, + OverflowInline::Scroll => scrolling, + } +} + /// https://drafts.csswg.org/mediaqueries-4/#mf-interaction bitflags! { struct PointerCapabilities: u8 { @@ -505,7 +527,7 @@ lazy_static! { /// to support new types in these entries and (2) ensuring that either /// nsPresContext::MediaFeatureValuesChanged is called when the value that /// would be returned by the evaluator function could change. - pub static ref MEDIA_FEATURES: [MediaFeatureDescription; 49] = [ + pub static ref MEDIA_FEATURES: [MediaFeatureDescription; 50] = [ feature!( atom!("width"), AllowsRanges::Yes, @@ -630,6 +652,12 @@ lazy_static! { keyword_evaluator!(eval_overflow_block, OverflowBlock), ParsingRequirements::empty(), ), + feature!( + atom!("overflow-inline"), + AllowsRanges::No, + keyword_evaluator!(eval_overflow_inline, OverflowInline), + ParsingRequirements::empty(), + ), feature!( atom!("pointer"), AllowsRanges::No,