aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/script_task.rs
diff options
context:
space:
mode:
authorKeegan McAllister <kmcallister@mozilla.com>2013-12-10 13:42:30 -0800
committerKeegan McAllister <kmcallister@mozilla.com>2013-12-12 14:43:26 -0800
commit39fc9eb86881e486f8a9eaf0cae8357c864f49b0 (patch)
tree16533334c5ebc735b7107252cf473f84b6ce5458 /src/components/script/script_task.rs
parentdd0bb0892702f952bf7628c63c1320031828fb46 (diff)
downloadservo-39fc9eb86881e486f8a9eaf0cae8357c864f49b0.tar.gz
servo-39fc9eb86881e486f8a9eaf0cae8357c864f49b0.zip
Get rid of reflow_all
This refactoring should not alter behavior.
Diffstat (limited to 'src/components/script/script_task.rs')
-rwxr-xr-xsrc/components/script/script_task.rs28
1 files changed, 10 insertions, 18 deletions
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;
}