diff options
author | Glenn Watson <gw@intuitionlibrary.com> | 2016-02-18 07:57:31 +1000 |
---|---|---|
committer | Glenn Watson <gw@intuitionlibrary.com> | 2016-02-18 10:35:29 +1000 |
commit | c0531c312fdb0783e4d121b4c2d7f15d4f5cdc1f (patch) | |
tree | ced94496eb3f3b4149f1c2d3b0b02422bb3b5471 /components/layout/inline.rs | |
parent | f7f0eea47035f4316d09db26315bf8ebb72637c9 (diff) | |
download | servo-c0531c312fdb0783e4d121b4c2d7f15d4f5cdc1f.tar.gz servo-c0531c312fdb0783e4d121b4c2d7f15d4f5cdc1f.zip |
Add WebRender integration to Servo.
WebRender is an experimental GPU accelerated rendering backend for Servo.
The WebRender backend can be specified by running Servo with the -w option (otherwise the default rendering backend will be used).
WebRender has many bugs, and missing features - but it is usable to browse most websites - please report any WebRender specific rendering bugs you encounter!
Diffstat (limited to 'components/layout/inline.rs')
-rw-r--r-- | components/layout/inline.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/components/layout/inline.rs b/components/layout/inline.rs index d20fb2224a1..1516fd636eb 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -1928,9 +1928,14 @@ impl InlineMetrics { #[inline] pub fn from_font_metrics(font_metrics: &FontMetrics, line_height: Au) -> InlineMetrics { let leading = line_height - (font_metrics.ascent + font_metrics.descent); + // Calculating the half leading here and then using leading - half_leading + // below ensure that we don't introduce any rounding accuracy issues here. + // The invariant is that the resulting total line height must exactly + // equal the requested line_height. + let half_leading = leading.scale_by(0.5); InlineMetrics { - block_size_above_baseline: font_metrics.ascent + leading.scale_by(0.5), - depth_below_baseline: font_metrics.descent + leading.scale_by(0.5), + block_size_above_baseline: font_metrics.ascent + half_leading, + depth_below_baseline: font_metrics.descent + leading - half_leading, ascent: font_metrics.ascent, } } |