Ensure the default computed values are up-to-date before evaluating media queries.

Zoom changes can change the meaning of ems, so we can't re-evaluate media
queries with the old values, because otherwise we may miss a restyle.

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1357461
MozReview-Commit-ID: HQInvR7RPqR
This commit is contained in:
Emilio Cobos Álvarez 2017-06-02 20:34:37 +02:00
parent 5c66d3c77a
commit dd3bf6f952
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 20 additions and 13 deletions

View file

@ -99,6 +99,13 @@ impl Device {
self.root_font_size.store(size.0 as isize, Ordering::Relaxed)
}
/// Recreates the default computed values.
pub fn reset_computed_values(&mut self) {
// NB: A following stylesheet flush will populate this if appropriate.
self.viewport_override = None;
self.default_values = ComputedValues::default_values(unsafe { &*self.pres_context });
}
/// Recreates all the temporary state that the `Device` stores.
///
/// This includes the viewport override from `@viewport` rules, and also the
@ -106,7 +113,7 @@ impl Device {
pub fn reset(&mut self) {
// NB: A following stylesheet flush will populate this if appropriate.
self.viewport_override = None;
self.default_values = ComputedValues::default_values(unsafe { &*self.pres_context });
self.reset_computed_values();
}
/// Returns the current media type of the device.