mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Eliminate ad-hoc recursion in set_unrendered_color
This commit is contained in:
parent
0396cdb1c5
commit
f91d51cb2c
2 changed files with 11 additions and 25 deletions
|
@ -348,12 +348,16 @@ impl IOCompositor {
|
|||
|
||||
fn set_unrendered_color(&mut self, pipeline_id: PipelineId, layer_id: LayerId, color: Color) {
|
||||
match self.scene.root {
|
||||
Some(ref layer) => CompositorData::set_unrendered_color(layer.clone(),
|
||||
pipeline_id,
|
||||
layer_id,
|
||||
color),
|
||||
None => false,
|
||||
};
|
||||
Some(ref root_layer) => {
|
||||
match CompositorData::find_layer_with_pipeline_and_layer_id(root_layer.clone(),
|
||||
pipeline_id,
|
||||
layer_id) {
|
||||
Some(ref layer) => CompositorData::set_unrendered_color(layer.clone(), color),
|
||||
None => { }
|
||||
}
|
||||
}
|
||||
None => { }
|
||||
}
|
||||
}
|
||||
|
||||
fn set_ids(&mut self,
|
||||
|
|
|
@ -813,26 +813,8 @@ impl CompositorData {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn set_unrendered_color(layer: Rc<Layer<CompositorData>>,
|
||||
pipeline_id: PipelineId,
|
||||
layer_id: LayerId,
|
||||
color: Color)
|
||||
-> bool {
|
||||
if layer.extra_data.borrow().pipeline.id != pipeline_id ||
|
||||
layer.extra_data.borrow().id != layer_id {
|
||||
for child_layer in layer.children().iter() {
|
||||
if CompositorData::set_unrendered_color(child_layer.clone(),
|
||||
pipeline_id,
|
||||
layer_id,
|
||||
color) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
pub fn set_unrendered_color(layer: Rc<Layer<CompositorData>>, color: Color) {
|
||||
layer.extra_data.borrow_mut().unrendered_color = color;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue