From b8e78d20bf2530261c8a8fa834df310d575f5e51 Mon Sep 17 00:00:00 2001 From: Brad Werth Date: Thu, 28 Sep 2017 11:50:42 -0700 Subject: [PATCH] Change resolution queries to compare in unconverted dppx units. MozReview-Commit-ID: 7wYlixTQTIC --- components/style/gecko/media_queries.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/components/style/gecko/media_queries.rs b/components/style/gecko/media_queries.rs index 394cd5c1833..00e2d0887ae 100644 --- a/components/style/gecko/media_queries.rs +++ b/components/style/gecko/media_queries.rs @@ -373,8 +373,18 @@ impl MediaExpressionValue { Some(MediaExpressionValue::BoolInteger(i == 1)) } nsMediaFeature_ValueType::eResolution => { - debug_assert!(css_value.mUnit == nsCSSUnit::eCSSUnit_Inch); - Some(MediaExpressionValue::Resolution(Resolution::Dpi(css_value.float_unchecked()))) + // This is temporarily more complicated to allow Gecko Bug + // 1376931 to land. Parts of that bug will supply pixel values + // and expect them to be passed through without conversion. + // After all parts of that bug have landed, Bug 1404097 will + // return this function to once again only allow one type of + // value to be accepted: this time, only pixel values. + let res = match css_value.mUnit { + nsCSSUnit::eCSSUnit_Pixel => Resolution::Dppx(css_value.float_unchecked()), + nsCSSUnit::eCSSUnit_Inch => Resolution::Dpi(css_value.float_unchecked()), + _ => unreachable!(), + }; + Some(MediaExpressionValue::Resolution(res)) } nsMediaFeature_ValueType::eEnumerated => { let value = css_value.integer_unchecked() as i16;