1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
use au = gfx::geometry;
use css::values::*;
use geom::point::Point2D;
use geom::rect::Rect;
use gfx::display_list::{DisplayList, DisplayListBuilder};
use gfx::geometry::Au;
use layout::box::RenderBox;
use layout::context::LayoutContext;
use layout::flow::{FlowContext, FlowTree, InlineBlockFlow, BlockFlow, RootFlow};
use util::tree;
struct RootFlowData {
mut box: Option<@RenderBox>
}
fn RootFlowData() -> RootFlowData {
RootFlowData {
box: None
}
}
trait RootLayout {
pure fn starts_root_flow() -> bool;
fn bubble_widths_root(@self, ctx: &LayoutContext);
fn assign_widths_root(@self, ctx: &LayoutContext);
fn assign_height_root(@self, ctx: &LayoutContext);
fn build_display_list_root(@self, a: &DisplayListBuilder, b: &Rect<Au>,
c: &Point2D<Au>, d: &mut DisplayList);
}
impl FlowContext : RootLayout {
pure fn starts_root_flow() -> bool {
match self {
RootFlow(*) => true,
_ => false
}
}
/* defer to the block algorithm */
fn bubble_widths_root(@self, ctx: &LayoutContext) {
assert self.starts_root_flow();
self.bubble_widths_block(ctx)
}
fn assign_widths_root(@self, ctx: &LayoutContext) {
assert self.starts_root_flow();
self.d().position = copy ctx.screen_size;
self.assign_widths_block(ctx)
}
fn assign_height_root(@self, ctx: &LayoutContext) {
assert self.starts_root_flow();
self.assign_height_block(ctx);
}
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);
}
}
|