mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
compositing: Add some layer tree debugging infrastructure.
This commit is contained in:
parent
df4acbac04
commit
300315bb78
3 changed files with 30 additions and 2 deletions
|
@ -1622,6 +1622,33 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
self.surface_map.insert_surfaces(&self.native_display, surfaces);
|
self.surface_map.insert_surfaces(&self.native_display, surfaces);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
fn dump_layer_tree(&self) {
|
||||||
|
if let Some(ref layer) = self.scene.root {
|
||||||
|
println!("Layer tree:");
|
||||||
|
self.dump_layer_tree_with_indent(&**layer, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
fn dump_layer_tree_with_indent(&self, layer: &Layer<CompositorData>, level: u32) {
|
||||||
|
let mut indentation = String::new();
|
||||||
|
for _ in 0..level {
|
||||||
|
indentation.push_str(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
println!("{}Layer {:x}: {:?} @ {:?} masks to bounds: {:?} establishes 3D context: {:?}",
|
||||||
|
indentation,
|
||||||
|
layer as *const _ as usize,
|
||||||
|
layer.extra_data,
|
||||||
|
*layer.bounds.borrow(),
|
||||||
|
*layer.masks_to_bounds.borrow(),
|
||||||
|
layer.establishes_3d_context);
|
||||||
|
for kid in layer.children().iter() {
|
||||||
|
self.dump_layer_tree_with_indent(&**kid, level + 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_layer_with_pipeline_and_layer_id_for_layer(layer: Rc<Layer<CompositorData>>,
|
fn find_layer_with_pipeline_and_layer_id_for_layer(layer: Rc<Layer<CompositorData>>,
|
||||||
|
|
|
@ -19,6 +19,7 @@ use msg::compositor_msg::{Epoch, LayerId, LayerProperties, ScrollPolicy};
|
||||||
use msg::constellation_msg::PipelineId;
|
use msg::constellation_msg::PipelineId;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct CompositorData {
|
pub struct CompositorData {
|
||||||
/// This layer's pipeline id. The compositor can associate this id with an
|
/// This layer's pipeline id. The compositor can associate this id with an
|
||||||
/// actual CompositionPipeline.
|
/// actual CompositionPipeline.
|
||||||
|
@ -143,7 +144,7 @@ pub trait CompositorLayer {
|
||||||
fn pipeline_id(&self) -> PipelineId;
|
fn pipeline_id(&self) -> PipelineId;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, PartialEq, Clone)]
|
#[derive(Copy, PartialEq, Clone, Debug)]
|
||||||
pub enum WantsScrollEventsFlag {
|
pub enum WantsScrollEventsFlag {
|
||||||
WantsScrollEvents,
|
WantsScrollEvents,
|
||||||
DoesntWantScrollEvents,
|
DoesntWantScrollEvents,
|
||||||
|
|
|
@ -60,7 +60,7 @@ pub enum LayerKind {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The scrolling policy of a layer.
|
/// The scrolling policy of a layer.
|
||||||
#[derive(Clone, PartialEq, Eq, Copy, Deserialize, Serialize)]
|
#[derive(Clone, PartialEq, Eq, Copy, Deserialize, Serialize, Debug)]
|
||||||
pub enum ScrollPolicy {
|
pub enum ScrollPolicy {
|
||||||
/// These layers scroll when the parent receives a scrolling message.
|
/// These layers scroll when the parent receives a scrolling message.
|
||||||
Scrollable,
|
Scrollable,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue