mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update linebox's height which is changed by vertical-align.
This commit is contained in:
parent
127c7b9066
commit
672d7f1c31
2 changed files with 22 additions and 1 deletions
|
@ -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 =
|
||||
|
|
13
src/test/html/test-lineheight-verticalalign.html
Normal file
13
src/test/html/test-lineheight-verticalalign.html
Normal 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>
|
Loading…
Add table
Add a link
Reference in a new issue