diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-03-13 10:26:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-13 10:26:37 -0400 |
commit | d5fb0666d1102dd197e6ca478b3cf730397a7d38 (patch) | |
tree | ba85ff8131ef6889c3ae67e629d534d1f931e86f /components/layout/text.rs | |
parent | c12e341c0ce9fcd8c3f71905b9b379af802bff04 (diff) | |
parent | b42342a27381d644f5817eb4530252c4c142d4e9 (diff) | |
download | servo-d5fb0666d1102dd197e6ca478b3cf730397a7d38.tar.gz servo-d5fb0666d1102dd197e6ca478b3cf730397a7d38.zip |
Auto merge of #23017 - emilio:gecko-sync, r=emilio
style: Sync changes from mozilla-central.
See each individual commit for details.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23017)
<!-- Reviewable:end -->
Diffstat (limited to 'components/layout/text.rs')
-rw-r--r-- | components/layout/text.rs | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/components/layout/text.rs b/components/layout/text.rs index aba5703a1c6..b26e531e670 100644 --- a/components/layout/text.rs +++ b/components/layout/text.rs @@ -14,7 +14,6 @@ use gfx::font::{FontMetrics, FontRef, RunMetrics, ShapingFlags, ShapingOptions}; use gfx::text::glyph::ByteIndex; use gfx::text::text_run::TextRun; use gfx::text::util::{self, CompressionMode}; -use ordered_float::NotNan; use range::Range; use servo_atoms::Atom; use std::borrow::ToOwned; @@ -196,11 +195,7 @@ impl TextRunScanner { }; text_transform = inherited_text_style.text_transform; letter_spacing = inherited_text_style.letter_spacing; - word_spacing = inherited_text_style - .word_spacing - .value() - .map(|lop| lop.to_hash_key()) - .unwrap_or((Au(0), NotNan::new(0.0).unwrap())); + word_spacing = inherited_text_style.word_spacing.to_hash_key(); text_rendering = inherited_text_style.text_rendering; word_break = inherited_text_style.word_break; } @@ -321,10 +316,8 @@ impl TextRunScanner { // example, `finally` with a wide `letter-spacing` renders as `f i n a l l y` and not // `fi n a l l y`. let mut flags = ShapingFlags::empty(); - if let Some(v) = letter_spacing.value() { - if v.px() != 0. { - flags.insert(ShapingFlags::IGNORE_LIGATURES_SHAPING_FLAG); - } + if letter_spacing.0.px() != 0. { + flags.insert(ShapingFlags::IGNORE_LIGATURES_SHAPING_FLAG); } if text_rendering == TextRendering::Optimizespeed { flags.insert(ShapingFlags::IGNORE_LIGATURES_SHAPING_FLAG); @@ -334,8 +327,12 @@ impl TextRunScanner { flags.insert(ShapingFlags::KEEP_ALL_FLAG); } let options = ShapingOptions { - letter_spacing: letter_spacing.value().cloned().map(Au::from), - word_spacing: word_spacing, + letter_spacing: if letter_spacing.0.px() == 0. { + None + } else { + Some(Au::from(letter_spacing.0)) + }, + word_spacing, script: Script::Common, flags: flags, }; |