Update linebox's height which is changed by vertical-align.

This commit is contained in:
Junyoung Cho 2013-08-22 20:06:48 +09:00
parent 127c7b9066
commit 672d7f1c31
2 changed files with 22 additions and 1 deletions

View file

@ -609,8 +609,10 @@ impl InlineFlowData {
let mut scanner = LineboxScanner::new(scanner_floats);
scanner.scan_for_lines(self);
let mut line_height_offset = Au(0);
// Now, go through each line and lay out the boxes inside
for line in self.lines.iter() {
for line in self.lines.mut_iter() {
// We need to distribute extra width based on text-align.
let mut slack_width = line.green_zone.width - line.bounds.size.width;
if slack_width < Au(0) {
@ -663,6 +665,10 @@ impl InlineFlowData {
}
};
// Update the line's y position before setting the box's y position
// since the previous line's height can be modified.
line.bounds.origin.y = line.bounds.origin.y + line_height_offset;
let mut topmost = Au(0);
let mut bottommost = Au(0);
// bottommost of boxes with 'top' value
@ -857,6 +863,8 @@ impl InlineFlowData {
base.position.origin.y = base.position.origin.y + adjust_offset;
}
}
line_height_offset = topmost + bottommost - line.bounds.size.height;
line.bounds.size.height = topmost + bottommost;
} // End of `lines.each` loop.
self.common.position.size.height =

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div style="line-height: 10;">[line-height 10]
<span style="font-size: 15pt; line-height: 3; vertical-align: top">[line-height:3 + vertical-align:top]</span>
<span style="font-size: 15pt; line-height: 1; vertical-align: top">[line-height:1 + vertical-align:top]</span>
[Split inline, still line-height 5]
</div>
<div style="font-size: 30px; line-height: 3">New line, line-height 3</div>
</body>
</html>