Skip to content

Commit

Permalink
Don't send a resize event if the window size didn't change
Browse files Browse the repository at this point in the history
  • Loading branch information
sethfowler committed Jun 28, 2013
1 parent 677fce2 commit 72f5e5f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/components/main/compositing/mod.rs
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/components/script/script_task.rs
Expand Up @@ -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();
Expand Down

5 comments on commit 72f5e5f

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from metajack
at sethfowler@72f5e5f

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging sfowler/servo/run-layout-once = 72f5e5f into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sfowler/servo/run-layout-once = 72f5e5f merged ok, testing candidate = fed4f95

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = fed4f95

Please sign in to comment.