mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
gfx: Print out stacking context info when dumping display lists.
This commit is contained in:
parent
1f0b5889da
commit
711993eb46
3 changed files with 33 additions and 22 deletions
|
@ -58,6 +58,8 @@ pub mod optimizer;
|
||||||
/// items that involve a blur. This ensures that the display item boundaries include all the ink.
|
/// items that involve a blur. This ensures that the display item boundaries include all the ink.
|
||||||
pub static BLUR_INFLATION_FACTOR: i32 = 3;
|
pub static BLUR_INFLATION_FACTOR: i32 = 3;
|
||||||
|
|
||||||
|
const MIN_INDENTATION_LENGTH: usize = 4;
|
||||||
|
|
||||||
/// An opaque handle to a node. The only safe operation that can be performed on this node is to
|
/// An opaque handle to a node. The only safe operation that can be performed on this node is to
|
||||||
/// compare it to another opaque handle or to another node.
|
/// compare it to another opaque handle or to another node.
|
||||||
///
|
///
|
||||||
|
@ -172,20 +174,7 @@ impl DisplayList {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print the display list. Only makes sense to call it after performing reflow.
|
// Print the display list. Only makes sense to call it after performing reflow.
|
||||||
pub fn print_items(&self, mut indentation: String) {
|
pub fn print_items(&self, indentation: String) {
|
||||||
let min_length = 4;
|
|
||||||
// We cover the case of an empty string.
|
|
||||||
if indentation.len() == 0 {
|
|
||||||
indentation = String::from_str("####");
|
|
||||||
}
|
|
||||||
|
|
||||||
// We grow the indentation by 4 characters if needed.
|
|
||||||
// I wish to push it all as a slice, but it won't work if the string is a single char.
|
|
||||||
while indentation.len() < min_length {
|
|
||||||
let c = indentation.char_at(0);
|
|
||||||
indentation.push(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Closures are so nice!
|
// Closures are so nice!
|
||||||
let doit = |items: &Vec<DisplayItem>| {
|
let doit = |items: &Vec<DisplayItem>| {
|
||||||
for item in items.iter() {
|
for item in items.iter() {
|
||||||
|
@ -221,8 +210,9 @@ impl DisplayList {
|
||||||
println!("{} Children stacking contexts list length: {}",
|
println!("{} Children stacking contexts list length: {}",
|
||||||
indentation,
|
indentation,
|
||||||
self.children.len());
|
self.children.len());
|
||||||
for sublist in self.children.iter() {
|
for stacking_context in self.children.iter() {
|
||||||
sublist.display_list.print_items(indentation.clone()+&indentation[0..min_length]);
|
stacking_context.print(indentation.clone() +
|
||||||
|
&indentation[0..MIN_INDENTATION_LENGTH]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -571,6 +561,27 @@ impl StackingContext {
|
||||||
topmost_only,
|
topmost_only,
|
||||||
self.display_list.background_and_borders.iter().rev())
|
self.display_list.background_and_borders.iter().rev())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn print(&self, mut indentation: String) {
|
||||||
|
// We cover the case of an empty string.
|
||||||
|
if indentation.len() == 0 {
|
||||||
|
indentation = String::from_str("####");
|
||||||
|
}
|
||||||
|
|
||||||
|
// We grow the indentation by 4 characters if needed.
|
||||||
|
// I wish to push it all as a slice, but it won't work if the string is a single char.
|
||||||
|
while indentation.len() < MIN_INDENTATION_LENGTH {
|
||||||
|
let c = indentation.char_at(0);
|
||||||
|
indentation.push(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
println!("{:?} Stacking context at {:?} with overflow {:?}:",
|
||||||
|
indentation,
|
||||||
|
self.bounds,
|
||||||
|
self.overflow);
|
||||||
|
|
||||||
|
self.display_list.print_items(indentation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HeapSizeOf for StackingContext {
|
impl HeapSizeOf for StackingContext {
|
||||||
|
|
|
@ -229,7 +229,7 @@ impl InlineFragmentsAccumulator {
|
||||||
mut fragments,
|
mut fragments,
|
||||||
enclosing_node,
|
enclosing_node,
|
||||||
} = self;
|
} = self;
|
||||||
if let Some(enclosing_style) = enclosing_style {
|
if let Some(enclosing_node) = enclosing_node {
|
||||||
let frag_len = fragments.fragments.len();
|
let frag_len = fragments.fragments.len();
|
||||||
for (idx, frag) in fragments.fragments.iter_mut().enumerate() {
|
for (idx, frag) in fragments.fragments.iter_mut().enumerate() {
|
||||||
|
|
||||||
|
|
|
@ -807,11 +807,6 @@ impl LayoutTask {
|
||||||
ScrollPolicy::Scrollable));
|
ScrollPolicy::Scrollable));
|
||||||
let origin = Rect(Point2D(Au(0), Au(0)), root_size);
|
let origin = Rect(Point2D(Au(0), Au(0)), root_size);
|
||||||
|
|
||||||
if opts::get().dump_display_list {
|
|
||||||
println!("#### start printing display list.");
|
|
||||||
display_list.print_items(String::from_str("#"));
|
|
||||||
}
|
|
||||||
|
|
||||||
let stacking_context = Arc::new(StackingContext::new(display_list,
|
let stacking_context = Arc::new(StackingContext::new(display_list,
|
||||||
&origin,
|
&origin,
|
||||||
&origin,
|
&origin,
|
||||||
|
@ -821,6 +816,11 @@ impl LayoutTask {
|
||||||
mix_blend_mode::T::normal,
|
mix_blend_mode::T::normal,
|
||||||
Some(paint_layer)));
|
Some(paint_layer)));
|
||||||
|
|
||||||
|
if opts::get().dump_display_list {
|
||||||
|
println!("#### start printing display list.");
|
||||||
|
stacking_context.print(String::from_str("#"));
|
||||||
|
}
|
||||||
|
|
||||||
rw_data.stacking_context = Some(stacking_context.clone());
|
rw_data.stacking_context = Some(stacking_context.clone());
|
||||||
|
|
||||||
debug!("Layout done!");
|
debug!("Layout done!");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue