diff options
author | Josh Matthews <josh@joshmatthews.net> | 2014-09-15 23:16:45 -0400 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2014-09-15 23:16:45 -0400 |
commit | 2bd93ed070e852dda57faf9954af1574060b995d (patch) | |
tree | 041afdc306ca303a222acecf3a0acbaf43d01a66 /components/script/dom | |
parent | 8a02fe0fc6df5f5812a3de80d417fd6e68502ce3 (diff) | |
download | servo-2bd93ed070e852dda57faf9954af1574060b995d.tar.gz servo-2bd93ed070e852dda57faf9954af1574060b995d.zip |
Delay initiating layout operations for as long as possible.
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/node.rs | 4 | ||||
-rw-r--r-- | components/script/dom/window.rs | 16 |
2 files changed, 11 insertions, 9 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index f419798a110..6ce21d13b94 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -588,7 +588,7 @@ impl<'m, 'n> NodeHelpers<'m, 'n> for JSRef<'n, Node> { let page = window.deref().page(); let addr = self.to_trusted_node_address(); - let ContentBoxResponse(rect) = page.layout_rpc.content_box(addr); + let ContentBoxResponse(rect) = page.layout().content_box(addr); rect } @@ -596,7 +596,7 @@ impl<'m, 'n> NodeHelpers<'m, 'n> for JSRef<'n, Node> { let window = window_from_node(self).root(); let page = window.deref().page(); let addr = self.to_trusted_node_address(); - let ContentBoxesResponse(rects) = page.layout_rpc.content_boxes(addr); + let ContentBoxesResponse(rects) = page.layout().content_boxes(addr); rects } diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index ce60f3cdb19..54f9c9ac2f9 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -19,7 +19,7 @@ use dom::location::Location; use dom::navigator::Navigator; use dom::performance::Performance; use dom::screen::Screen; -use layout_interface::{ReflowForDisplay, DocumentDamageLevel}; +use layout_interface::{ReflowGoal, DocumentDamageLevel}; use page::Page; use script_task::{ExitWindowMsg, FireTimerMsg, ScriptChan, TriggerLoadMsg, TriggerFragmentMsg}; use script_traits::ScriptControlChan; @@ -77,14 +77,14 @@ impl TimerHandle { pub struct Window { eventtarget: EventTarget, pub script_chan: ScriptChan, - control_chan: ScriptControlChan, + pub control_chan: ScriptControlChan, console: Cell<Option<JS<Console>>>, location: Cell<Option<JS<Location>>>, navigator: Cell<Option<JS<Navigator>>>, pub image_cache_task: ImageCacheTask, pub active_timers: Traceable<RefCell<HashMap<TimerId, TimerHandle>>>, next_timer_handle: Traceable<Cell<i32>>, - compositor: Untraceable<Box<ScriptListener>>, + pub compositor: Untraceable<Box<ScriptListener>>, pub browser_context: Traceable<RefCell<Option<BrowserContext>>>, pub page: Rc<Page>, performance: Cell<Option<JS<Performance>>>, @@ -355,6 +355,7 @@ impl Reflectable for Window { pub trait WindowHelpers { fn damage_and_reflow(&self, damage: DocumentDamageLevel); + fn flush_layout(&self, goal: ReflowGoal); fn wait_until_safe_to_modify_dom(&self); fn init_browser_context(&self, doc: &JSRef<Document>); fn load_url(&self, href: DOMString); @@ -387,11 +388,12 @@ impl<'a> WindowHelpers for JSRef<'a, Window> { } fn damage_and_reflow(&self, damage: DocumentDamageLevel) { - // FIXME This should probably be ReflowForQuery, not Display. All queries currently - // currently rely on the display list, which means we can't destroy it by - // doing a query reflow. self.page().damage(damage); - self.page().reflow(ReflowForDisplay, self.control_chan.clone(), *self.compositor); + self.page().avoided_reflows.set(self.page().avoided_reflows.get() + 1); + } + + fn flush_layout(&self, goal: ReflowGoal) { + self.page().flush_layout(goal); } fn wait_until_safe_to_modify_dom(&self) { |