aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJunyoung Cho <june0.cho@samsung.com>2013-08-22 20:06:48 +0900
committerJunyoung Cho <june0.cho@samsung.com>2013-08-22 20:06:48 +0900
commit672d7f1c317077246d700d2d58c439a2df9266ae (patch)
treee1a4b5d3e7c986f86ca59f50449bef755f44982f /src
parent127c7b9066c8b18fb3687e0e264c13162b05b43b (diff)
downloadservo-672d7f1c317077246d700d2d58c439a2df9266ae.tar.gz
servo-672d7f1c317077246d700d2d58c439a2df9266ae.zip
Update linebox's height which is changed by vertical-align.
Diffstat (limited to 'src')
-rw-r--r--src/components/main/layout/inline.rs10
-rw-r--r--src/test/html/test-lineheight-verticalalign.html13
2 files changed, 22 insertions, 1 deletions
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 @@
+<!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>