aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/window.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-10-28 19:49:17 -0700
committerPatrick Walton <pcwalton@mimiga.net>2014-12-15 14:16:04 -0800
commitd101c1dd91ddcd030cd85a22825835bc3eca50ea (patch)
treeec02e406356645ffe4bac4d9cf33256c92c31de5 /components/script/dom/window.rs
parent1bc2c8a6397382b4db8fb09582434f4798d43868 (diff)
downloadservo-d101c1dd91ddcd030cd85a22825835bc3eca50ea.tar.gz
servo-d101c1dd91ddcd030cd85a22825835bc3eca50ea.zip
script: Improve dirty propagation and fix script-layout synchronization.
This fixes race conditions whereby layout and script could be running simultaneously.
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r--components/script/dom/window.rs22
1 files changed, 5 insertions, 17 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index ec12d983918..f305bf1344c 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -21,7 +21,7 @@ use dom::navigator::Navigator;
use dom::performance::Performance;
use dom::screen::Screen;
use dom::storage::Storage;
-use layout_interface::NoQuery;
+use layout_interface::{NoQuery, ReflowForDisplay, ReflowGoal, ReflowQueryType};
use page::Page;
use script_task::{ExitWindowMsg, ScriptChan, TriggerLoadMsg, TriggerFragmentMsg};
use script_task::FromWindow;
@@ -299,9 +299,7 @@ impl Reflectable for Window {
}
pub trait WindowHelpers {
- fn reflow(self);
- fn flush_layout(self);
- fn wait_until_safe_to_modify_dom(self);
+ fn flush_layout(self, goal: ReflowGoal, query: ReflowQueryType);
fn init_browser_context(self, doc: JSRef<Document>);
fn load_url(self, href: DOMString);
fn handle_fire_timer(self, timer_id: TimerId);
@@ -334,18 +332,8 @@ impl<'a> WindowHelpers for JSRef<'a, Window> {
})
}
- fn reflow(self) {
- self.page().damage();
- }
-
- fn flush_layout(self) {
- self.page().flush_layout(NoQuery);
- }
-
- fn wait_until_safe_to_modify_dom(self) {
- // FIXME: This disables concurrent layout while we are modifying the DOM, since
- // our current architecture is entirely unsafe in the presence of races.
- self.page().join_layout();
+ fn flush_layout(self, goal: ReflowGoal, query: ReflowQueryType) {
+ self.page().flush_layout(goal, query);
}
fn init_browser_context(self, doc: JSRef<Document>) {
@@ -369,7 +357,7 @@ impl<'a> WindowHelpers for JSRef<'a, Window> {
fn handle_fire_timer(self, timer_id: TimerId) {
self.timers.fire_timer(timer_id, self.clone());
- self.flush_layout();
+ self.flush_layout(ReflowForDisplay, NoQuery);
}
}