servo: Merge #7496 - Implement CSS3 Calc (from servo:calc_); r=SimonSapin

This is #7185 with one commit added to make it build merged with master, which got support for the `ch` unit in the meantime.

Source-Repo: https://github.com/servo/servo
Source-Revision: a547ae6826cf171c42b090408a4c20d58d1829d9
This commit is contained in:
Simon Sapin
2015-09-02 02:33:18 -06:00
parent d67af4db2f
commit 3d8a9be409
13 changed files with 545 additions and 63 deletions

View File

@@ -988,6 +988,11 @@ impl InlineFlow {
let percent_offset = line_height.scale_by(p);
offset_from_baseline = offset_from_baseline - percent_offset
}
vertical_align::T::Calc(calc) => {
let line_height = fragment.calculate_line_height(layout_context);
let percent_offset = line_height.scale_by(calc.percentage());
offset_from_baseline = offset_from_baseline - percent_offset - calc.length()
}
}
}
(offset_from_baseline - ascent, largest_size_updated)