Clear the stylist when Gecko stylesheets change, but don't rebuild it until explicitly flushed.

This is the servo part of part 3 of the fix for https://bugzilla.mozilla.org/show_bug.cgi?id=1361843
This commit is contained in:
Boris Zbarsky 2017-05-10 13:13:00 -04:00
parent fb5b587371
commit 4588664873
3 changed files with 27 additions and 39 deletions

View file

@ -108,18 +108,26 @@ impl PerDocumentStyleDataImpl {
let author_style_disabled = self.stylesheets.author_style_disabled();
let mut stylesheets = Vec::<Arc<Stylesheet>>::new();
self.stylesheets.flush(&mut stylesheets);
stylist.update(stylesheets.as_slice(),
&StylesheetGuards::same(guard),
/* ua_sheets = */ None,
/* stylesheets_changed = */ true,
author_style_disabled,
&mut extra_data);
stylist.clear();
stylist.rebuild(stylesheets.as_slice(),
&StylesheetGuards::same(guard),
/* ua_sheets = */ None,
/* stylesheets_changed = */ true,
author_style_disabled,
&mut extra_data);
}
/// Get the default computed values for this document.
pub fn default_computed_values(&self) -> &Arc<ComputedValues> {
self.stylist.device.default_computed_values_arc()
}
/// Clear the stylist. This will be a no-op if the stylist is
/// already cleared; the stylist handles that.
pub fn clear_stylist(&mut self) {
let mut stylist = Arc::get_mut(&mut self.stylist).unwrap();
stylist.clear();
}
}
unsafe impl HasFFI for PerDocumentStyleData {

View file

@ -1626,16 +1626,16 @@ extern "C" {
extern "C" {
pub fn Servo_StyleSet_AppendStyleSheet(set: RawServoStyleSetBorrowed,
sheet: RawServoStyleSheetBorrowed,
unique_id: u32, flush: bool);
unique_id: u32);
}
extern "C" {
pub fn Servo_StyleSet_PrependStyleSheet(set: RawServoStyleSetBorrowed,
sheet: RawServoStyleSheetBorrowed,
unique_id: u32, flush: bool);
unique_id: u32);
}
extern "C" {
pub fn Servo_StyleSet_RemoveStyleSheet(set: RawServoStyleSetBorrowed,
unique_id: u32, flush: bool);
unique_id: u32);
}
extern "C" {
pub fn Servo_StyleSet_InsertStyleSheetBefore(set:
@ -1643,8 +1643,7 @@ extern "C" {
sheet:
RawServoStyleSheetBorrowed,
unique_id: u32,
before_unique_id: u32,
flush: bool);
before_unique_id: u32);
}
extern "C" {
pub fn Servo_StyleSet_FlushStyleSheets(set: RawServoStyleSetBorrowed);