servo: Merge #11127 - Support text-align in geckolib (from heycam:text-align); r=bholley
authorCameron McCormack <cam@mcc.id.au>
Wed, 11 May 2016 22:53:56 -0700
changeset 338781 cd91c8e1c8d17861a6a27f2fe1836709791451af
parent 338780 a6f822ccae446fc0221a2aeff19fff99e2e6471b
child 338782 f0577405dec276feed77cdc2937ee8e0e9eca3da
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)
reviewersbholley
servo: Merge #11127 - Support text-align in geckolib (from heycam:text-align); r=bholley We don't yet support the 'unsafe' keyword, which isn't in a spec yet, and which would require slightly more complex parsing. Source-Repo: https://github.com/servo/servo Source-Revision: f12869d2a75081eefeacbe4afe50e870bf0c07cb
servo/components/style/properties/longhand/inherited_text.mako.rs
servo/ports/geckolib/gecko_bindings/structs.rs
servo/ports/geckolib/properties.mako.rs
--- a/servo/components/style/properties/longhand/inherited_text.mako.rs
+++ b/servo/components/style/properties/longhand/inherited_text.mako.rs
@@ -131,19 +131,26 @@
         }
         define_text_align! {
             start("start") => 0,
             end("end") => 1,
             left("left") => 2,
             right("right") => 3,
             center("center") => 4,
             justify("justify") => 5,
+            % if product == "servo":
             servo_center("-servo-center") => 6,
             servo_left("-servo-left") => 7,
             servo_right("-servo-right") => 8,
+            % else:
+            _moz_center("-moz-center") => 6,
+            _moz_left("-moz-left") => 7,
+            _moz_right("-moz-right") => 8,
+            match_parent("match-parent") => 9,
+            % endif
         }
     }
     #[inline] pub fn get_initial_value() -> computed_value::T {
         computed_value::T::start
     }
     pub fn parse(_context: &ParserContext, input: &mut Parser)
                  -> Result<SpecifiedValue, ()> {
         computed_value::T::parse(input)
--- a/servo/ports/geckolib/gecko_bindings/structs.rs
+++ b/servo/ports/geckolib/gecko_bindings/structs.rs
@@ -530,17 +530,17 @@ pub const NS_STYLE_OBJECT_FIT_FILL: ::st
 pub const NS_STYLE_OBJECT_FIT_CONTAIN: ::std::os::raw::c_uint = 1;
 pub const NS_STYLE_OBJECT_FIT_COVER: ::std::os::raw::c_uint = 2;
 pub const NS_STYLE_OBJECT_FIT_NONE: ::std::os::raw::c_uint = 3;
 pub const NS_STYLE_OBJECT_FIT_SCALE_DOWN: ::std::os::raw::c_uint = 4;
 pub const NS_STYLE_RESIZE_NONE: ::std::os::raw::c_uint = 0;
 pub const NS_STYLE_RESIZE_BOTH: ::std::os::raw::c_uint = 1;
 pub const NS_STYLE_RESIZE_HORIZONTAL: ::std::os::raw::c_uint = 2;
 pub const NS_STYLE_RESIZE_VERTICAL: ::std::os::raw::c_uint = 3;
-pub const NS_STYLE_TEXT_ALIGN_DEFAULT: ::std::os::raw::c_uint = 0;
+pub const NS_STYLE_TEXT_ALIGN_START: ::std::os::raw::c_uint = 0;
 pub const NS_STYLE_TEXT_ALIGN_LEFT: ::std::os::raw::c_uint = 1;
 pub const NS_STYLE_TEXT_ALIGN_RIGHT: ::std::os::raw::c_uint = 2;
 pub const NS_STYLE_TEXT_ALIGN_CENTER: ::std::os::raw::c_uint = 3;
 pub const NS_STYLE_TEXT_ALIGN_JUSTIFY: ::std::os::raw::c_uint = 4;
 pub const NS_STYLE_TEXT_ALIGN_CHAR: ::std::os::raw::c_uint = 5;
 pub const NS_STYLE_TEXT_ALIGN_END: ::std::os::raw::c_uint = 6;
 pub const NS_STYLE_TEXT_ALIGN_AUTO: ::std::os::raw::c_uint = 7;
 pub const NS_STYLE_TEXT_ALIGN_MOZ_CENTER: ::std::os::raw::c_uint = 8;
--- a/servo/ports/geckolib/properties.mako.rs
+++ b/servo/ports/geckolib/properties.mako.rs
@@ -662,16 +662,25 @@ fn static_assert() {
     fn copy_list_style_type_from(&mut self, other: &Self) {
         unsafe {
             Gecko_CopyListStyleTypeFrom(&mut self.gecko, &other.gecko);
         }
     }
 
 </%self:impl_trait>
 
+<%self:impl_trait style_struct_name="InheritedText"
+                  skip_longhands="text-align">
+
+    <% text_align_keyword = Keyword("text-align", "start end left right center justify -moz-center -moz-left " +
+                                                  "-moz-right match-parent") %>
+    <%call expr="impl_keyword('text_align', 'mTextAlign', text_align_keyword, need_clone=False)"></%call>
+
+</%self:impl_trait>
+
 <%self:impl_trait style_struct_name="Text"
                   skip_longhands="text-decoration-color"
                   skip_additionals="*">
 
     <% impl_color("text_decoration_color", "mTextDecorationColor",
                   color_flags_ffi_name="mTextDecorationStyle") %>
 
     fn has_underline(&self) -> bool {