diff --git a/src/components/main/layout/inline.rs b/src/components/main/layout/inline.rs index 60b940130a2..44d5595444e 100644 --- a/src/components/main/layout/inline.rs +++ b/src/components/main/layout/inline.rs @@ -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 = diff --git a/src/test/html/test-lineheight-verticalalign.html b/src/test/html/test-lineheight-verticalalign.html new file mode 100644 index 00000000000..e9fcd0019f3 --- /dev/null +++ b/src/test/html/test-lineheight-verticalalign.html @@ -0,0 +1,13 @@ + + + + + +
[line-height 10] + [line-height:3 + vertical-align:top] + [line-height:1 + vertical-align:top] + [Split inline, still line-height 5] +
+
New line, line-height 3
+ +