servo: Merge #12795 - Support 'word-spacing' for geckolib (from Wafflespeanut:word_spacing); r=Manishearth
authorRavi Shankar <wafflespeanut@gmail.com>
Thu, 11 Aug 2016 22:02:01 -0500
changeset 339480 aa7b1288feb658f367d4997b4ccee99bf72078fd
parent 339479 0c5058d27b3987c227c29bf903951feb19da43ba
child 339481 e5a914814ebf8b46c6f483035a2885ac757e3008
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersManishearth
servo: Merge #12795 - Support 'word-spacing' for geckolib (from Wafflespeanut:word_spacing); r=Manishearth **These changes haven't been tested yet!** --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] There are tests for these changes Source-Repo: https://github.com/servo/servo Source-Revision: a22913569c2fa917015b23c27cb2f55de2a69ff2
servo/components/style/properties/gecko.mako.rs
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -1168,17 +1168,17 @@ fn static_assert() {
         unsafe {
             Gecko_CopyListStyleTypeFrom(&mut self.gecko, &other.gecko);
         }
     }
 
 </%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") %>
     ${impl_keyword('text_align', 'mTextAlign', text_align_keyword, need_clone=False)}
 
     pub fn set_line_height(&mut self, v: longhands::line_height::computed_value::T) {
         use properties::longhands::line_height::computed_value::T;
         // FIXME: Align binary representations and ditch |match| for cast + static_asserts
@@ -1204,16 +1204,32 @@ fn static_assert() {
                 debug_assert!(false);
                 T::MozBlockHeight
             }
         }
     }
 
     <%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"
                   skip_longhands="text-decoration-color text-decoration-line"
                   skip_additionals="*">
 
     ${impl_color("text_decoration_color", "mTextDecorationColor",
                   color_flags_ffi_name="mTextDecorationStyle", need_clone=True)}