mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Add a new find_layer_with_pipeline_and_layer_id method
This method will be used to eliminate a lot of the ad-hoc recursive searches that are present in the compositor layer code.
This commit is contained in:
parent
f8fbf557f1
commit
c1b0a9eb93
1 changed files with 21 additions and 0 deletions
|
@ -574,6 +574,27 @@ impl CompositorData {
|
||||||
return None
|
return None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn find_layer_with_pipeline_and_layer_id(layer: Rc<Layer<CompositorData>>,
|
||||||
|
pipeline_id: PipelineId,
|
||||||
|
layer_id: LayerId)
|
||||||
|
-> Option<Rc<Layer<CompositorData>>> {
|
||||||
|
if layer.extra_data.borrow().pipeline.id == pipeline_id &&
|
||||||
|
layer.extra_data.borrow().id == layer_id {
|
||||||
|
return Some(layer.clone());
|
||||||
|
}
|
||||||
|
|
||||||
|
for kid in layer.children().iter() {
|
||||||
|
match CompositorData::find_layer_with_pipeline_and_layer_id(kid.clone(),
|
||||||
|
pipeline_id,
|
||||||
|
layer_id) {
|
||||||
|
v @ Some(_) => { return v; }
|
||||||
|
None => { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
// A helper method to resize sublayers.
|
// A helper method to resize sublayers.
|
||||||
fn resize_helper(layer: Rc<Layer<CompositorData>>,
|
fn resize_helper(layer: Rc<Layer<CompositorData>>,
|
||||||
pipeline_id: PipelineId,
|
pipeline_id: PipelineId,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue