diff options
author | Keegan McAllister <kmcallister@mozilla.com> | 2013-12-10 13:42:30 -0800 |
---|---|---|
committer | Keegan McAllister <kmcallister@mozilla.com> | 2013-12-12 14:43:26 -0800 |
commit | 39fc9eb86881e486f8a9eaf0cae8357c864f49b0 (patch) | |
tree | 16533334c5ebc735b7107252cf473f84b6ce5458 /src | |
parent | dd0bb0892702f952bf7628c63c1320031828fb46 (diff) | |
download | servo-39fc9eb86881e486f8a9eaf0cae8357c864f49b0.tar.gz servo-39fc9eb86881e486f8a9eaf0cae8357c864f49b0.zip |
Get rid of reflow_all
This refactoring should not alter behavior.
Diffstat (limited to 'src')
-rw-r--r-- | src/components/script/dom/window.rs | 5 | ||||
-rwxr-xr-x | src/components/script/script_task.rs | 28 |
2 files changed, 13 insertions, 20 deletions
diff --git a/src/components/script/dom/window.rs b/src/components/script/dom/window.rs index aeb6b317a07..74d785784a4 100644 --- a/src/components/script/dom/window.rs +++ b/src/components/script/dom/window.rs @@ -12,7 +12,7 @@ use dom::node::{AbstractNode, ScriptView}; use dom::location::Location; use dom::navigator::Navigator; -use layout_interface::ReflowForDisplay; +use layout_interface::{ReflowForDisplay, ContentChangedDocumentDamage}; use script_task::{ExitWindowMsg, FireTimerMsg, Page, ScriptChan}; use servo_msg::compositor_msg::ScriptListener; use servo_net::image_cache_task::ImageCacheTask; @@ -189,7 +189,8 @@ impl Window { // 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.reflow_all(ReflowForDisplay, self.script_chan.clone(), self.compositor); + self.page.damage(ContentChangedDocumentDamage); + self.page.reflow(ReflowForDisplay, self.script_chan.clone(), self.compositor); } pub fn wait_until_safe_to_modify_dom(&self) { diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs index 35ebeaf69ce..0c3bf255163 100755 --- a/src/components/script/script_task.rs +++ b/src/components/script/script_task.rs @@ -224,8 +224,11 @@ impl<'self> Iterator<@mut Page> for PageTreeIterator<'self> { impl Page { /// Adds the given damage. - fn damage(&mut self, level: DocumentDamageLevel) { - let root = self.frame.get_ref().document.document().GetDocumentElement(); + pub fn damage(&mut self, level: DocumentDamageLevel) { + let root = match self.frame { + None => return, + Some(ref frame) => frame.document.document().GetDocumentElement() + }; match root { None => {}, Some(root) => { @@ -282,7 +285,7 @@ impl Page { /// computation to finish. /// /// This function fails if there is no root frame. - fn reflow(&mut self, goal: ReflowGoal, script_chan: ScriptChan, compositor: @ScriptListener) { + pub fn reflow(&mut self, goal: ReflowGoal, script_chan: ScriptChan, compositor: @ScriptListener) { let root = match self.frame { None => return, Some(ref frame) => { @@ -325,19 +328,6 @@ impl Page { } } - /// Reflows the entire document. - /// - /// FIXME: This should basically never be used. - pub fn reflow_all(&mut self, goal: ReflowGoal, script_chan: ScriptChan, compositor: @ScriptListener) { - if self.frame.is_some() { - self.damage(ContentChangedDocumentDamage); - } - - //FIXME: In the case where an initial reflow is required, we should always - // ReflowForDisplay, regardless of the original goal. - self.reflow(goal, script_chan, compositor) - } - pub fn initialize_js_info(&mut self, js_context: @Cx, global: *JSObject) { // Note that the order that these variables are initialized is _not_ arbitrary. Switching them around // can -- and likely will -- lead to things breaking. @@ -599,7 +589,8 @@ impl ScriptTask { } // We don't know what the script changed, so for now we will do a total redisplay. - page.reflow_all(ReflowForDisplay, self.chan.clone(), self.compositor); + page.damage(ContentChangedDocumentDamage); + page.reflow(ReflowForDisplay, self.chan.clone(), self.compositor); } /// Handles a notification that reflow completed. @@ -683,7 +674,8 @@ impl ScriptTask { if *loaded == url { page.url = Some((loaded.clone(), false)); if needs_reflow { - page.reflow_all(ReflowForDisplay, self.chan.clone(), self.compositor); + page.damage(ContentChangedDocumentDamage); + page.reflow(ReflowForDisplay, self.chan.clone(), self.compositor); } return; } |