Auto merge of #6980 - pcwalton:inline-border-baseline, r=glennw

layout: Take borders into account when positioning inline fragments on their baselines.

Improves the Rust GitHub page.

r? @glennw

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6980)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-08-05 05:03:43 -06:00
commit cc70e2f91f
4 changed files with 27 additions and 4 deletions

View file

@ -1818,15 +1818,23 @@ impl Fragment {
.computed_block_size();
InlineMetrics {
block_size_above_baseline: computed_block_size +
self.border_padding.block_start_end(),
depth_below_baseline: Au(0),
ascent: computed_block_size + self.border_padding.block_start_end(),
self.border_padding.block_start,
depth_below_baseline: self.border_padding.block_end,
ascent: computed_block_size + self.border_padding.block_start,
}
}
SpecificFragmentInfo::ScannedText(ref text_fragment) => {
// See CSS 2.1 § 10.8.1.
let line_height = self.calculate_line_height(layout_context);
InlineMetrics::from_font_metrics(&text_fragment.run.font_metrics, line_height)
let font_derived_metrics =
InlineMetrics::from_font_metrics(&text_fragment.run.font_metrics, line_height);
InlineMetrics {
block_size_above_baseline: font_derived_metrics.block_size_above_baseline +
self.border_padding.block_start,
depth_below_baseline: font_derived_metrics.depth_below_baseline +
self.border_padding.block_end,
ascent: font_derived_metrics.ascent + self.border_padding.block_start,
}
}
SpecificFragmentInfo::InlineBlock(ref info) => {
// See CSS 2.1 § 10.8.1.