Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

layout: Allow inline elements to be containing blocks for absolutely-positioned elements. #5911

Merged
merged 3 commits into from May 13, 2015
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

gfx: Print out stacking context info when dumping display lists.

  • Loading branch information
pcwalton committed May 13, 2015
commit 711993eb46db252057248d98fe8a17407d5ef923
@@ -58,6 +58,8 @@ pub mod optimizer;
/// items that involve a blur. This ensures that the display item boundaries include all the ink.
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
/// 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.
pub fn print_items(&self, mut 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);
}

pub fn print_items(&self, indentation: String) {
// Closures are so nice!
let doit = |items: &Vec<DisplayItem>| {
for item in items.iter() {
@@ -221,8 +210,9 @@ impl DisplayList {
println!("{} Children stacking contexts list length: {}",
indentation,
self.children.len());
for sublist in self.children.iter() {
sublist.display_list.print_items(indentation.clone()+&indentation[0..min_length]);
for stacking_context in self.children.iter() {
stacking_context.print(indentation.clone() +
&indentation[0..MIN_INDENTATION_LENGTH]);
}
}
}
@@ -571,6 +561,27 @@ impl StackingContext {
topmost_only,
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 {
@@ -229,7 +229,7 @@ impl InlineFragmentsAccumulator {
mut fragments,
enclosing_node,
} = self;
if let Some(enclosing_style) = enclosing_style {
if let Some(enclosing_node) = enclosing_node {
let frag_len = fragments.fragments.len();
for (idx, frag) in fragments.fragments.iter_mut().enumerate() {

@@ -807,11 +807,6 @@ impl LayoutTask {
ScrollPolicy::Scrollable));
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,
&origin,
&origin,
@@ -821,6 +816,11 @@ impl LayoutTask {
mix_blend_mode::T::normal,
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());

debug!("Layout done!");
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.