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

@ -758,7 +758,15 @@ pub extern "C" fn Servo_StyleSet_MediumFeaturesChanged(
// it's up to date.
//
// In case it isn't we would trigger a rebuild + restyle as needed too.
let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
//
// We need to ensure the default computed values are up to date though,
// because those can influence the result of media query evaluation.
//
// FIXME(emilio, bug 1369984): do the computation conditionally, to do it
// less often.
let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
data.stylist.device_mut().reset_computed_values();
data.stylist.media_features_change_changed_style(
data.stylesheets.iter(),
&guard,
@ -1428,7 +1436,9 @@ pub extern "C" fn Servo_StyleSet_RebuildData(raw_data: RawServoStyleSetBorrowed)
let guard = global_style_data.shared_lock.read();
let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
data.reset_device(&guard);
data.stylist.device_mut().reset();
data.stylesheets.force_dirty();
data.flush_stylesheets::<GeckoElement>(&guard, None);
}
#[no_mangle]