diff options
author | bors-servo <release+servo@mozilla.com> | 2014-06-05 18:58:30 -0400 |
---|---|---|
committer | bors-servo <release+servo@mozilla.com> | 2014-06-05 18:58:30 -0400 |
commit | d293b469442ddc7de4257c14bcba685218019598 (patch) | |
tree | b201393cd5c0c757079cf24a040949ac99d4bd13 /src | |
parent | 10b1e655b0dfec66fea948f974d41339d796c716 (diff) | |
parent | e96f02718ae59754b1f9e3a1f9bb629475f38ea9 (diff) | |
download | servo-d293b469442ddc7de4257c14bcba685218019598.tar.gz servo-d293b469442ddc7de4257c14bcba685218019598.zip |
auto merge of #2592 : june0cho/servo/fix_vertical_align, r=SimonSapin
It fixes the wrong vertical alignment for img element. (related to #2422, #2554)
Worked with @ryanc
Diffstat (limited to 'src')
-rw-r--r-- | src/components/main/layout/inline.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/components/main/layout/inline.rs b/src/components/main/layout/inline.rs index 5efc5002952..1df0e898401 100644 --- a/src/components/main/layout/inline.rs +++ b/src/components/main/layout/inline.rs @@ -985,7 +985,11 @@ impl InlineFlow { vertical_align::middle => { // TODO: x-height value should be used from font info. let xheight = Au(0); - (-(xheight + fragment.content_height()).scale_by(0.5), false) + let fragment_height = fragment.content_height(); + let offset_top = -(xheight + fragment_height).scale_by(0.5); + *height_above_baseline = offset_top.scale_by(-1.0); + *depth_below_baseline = fragment_height - *height_above_baseline; + (offset_top, false) }, vertical_align::sub => { // TODO: The proper position for subscripts should be used. Lower the baseline to |