Created
May 30, 2013 20:42
-
-
Save jdm/5681032 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/components/servo/layout/layout_task.rs b/src/components/servo/layout/layout_task.rs | |
index 27b9dd8..c83414e 100644 | |
--- a/src/components/servo/layout/layout_task.rs | |
+++ b/src/components/servo/layout/layout_task.rs | |
@@ -87,6 +87,7 @@ pub struct BuildData { | |
window_size: Size2D<uint>, | |
script_join_chan: Chan<()>, | |
damage: Damage, | |
+ render: bool | |
} | |
pub fn LayoutTask(render_task: RenderTask, | |
@@ -250,25 +251,27 @@ impl Layout { | |
}; | |
} | |
- // Build the display list, and send it to the renderer. | |
- do profile(time::LayoutDispListBuildCategory, self.prof_chan.clone()) { | |
- let builder = DisplayListBuilder { | |
- ctx: &layout_ctx, | |
- }; | |
+ if data.render { | |
+ // Build the display list, and send it to the renderer. | |
+ do profile(time::LayoutDispListBuildCategory, self.prof_chan.clone()) { | |
+ let builder = DisplayListBuilder { | |
+ ctx: &layout_ctx, | |
+ }; | |
- let display_list = @Cell(DisplayList::new()); | |
- | |
- // TODO: Set options on the builder before building. | |
- // TODO: Be smarter about what needs painting. | |
- layout_root.build_display_list(&builder, &layout_root.position(), display_list); | |
+ let display_list = @Cell(DisplayList::new()); | |
+ | |
+ // TODO: Set options on the builder before building. | |
+ // TODO: Be smarter about what needs painting. | |
+ layout_root.build_display_list(&builder, &layout_root.position(), display_list); | |
- let render_layer = RenderLayer { | |
- display_list: display_list.take(), | |
- size: Size2D(screen_size.width.to_px() as uint, screen_size.height.to_px() as uint) | |
- }; | |
+ let render_layer = RenderLayer { | |
+ display_list: display_list.take(), | |
+ size: Size2D(screen_size.width.to_px() as uint, screen_size.height.to_px() as uint) | |
+ }; | |
- self.render_task.send(RenderMsg(render_layer)); | |
- } // time(layout: display list building) | |
+ self.render_task.send(RenderMsg(render_layer)); | |
+ } // time(layout: display list building) | |
+ } | |
// Tell script that we're done. | |
data.script_join_chan.send(()); | |
diff --git a/src/components/servo/scripting/script_task.rs b/src/components/servo/scripting/script_task.rs | |
index fb01ade..bed0b4b 100644 | |
--- a/src/components/servo/scripting/script_task.rs | |
+++ b/src/components/servo/scripting/script_task.rs | |
@@ -283,7 +283,7 @@ impl ScriptContext { | |
null(), | |
&rval); | |
- self.relayout() | |
+ self.relayout(true) | |
} | |
/// Handles a request to exit the script task and shut down layout. | |
@@ -348,7 +348,7 @@ impl ScriptContext { | |
// Perform the initial reflow. | |
self.damage.add(MatchSelectorsDamage); | |
- self.relayout(); | |
+ self.relayout(true); | |
// Define debug functions. | |
self.js_compartment.define_functions(debug_fns); | |
@@ -385,7 +385,7 @@ impl ScriptContext { | |
/// Initiate an asynchronous relayout operation | |
pub fn trigger_relayout(&mut self, damage: Damage) { | |
self.damage.add(damage); | |
- self.relayout(); | |
+ self.relayout(false); | |
} | |
/// This method will wait until the layout task has completed its current action, join the | |
@@ -393,7 +393,7 @@ impl ScriptContext { | |
/// computation to finish. | |
/// | |
/// This function fails if there is no root frame. | |
- fn relayout(&mut self) { | |
+ fn relayout(&mut self, render: bool) { | |
debug!("script: performing relayout"); | |
// Now, join the layout so that they will see the latest changes we have made. | |
@@ -414,6 +414,7 @@ impl ScriptContext { | |
window_size: self.window_size, | |
script_join_chan: join_chan, | |
damage: replace(&mut self.damage, NoDamage), | |
+ render: render | |
}; | |
self.layout_task.send(BuildMsg(data)) | |
@@ -444,7 +445,7 @@ impl ScriptContext { | |
self.window_size = Size2D(new_width, new_height); | |
if self.root_frame.is_some() { | |
- self.relayout() | |
+ self.relayout(true) | |
} | |
} | |
/// Handles a request to exit the script task and shut down layout. | |
@@ -348,7 +348,7 @@ impl ScriptContext { | |
// Perform the initial reflow. | |
self.damage.add(MatchSelectorsDamage); | |
- self.relayout(); | |
+ self.relayout(true); | |
// Define debug functions. | |
self.js_compartment.define_functions(debug_fns); | |
@@ -385,7 +385,7 @@ impl ScriptContext { | |
/// Initiate an asynchronous relayout operation | |
pub fn trigger_relayout(&mut self, damage: Damage) { | |
self.damage.add(damage); | |
- self.relayout(); | |
+ self.relayout(false); | |
} | |
/// This method will wait until the layout task has completed its current action, join the | |
@@ -393,7 +393,7 @@ impl ScriptContext { | |
/// computation to finish. | |
/// | |
/// This function fails if there is no root frame. | |
- fn relayout(&mut self) { | |
+ fn relayout(&mut self, render: bool) { | |
debug!("script: performing relayout"); | |
// Now, join the layout so that they will see the latest changes we have made. | |
@@ -414,6 +414,7 @@ impl ScriptContext { | |
window_size: self.window_size, | |
script_join_chan: join_chan, | |
damage: replace(&mut self.damage, NoDamage), | |
+ render: render | |
}; | |
self.layout_task.send(BuildMsg(data)) | |
@@ -444,7 +445,7 @@ impl ScriptContext { | |
self.window_size = Size2D(new_width, new_height); | |
if self.root_frame.is_some() { | |
- self.relayout() | |
+ self.relayout(true) | |
} | |
response_chan.send(()) | |
@@ -456,7 +457,7 @@ impl ScriptContext { | |
self.damage.add(MatchSelectorsDamage); | |
if self.root_frame.is_some() { | |
- self.relayout() | |
+ self.relayout(true) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment