Skip to content
Browse files

Force root flow's box size to coincide with the viewport if child

flows have less combined height than the viewport height.

This makes Issue #218 go away in the case when the HTML element's
style specifies a background color.
  • Loading branch information
Brian J. Burg
Brian J. Burg committed Nov 19, 2012
1 parent 02e0734 commit d76195757af998c54a82353b185f40f565d86827
Showing with 20 additions and 3 deletions.
  1. +20 −3 src/servo/layout/
@@ -48,20 +48,37 @@ impl FlowContext : RootLayout {
fn assign_widths_root(@self, ctx: &LayoutContext) {
assert self.starts_root_flow();

self.d().position = copy ctx.screen_size;
self.d().position.origin = Au::zero_point();
self.d().position.size.width = ctx.screen_size.size.width;


fn assign_height_root(@self, ctx: &LayoutContext) {
assert self.starts_root_flow();

// this is essentially the same as assign_height_block(), except
// the root adjusts self height to at least cover the viewport.
let mut cur_y = Au(0);

for FlowTree.each_child(self) |child_ctx| {
child_ctx.d().position.origin.y = cur_y;
cur_y += child_ctx.d().position.size.height;

self.d().position.size.height = Au::max(ctx.screen_size.size.height, cur_y);

do self.with_block_box |box| {
box.d().position.origin.y = Au(0);
box.d().position.size.height = Au::max(ctx.screen_size.size.height, cur_y);
let (_used_top, _used_bot) = box.get_used_height();

fn build_display_list_root(@self, builder: &DisplayListBuilder, dirty: &Rect<Au>,
offset: &Point2D<Au>, list: &mut DisplayList) {
assert self.starts_root_flow();

self.build_display_list_block(builder, dirty, offset, list);

0 comments on commit d761957

Please sign in to comment.
You can’t perform that action at this time.