diff options
author | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2019-02-21 12:34:59 +0100 |
---|---|---|
committer | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2019-04-26 11:31:17 +0200 |
commit | 2674a3e71748eb0ef6db371fc2f1401a951b94c4 (patch) | |
tree | 3106346788c2fce743ab8a9f0a8674d0b44aea7e /components/layout_thread | |
parent | a841c713d653f57256e5b795197920c7ee6834e9 (diff) | |
download | servo-2674a3e71748eb0ef6db371fc2f1401a951b94c4.tar.gz servo-2674a3e71748eb0ef6db371fc2f1401a951b94c4.zip |
Flush shadow roots stylesheets only if they changed
Diffstat (limited to 'components/layout_thread')
-rw-r--r-- | components/layout_thread/dom_wrapper.rs | 17 | ||||
-rw-r--r-- | components/layout_thread/lib.rs | 12 |
2 files changed, 22 insertions, 7 deletions
diff --git a/components/layout_thread/dom_wrapper.rs b/components/layout_thread/dom_wrapper.rs index 7ea68e6e3a2..72cbdf04701 100644 --- a/components/layout_thread/dom_wrapper.rs +++ b/components/layout_thread/dom_wrapper.rs @@ -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, diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index 3ed2624d2d3..b44bbb54b96 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -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()); |