aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_task.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2014-10-22 14:00:09 -0700
committerMartin Robinson <mrobinson@igalia.com>2014-11-11 08:46:16 -0800
commitc7327450ef1328a6045cfb8a47321e78976ca7a8 (patch)
treec5b6fa5d82eaed3164b0b58f93e1ce6a15239510 /components/script/script_task.rs
parentf4471f06029ac03aa2ee26aa4398daaab9c6a371 (diff)
downloadservo-c7327450ef1328a6045cfb8a47321e78976ca7a8.tar.gz
servo-c7327450ef1328a6045cfb8a47321e78976ca7a8.zip
Clip display list based on frame viewport
Instead of creating a display list for the entire page, only create one for an area that expands around the viewport. On my machine this makes incremental layout of http://timecube.com 50% faster.
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r--components/script/script_task.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index b234efef6c3..5630a9763b9 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -40,9 +40,9 @@ use devtools_traits::{DevtoolScriptControlMsg, EvaluateJS, EvaluateJSReply, GetD
use devtools_traits::{GetChildren, GetLayout};
use script_traits::{CompositorEvent, ResizeEvent, ReflowEvent, ClickEvent, MouseDownEvent};
use script_traits::{MouseMoveEvent, MouseUpEvent, ConstellationControlMsg, ScriptTaskFactory};
-use script_traits::{ResizeMsg, AttachLayoutMsg, LoadMsg, SendEventMsg, ResizeInactiveMsg};
-use script_traits::{ExitPipelineMsg, NewLayoutInfo, OpaqueScriptLayoutChannel, ScriptControlChan};
-use script_traits::{ReflowCompleteMsg, UntrustedNodeAddress};
+use script_traits::{ResizeMsg, AttachLayoutMsg, LoadMsg, ViewportMsg, SendEventMsg};
+use script_traits::{ResizeInactiveMsg, ExitPipelineMsg, NewLayoutInfo, OpaqueScriptLayoutChannel};
+use script_traits::{ScriptControlChan, ReflowCompleteMsg, UntrustedNodeAddress};
use servo_msg::compositor_msg::{FinishedLoading, LayerId, Loading};
use servo_msg::compositor_msg::{ScriptListener};
use servo_msg::constellation_msg::{ConstellationChan, LoadCompleteMsg, LoadUrlMsg, NavigationDirection};
@@ -495,6 +495,13 @@ impl ScriptTask {
pending.push_all_move(node_addresses);
needs_reflow.insert(id);
}
+ FromConstellation(ViewportMsg(id, rect)) => {
+ let mut page = self.page.borrow_mut();
+ let inner_page = page.find(id).expect("Page rect message sent to nonexistent pipeline");
+ if inner_page.set_page_clip_rect_with_new_viewport(rect) {
+ needs_reflow.insert(id);
+ }
+ }
_ => {
sequential.push(event);
}
@@ -530,6 +537,7 @@ impl ScriptTask {
FromConstellation(ReflowCompleteMsg(id, reflow_id)) => self.handle_reflow_complete_msg(id, reflow_id),
FromConstellation(ResizeInactiveMsg(id, new_size)) => self.handle_resize_inactive_msg(id, new_size),
FromConstellation(ExitPipelineMsg(id)) => if self.handle_exit_pipeline_msg(id) { return false },
+ FromConstellation(ViewportMsg(..)) => fail!("should have handled ViewportMsg already"),
FromScript(ExitWindowMsg(id)) => self.handle_exit_window_msg(id),
FromConstellation(ResizeMsg(..)) => fail!("should have handled ResizeMsg already"),
FromScript(XHRProgressMsg(addr, progress)) => XMLHttpRequest::handle_progress(addr, progress),