Skip to content

Commit

Permalink
Support 'word-spacing' for geckolib
Browse files Browse the repository at this point in the history
  • Loading branch information
wafflespeanut committed Aug 10, 2016
1 parent 944cbbf commit 69c422f
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion components/style/properties/gecko.mako.rs
Expand Up @@ -1177,7 +1177,7 @@ fn static_assert() {
</%self:impl_trait>

<%self:impl_trait style_struct_name="InheritedText"
skip_longhands="text-align line-height">
skip_longhands="text-align line-height word-spacing">

<% text_align_keyword = Keyword("text-align", "start end left right center justify -moz-center -moz-left " +
"-moz-right match-parent") %>
Expand Down Expand Up @@ -1213,6 +1213,22 @@ fn static_assert() {

<%call expr="impl_coord_copy('line_height', 'mLineHeight')"></%call>

pub fn set_word_spacing(&mut self, v: longhands::word_spacing::computed_value::T) {
use values::computed::LengthOrPercentage::*;

match v.0 {
Some(lop) => match lop {
Length(au) => self.gecko.mWordSpacing.set_value(CoordDataValue::Coord(au.0)),
Percentage(f) => self.gecko.mWordSpacing.set_value(CoordDataValue::Percent(f)),
Calc(l_p) => self.gecko.mWordSpacing.set_value(CoordDataValue::Calc(l_p.into())),
},
// https://drafts.csswg.org/css-text-3/#valdef-word-spacing-normal
None => self.gecko.mWordSpacing.set_value(CoordDataValue::Coord(0)),
}
}

<%call expr="impl_coord_copy('word_spacing', 'mWordSpacing')"></%call>

</%self:impl_trait>

<%self:impl_trait style_struct_name="Text"
Expand Down

0 comments on commit 69c422f

Please sign in to comment.