зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #2928 - Simplify set_clipping_rect and inline it into its only caller (from zwarich:set-clipping-cleanup)
Source-Repo: https://github.com/servo/servo Source-Revision: 5ed95e410b3f0c7ac5fb1c1e200452b27d6b5cda
This commit is contained in:
Родитель
1a0e18b43c
Коммит
a04325dd27
|
@ -465,20 +465,24 @@ impl IOCompositor {
|
|||
pipeline_id: PipelineId,
|
||||
layer_id: LayerId,
|
||||
new_rect: Rect<f32>) {
|
||||
let ask: bool = match self.scene.root {
|
||||
Some(ref layer) => {
|
||||
assert!(CompositorData::set_clipping_rect(layer.clone(),
|
||||
pipeline_id,
|
||||
layer_id,
|
||||
new_rect));
|
||||
true
|
||||
}
|
||||
None => {
|
||||
false
|
||||
let should_ask_for_tiles = match self.scene.root {
|
||||
Some(ref root_layer) => {
|
||||
match CompositorData::find_layer_with_pipeline_and_layer_id(root_layer.clone(),
|
||||
pipeline_id,
|
||||
layer_id) {
|
||||
Some(ref layer) => {
|
||||
*layer.bounds.borrow_mut() = new_rect;
|
||||
true
|
||||
}
|
||||
None => {
|
||||
fail!("compositor received SetLayerClipRect for nonexistent layer");
|
||||
}
|
||||
}
|
||||
}
|
||||
None => false
|
||||
};
|
||||
|
||||
if ask {
|
||||
if should_ask_for_tiles {
|
||||
self.ask_for_tiles();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,34 +138,6 @@ impl CompositorData {
|
|||
layer.children().iter().map(get_child_buffer_request).any(|b| b) || redisplay
|
||||
}
|
||||
|
||||
// Move the sublayer to an absolute position in page coordinates relative to its parent,
|
||||
// and clip the layer to the specified size in page coordinates.
|
||||
// This method returns false if the specified layer is not found.
|
||||
pub fn set_clipping_rect(layer: Rc<Layer<CompositorData>>,
|
||||
pipeline_id: PipelineId,
|
||||
layer_id: LayerId,
|
||||
new_rect: Rect<f32>)
|
||||
-> bool {
|
||||
debug!("compositor_data: starting set_clipping_rect()");
|
||||
match CompositorData::find_child_with_pipeline_and_layer_id(layer.clone(),
|
||||
pipeline_id,
|
||||
layer_id) {
|
||||
Some(child_node) => {
|
||||
debug!("compositor_data: node found for set_clipping_rect()");
|
||||
*child_node.bounds.borrow_mut() = new_rect;
|
||||
true
|
||||
}
|
||||
None => {
|
||||
layer.children().iter()
|
||||
.any(|kid| CompositorData::set_clipping_rect(kid.clone(),
|
||||
pipeline_id,
|
||||
layer_id,
|
||||
new_rect))
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update_layer(layer: Rc<Layer<CompositorData>>, layer_properties: LayerProperties) {
|
||||
layer.extra_data.borrow_mut().epoch = layer_properties.epoch;
|
||||
layer.extra_data.borrow_mut().background_color = layer_properties.background_color;
|
||||
|
@ -182,19 +154,6 @@ impl CompositorData {
|
|||
size);
|
||||
}
|
||||
|
||||
fn find_child_with_pipeline_and_layer_id(layer: Rc<Layer<CompositorData>>,
|
||||
pipeline_id: PipelineId,
|
||||
layer_id: LayerId)
|
||||
-> Option<Rc<Layer<CompositorData>>> {
|
||||
for kid in layer.children().iter() {
|
||||
if pipeline_id == kid.extra_data.borrow().pipeline.id &&
|
||||
layer_id == kid.extra_data.borrow().id {
|
||||
return Some(kid.clone());
|
||||
}
|
||||
}
|
||||
return None
|
||||
}
|
||||
|
||||
pub fn find_layer_with_pipeline_and_layer_id(layer: Rc<Layer<CompositorData>>,
|
||||
pipeline_id: PipelineId,
|
||||
layer_id: LayerId)
|
||||
|
|
Загрузка…
Ссылка в новой задаче