style: Support lazy pseudo-elements

These can't be supported in Servo as of right now, because I'm not
totally sure the accesses that should be done in layout would be
thread-safe.

It can be revisited later though.
This commit is contained in:
Emilio Cobos Álvarez 2016-04-29 22:29:59 +02:00
parent 3f2ceeff5d
commit 9caaa6004e
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
7 changed files with 206 additions and 72 deletions

View file

@ -117,6 +117,13 @@ impl Device {
viewport_size: viewport_size,
}
}
#[inline]
pub fn au_viewport_size(&self) -> Size2D<Au> {
Size2D::new(Au::from_f32_px(self.viewport_size.width.get()),
Au::from_f32_px(self.viewport_size.height.get()))
}
}
impl Expression {
@ -203,8 +210,7 @@ pub fn parse_media_query_list(input: &mut Parser) -> MediaQueryList {
impl MediaQueryList {
pub fn evaluate(&self, device: &Device) -> bool {
let viewport_size = Size2D::new(Au::from_f32_px(device.viewport_size.width.get()),
Au::from_f32_px(device.viewport_size.height.get()));
let viewport_size = device.au_viewport_size();
// Check if any queries match (OR condition)
self.media_queries.iter().any(|mq| {