From 3db6514252ec9977fa977de88350c3f335ca8dd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 17 Dec 2016 10:47:09 +0100 Subject: [PATCH] stylo: Track the last restyle generation properly. I couldn't reproduce locally, but I believe this fixes: https://bugzilla.mozilla.org/show_bug.cgi?id=1323890 --- components/style/gecko/data.rs | 10 ++++++++++ ports/geckolib/glue.rs | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/components/style/gecko/data.rs b/components/style/gecko/data.rs index da334bfa4bf..2b7cfc54a35 100644 --- a/components/style/gecko/data.rs +++ b/components/style/gecko/data.rs @@ -25,6 +25,9 @@ pub struct PerDocumentStyleDataImpl { /// Rule processor. pub stylist: Arc, + /// Last restyle generation. + pub last_restyle_generation: u32, + /// List of stylesheets, mirrored from Gecko. pub stylesheets: Vec>, @@ -64,6 +67,7 @@ impl PerDocumentStyleData { PerDocumentStyleData(AtomicRefCell::new(PerDocumentStyleDataImpl { stylist: Arc::new(Stylist::new(device)), + last_restyle_generation: 0, stylesheets: vec![], stylesheets_changed: true, new_animations_sender: new_anims_sender, @@ -101,6 +105,12 @@ impl PerDocumentStyleDataImpl { self.stylesheets_changed = false; } } + + pub fn next_generation(&mut self) -> u32 { + self.last_restyle_generation = + self.last_restyle_generation.wrapping_add(1); + self.last_restyle_generation + } } unsafe impl HasFFI for PerDocumentStyleData { diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index e110f043c72..f11a195798d 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -106,7 +106,7 @@ fn create_shared_context(mut per_doc_data: &mut AtomicRefMut