diff options
author | Glenn Watson <gw@intuitionlibrary.com> | 2014-09-12 10:03:52 +1000 |
---|---|---|
committer | Glenn Watson <gw@intuitionlibrary.com> | 2014-09-12 15:49:57 +1000 |
commit | 7503033e571cdbb0508cd6ce0a392427577ef375 (patch) | |
tree | 424c28e72020965fce81a2ff6d9a2179b0377f0f /components/script/script_task.rs | |
parent | 4e35b82770823b20e4188206fbe3ccc6514877b4 (diff) | |
download | servo-7503033e571cdbb0508cd6ce0a392427577ef375.tar.gz servo-7503033e571cdbb0508cd6ce0a392427577ef375.zip |
Coalesce pending reflow messages so they don't queue up.
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r-- | components/script/script_task.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs index fdbcff82410..e49dc600211 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -513,6 +513,12 @@ impl ScriptTask { *layout_join_port = None; } self.compositor.set_ready_state(FinishedLoading); + + if page.pending_reflows.get() > 0 { + page.pending_reflows.set(0); + page.damage(MatchSelectorsDocumentDamage); + page.reflow(ReflowForDisplay, self.control_chan.clone(), self.compositor); + } } /// Handles a navigate forward or backward message. @@ -758,8 +764,13 @@ impl ScriptTask { let page = get_page(&*self.page.borrow(), pipeline_id); let frame = page.frame(); if frame.is_some() { - page.damage(MatchSelectorsDocumentDamage); - page.reflow(ReflowForDisplay, self.control_chan.clone(), self.compositor) + let in_layout = page.layout_join_port.deref().borrow().is_some(); + if in_layout { + page.pending_reflows.set(page.pending_reflows.get() + 1); + } else { + page.damage(MatchSelectorsDocumentDamage); + page.reflow(ReflowForDisplay, self.control_chan.clone(), self.compositor) + } } } |