mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Flush shadow roots stylesheets only if they changed
This commit is contained in:
parent
a841c713d6
commit
2674a3e717
4 changed files with 54 additions and 7 deletions
|
@ -437,6 +437,23 @@ impl<'ld> ServoLayoutDocument<'ld> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn flush_shadow_roots_stylesheets(
|
||||
&self,
|
||||
device: &Device,
|
||||
quirks_mode: QuirksMode,
|
||||
guard: &SharedRwLockReadGuard,
|
||||
) {
|
||||
unsafe {
|
||||
if !self.document.shadow_roots_styles_changed() {
|
||||
return;
|
||||
}
|
||||
self.document.flush_shadow_roots_stylesheets();
|
||||
for shadow_root in self.shadow_roots() {
|
||||
shadow_root.flush_stylesheets(device, quirks_mode, guard);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_layout_js(doc: LayoutDom<Document>) -> ServoLayoutDocument<'ld> {
|
||||
ServoLayoutDocument {
|
||||
document: doc,
|
||||
|
|
|
@ -1352,13 +1352,11 @@ impl LayoutThread {
|
|||
);
|
||||
|
||||
// Flush shadow roots stylesheets if dirty.
|
||||
for shadow_root in document.shadow_roots() {
|
||||
shadow_root.flush_stylesheets(
|
||||
&self.stylist.device(),
|
||||
document.quirks_mode(),
|
||||
guards.author.clone(),
|
||||
);
|
||||
}
|
||||
document.flush_shadow_roots_stylesheets(
|
||||
&self.stylist.device(),
|
||||
document.quirks_mode(),
|
||||
guards.author.clone(),
|
||||
);
|
||||
|
||||
let restyles = document.drain_pending_restyles();
|
||||
debug!("Draining restyles: {}", restyles.len());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue