From 75af7c0b411e0332eec06cdb9f32d6c7145859e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 15 Jan 2018 15:33:25 +0100 Subject: [PATCH] style: Make Gecko's media query evaluation work with a document, not a pres context. Returning a zero-sized viewport in the case there's no shell / pres context. For now, no other change yet. After this we can start tweaking the ShadowRoot Stylist setup, and even try to return computed styles without a document \o/. Bug: 1430608 MozReview-Commit-ID: 3cT2PKQISri --- components/style/gecko/media_queries.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/style/gecko/media_queries.rs b/components/style/gecko/media_queries.rs index 4fe5b6f29b9..bbecaff7905 100644 --- a/components/style/gecko/media_queries.rs +++ b/components/style/gecko/media_queries.rs @@ -684,9 +684,11 @@ impl Expression { pub fn matches(&self, device: &Device, quirks_mode: QuirksMode) -> bool { let mut css_value = nsCSSValue::null(); unsafe { - (self.feature.mGetter.unwrap())(device.pres_context, - self.feature, - &mut css_value) + (self.feature.mGetter.unwrap())( + device.pres_context().mDocument.raw::(), + self.feature, + &mut css_value, + ) }; let value = match MediaExpressionValue::from_css_value(self, &css_value) {