aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <release+servo@mozilla.com>2013-06-27 19:12:34 -0700
committerbors-servo <release+servo@mozilla.com>2013-06-27 19:12:34 -0700
commitfed4f951c19f5c8cfc474814c7e8ca6ebc257232 (patch)
tree0c9755a93972a890b1e9352cb387a86c23ed785c
parent74ab91414913d075b18a7a3d1b5c92b0cc0e0239 (diff)
parent72f5e5f30d52673dddb3b5e76333e122eef00a42 (diff)
downloadservo-fed4f951c19f5c8cfc474814c7e8ca6ebc257232.tar.gz
servo-fed4f951c19f5c8cfc474814c7e8ca6ebc257232.zip
auto merge of #551 : sfowler/servo/run-layout-once, r=metajack
Performance will be better and benchmarking easier if we don't run layout an extra unnecessary time when loading a page from the commandline. This is happening because we always send a resize event to the script task from the compositor whenever the platform tells us one happened, even if the window size didn't change. This PR fixes this by checking that the window size is actually different before sending the event.
-rw-r--r--src/components/main/compositing/mod.rs11
-rw-r--r--src/components/script/script_task.rs2
2 files changed, 9 insertions, 4 deletions
diff --git a/src/components/main/compositing/mod.rs b/src/components/main/compositing/mod.rs
index 29d2041b2c6..9e3a2a1067e 100644
--- a/src/components/main/compositing/mod.rs
+++ b/src/components/main/compositing/mod.rs
@@ -182,9 +182,14 @@ impl CompositorTask {
let layout_chan_clone = layout_chan.clone();
// Hook the windowing system's resize callback up to the resize rate limiter.
do window.set_resize_callback |width, height| {
- debug!("osmain: window resized to %ux%u", width, height);
- *window_size = Size2D(width as int, height as int);
- layout_chan_clone.chan.send(RouteScriptMsg(SendEventMsg(ResizeEvent(width, height))));
+ let new_size = Size2D(width as int, height as int);
+ if *window_size != new_size {
+ debug!("osmain: window resized to %ux%u", width, height);
+ *window_size = new_size;
+ layout_chan_clone.chan.send(RouteScriptMsg(SendEventMsg(ResizeEvent(width, height))));
+ } else {
+ debug!("osmain: dropping window resize since size is still %ux%u", width, height);
+ }
}
let layout_chan_clone = layout_chan.clone();
diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs
index 01b57b73b6b..7ef0b0035e1 100644
--- a/src/components/script/script_task.rs
+++ b/src/components/script/script_task.rs
@@ -440,7 +440,7 @@ impl ScriptContext {
///
/// This function fails if there is no root frame.
fn reflow(&mut self, goal: ReflowGoal) {
- debug!("script: performing reflow");
+ debug!("script: performing reflow for goal %?", goal);
// Now, join the layout so that they will see the latest changes we have made.
self.join_layout();