Bug 1354053 - Use from_gecko_style_corrd() to convert CoordDataValue to Option<T> for letter-spacing. r?emilio
MozReview-Commit-ID: 5aFQZYB6vZF
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -2879,21 +2879,22 @@ fn static_assert() {
match v.0 {
Some(au) => self.gecko.mLetterSpacing.set(au),
None => self.gecko.mLetterSpacing.set_value(CoordDataValue::Normal)
}
}
pub fn clone_letter_spacing(&self) -> longhands::letter_spacing::computed_value::T {
use properties::longhands::letter_spacing::computed_value::T;
- match self.gecko.mLetterSpacing.as_value() {
- CoordDataValue::Normal => T(None),
- CoordDataValue::Coord(coord) => T(Some(Au(coord))),
- _ => unreachable!("Unexpected computed value for letter-spacing"),
- }
+ debug_assert!(
+ matches!(self.gecko.mLetterSpacing.as_value(),
+ CoordDataValue::Normal |
+ CoordDataValue::Coord(_)),
+ "Unexpected computed value for letter-spacing");
+ T(Au::from_gecko_style_coord(&self.gecko.mLetterSpacing))
}
<%call expr="impl_coord_copy('letter_spacing', 'mLetterSpacing')"></%call>
pub fn set_word_spacing(&mut self, v: longhands::word_spacing::computed_value::T) {
match v.0 {
Some(lop) => self.gecko.mWordSpacing.set(lop),
// https://drafts.csswg.org/css-text-3/#valdef-word-spacing-normal