mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Auto merge of #14622 - emilio:last-restyle, r=bholley
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 r? @heycam <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14622) <!-- Reviewable:end -->
This commit is contained in:
commit
f6163c77b9
2 changed files with 11 additions and 1 deletions
|
@ -25,6 +25,9 @@ pub struct PerDocumentStyleDataImpl {
|
||||||
/// Rule processor.
|
/// Rule processor.
|
||||||
pub stylist: Arc<Stylist>,
|
pub stylist: Arc<Stylist>,
|
||||||
|
|
||||||
|
/// Last restyle generation.
|
||||||
|
pub last_restyle_generation: u32,
|
||||||
|
|
||||||
/// List of stylesheets, mirrored from Gecko.
|
/// List of stylesheets, mirrored from Gecko.
|
||||||
pub stylesheets: Vec<Arc<Stylesheet>>,
|
pub stylesheets: Vec<Arc<Stylesheet>>,
|
||||||
|
|
||||||
|
@ -64,6 +67,7 @@ impl PerDocumentStyleData {
|
||||||
|
|
||||||
PerDocumentStyleData(AtomicRefCell::new(PerDocumentStyleDataImpl {
|
PerDocumentStyleData(AtomicRefCell::new(PerDocumentStyleDataImpl {
|
||||||
stylist: Arc::new(Stylist::new(device)),
|
stylist: Arc::new(Stylist::new(device)),
|
||||||
|
last_restyle_generation: 0,
|
||||||
stylesheets: vec![],
|
stylesheets: vec![],
|
||||||
stylesheets_changed: true,
|
stylesheets_changed: true,
|
||||||
new_animations_sender: new_anims_sender,
|
new_animations_sender: new_anims_sender,
|
||||||
|
@ -101,6 +105,12 @@ impl PerDocumentStyleDataImpl {
|
||||||
self.stylesheets_changed = false;
|
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 {
|
unsafe impl HasFFI for PerDocumentStyleData {
|
||||||
|
|
|
@ -106,7 +106,7 @@ fn create_shared_context(mut per_doc_data: &mut AtomicRefMut<PerDocumentStyleDat
|
||||||
// FIXME (bug 1303229): Use the actual viewport size here
|
// FIXME (bug 1303229): Use the actual viewport size here
|
||||||
viewport_size: Size2D::new(Au(0), Au(0)),
|
viewport_size: Size2D::new(Au(0), Au(0)),
|
||||||
screen_size_changed: false,
|
screen_size_changed: false,
|
||||||
generation: 0,
|
generation: per_doc_data.next_generation(),
|
||||||
goal: ReflowGoal::ForScriptQuery,
|
goal: ReflowGoal::ForScriptQuery,
|
||||||
stylist: per_doc_data.stylist.clone(),
|
stylist: per_doc_data.stylist.clone(),
|
||||||
running_animations: per_doc_data.running_animations.clone(),
|
running_animations: per_doc_data.running_animations.clone(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue