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
This commit is contained in:
Emilio Cobos Álvarez 2018-01-15 15:33:25 +01:00
parent e858dc060e
commit 75af7c0b41
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -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::<structs::nsIDocument>(),
self.feature,
&mut css_value,
)
};
let value = match MediaExpressionValue::from_css_value(self, &css_value) {