servo: Merge #10324 - Renamed the style structs (from perlun:rename-style-structs); r=bholley
authorPer Lundberg <perlun@gmail.com>
Sat, 09 Apr 2016 00:54:58 +0500
changeset 338459 66fbbae4bf8b5708f3a2d85fb99080af280bc071
parent 338458 3e830a437726c75bff889a5210a1c49bd20aa38a
child 338460 bc7e0b8097ece9c8cdf218722c1e51686e2ec72b
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 #10324 - Renamed the style structs (from perlun:rename-style-structs); r=bholley Renamed style structs. The idea is to rename all style structs from Foo to ServoFoo, as described out in #10185. Source-Repo: https://github.com/servo/servo Source-Revision: 4da38cdd7c26d24d6c9de75d3f3509ae372dd25b
servo/components/gfx/font.rs
servo/components/layout/display_list_builder.rs
servo/components/layout/query.rs
servo/components/layout/text.rs
servo/components/style/properties.mako.rs
servo/ports/geckolib/build.rs
servo/ports/geckolib/properties.mako.rs
--- a/servo/components/gfx/font.rs
+++ b/servo/components/gfx/font.rs
@@ -11,17 +11,17 @@ use platform::font_template::FontTemplat
 use smallvec::SmallVec;
 use std::borrow::ToOwned;
 use std::cell::RefCell;
 use std::rc::Rc;
 use std::str;
 use std::sync::Arc;
 use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering};
 use style::computed_values::{font_stretch, font_variant, font_weight};
-use style::properties::style_structs::Font as FontStyle;
+use style::properties::style_structs::ServoFont;
 use text::Shaper;
 use text::glyph::{GlyphId, GlyphStore};
 use text::shaping::ShaperMethods;
 use time;
 use unicode_script::Script;
 use util::cache::HashCache;
 use webrender_traits;
 
@@ -83,17 +83,17 @@ pub struct FontMetrics {
     pub em_size:          Au,
     pub ascent:           Au,
     pub descent:          Au,
     pub max_advance:      Au,
     pub average_advance:  Au,
     pub line_gap:         Au,
 }
 
-pub type SpecifiedFontStyle = FontStyle;
+pub type SpecifiedFontStyle = ServoFont;
 
 #[derive(Debug)]
 pub struct Font {
     pub handle: FontHandle,
     pub metrics: FontMetrics,
     pub variant: font_variant::T,
     pub descriptor: FontTemplateDescriptor,
     pub requested_pt_size: Au,
@@ -261,9 +261,8 @@ impl RunMetrics {
     }
 }
 
 pub fn get_and_reset_text_shaping_performance_counter() -> usize {
     let value = TEXT_SHAPING_PERFORMANCE_COUNTER.load(Ordering::SeqCst);
     TEXT_SHAPING_PERFORMANCE_COUNTER.store(0, Ordering::SeqCst);
     value
 }
-
--- a/servo/components/layout/display_list_builder.rs
+++ b/servo/components/layout/display_list_builder.rs
@@ -45,17 +45,17 @@ use std::sync::Arc;
 use std::{cmp, f32};
 use style::computed_values::filter::Filter;
 use style::computed_values::{_servo_overflow_clip_box as overflow_clip_box};
 use style::computed_values::{background_attachment, background_clip, background_origin};
 use style::computed_values::{background_repeat, background_size};
 use style::computed_values::{border_style, image_rendering, overflow_x, position};
 use style::computed_values::{transform, transform_style, visibility};
 use style::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode};
-use style::properties::style_structs::Border;
+use style::properties::style_structs::ServoBorder;
 use style::properties::{self, ComputedValues, ServoComputedValues};
 use style::values::RGBA;
 use style::values::computed;
 use style::values::computed::{LengthOrNone, LengthOrPercentage, LengthOrPercentageOrAuto, LinearGradient};
 use style::values::specified::{AngleOrCorner, HorizontalDirection, VerticalDirection};
 use style_traits::cursor::Cursor;
 use table_cell::CollapsedBordersForCell;
 use url::Url;
@@ -301,17 +301,17 @@ fn handle_overlapping_radii(size: &Size2
     let min_factor = top_factor.min(bottom_factor).min(left_factor).min(right_factor);
     if min_factor < 1.0 {
         radii.scale_by(min_factor)
     } else {
         *radii
     }
 }
 
-fn build_border_radius(abs_bounds: &Rect<Au>, border_style: &Border) -> BorderRadii<Au> {
+fn build_border_radius(abs_bounds: &Rect<Au>, border_style: &ServoBorder) -> BorderRadii<Au> {
     // TODO(cgaebel): Support border radii even in the case of multiple border widths.
     // This is an extension of supporting elliptical radii. For now, all percentage
     // radii will be relative to the width.
 
     handle_overlapping_radii(&abs_bounds.size, &BorderRadii {
         top_left:     model::specified_border_radius(border_style.border_top_left_radius,
                                                      abs_bounds.size.width),
         top_right:    model::specified_border_radius(border_style.border_top_right_radius,
--- a/servo/components/layout/query.rs
+++ b/servo/components/layout/query.rs
@@ -383,17 +383,17 @@ impl ParentOffsetBorderBoxIterator {
             node_border_box: Rect::zero(),
             parent_nodes: Vec::new(),
         }
     }
 }
 
 impl FragmentBorderBoxIterator for FragmentLocatingFragmentIterator {
     fn process(&mut self, fragment: &Fragment, _: i32, border_box: &Rect<Au>) {
-        let style_structs::Border {
+        let style_structs::ServoBorder {
             border_top_width: top_width,
             border_right_width: right_width,
             border_bottom_width: bottom_width,
             border_left_width: left_width,
             ..
         } = *fragment.style.get_border();
         self.client_rect.origin.y = top_width.to_px();
         self.client_rect.origin.x = left_width.to_px();
@@ -409,17 +409,17 @@ impl FragmentBorderBoxIterator for Fragm
 // https://drafts.csswg.org/cssom-view/#scrolling-area
 impl FragmentBorderBoxIterator for UnioningFragmentScrollAreaIterator {
     fn process(&mut self, fragment: &Fragment, level: i32, border_box: &Rect<Au>) {
         // In cases in which smaller child elements contain less padding than the parent
         // the a union of the two elements padding rectangles could result in an unwanted
         // increase in size. To work around this, we store the original elements padding
         // rectangle as `origin_rect` and the union of all child elements padding and
         // margin rectangles as `union_rect`.
-        let style_structs::Border {
+        let style_structs::ServoBorder {
             border_top_width: top_border,
             border_right_width: right_border,
             border_bottom_width: bottom_border,
             border_left_width: left_border,
             ..
         } = *fragment.style.get_border();
         let right_padding = (border_box.size.width - right_border - left_border).to_px();
         let bottom_padding = (border_box.size.height - bottom_border - top_border).to_px();
--- a/servo/components/layout/text.rs
+++ b/servo/components/layout/text.rs
@@ -19,17 +19,17 @@ use inline::InlineFragments;
 use range::{Range, RangeIndex};
 use std::borrow::ToOwned;
 use std::collections::LinkedList;
 use std::mem;
 use std::sync::Arc;
 use style::computed_values::{line_height, text_orientation, text_rendering, text_transform};
 use style::computed_values::{white_space};
 use style::logical_geometry::{LogicalSize, WritingMode};
-use style::properties::style_structs::Font as FontStyle;
+use style::properties::style_structs::ServoFont;
 use style::properties::{ComputedValues, ServoComputedValues};
 use unicode_bidi::{is_rtl, process_text};
 use unicode_script::{get_script, Script};
 use util::linked_list::split_off_head;
 
 /// Returns the concatenated text of a list of unscanned text fragments.
 fn text(fragments: &LinkedList<Fragment>) -> String {
     // FIXME: Some of this work is later duplicated in split_first_fragment_at_newline_if_necessary
@@ -404,21 +404,21 @@ fn bounding_box_for_run_metrics(metrics:
     // This will need to be updated when other text orientations are supported.
     LogicalSize::new(
         writing_mode,
         metrics.bounding_box.size.width,
         metrics.bounding_box.size.height)
 
 }
 
-/// Returns the metrics of the font represented by the given `FontStyle`, respectively.
+/// Returns the metrics of the font represented by the given `ServoFont`, respectively.
 ///
 /// `#[inline]` because often the caller only needs a few fields from the font metrics.
 #[inline]
-pub fn font_metrics_for_style(font_context: &mut FontContext, font_style: Arc<FontStyle>)
+pub fn font_metrics_for_style(font_context: &mut FontContext, font_style: Arc<ServoFont>)
                               -> FontMetrics {
     let fontgroup = font_context.layout_font_group_for_style(font_style);
     // FIXME(https://github.com/rust-lang/rust/issues/23338)
     let font = fontgroup.fonts[0].borrow();
     font.metrics.clone()
 }
 
 /// Returns the line block-size needed by the given computed style and font size.
--- a/servo/components/style/properties.mako.rs
+++ b/servo/components/style/properties.mako.rs
@@ -107,22 +107,25 @@ class Method(object):
             sig = sig + " -> " + self.return_type
         return sig
     def declare(self):
         return self.signature() + ";"
     def stub(self):
         return self.signature() + "{ unimplemented!() }"
 
 class StyleStruct(object):
-    def __init__(self, name, inherited, gecko_name, additional_methods):
-        self.name = name
-        self.ident = to_rust_ident(name.lower())
+    def __init__(self, name, inherited, gecko_ffi_name, additional_methods):
+        self.servo_struct_name = "Servo" + name
+        self.gecko_struct_name = "Gecko" + name
+        self.trait_name = name
+        self.trait_name_lower = name.lower()
+        self.ident = to_rust_ident(self.trait_name_lower)
         self.longhands = []
         self.inherited = inherited
-        self.gecko_name = gecko_name
+        self.gecko_ffi_name = gecko_ffi_name
         self.additional_methods = additional_methods or []
 
 STYLE_STRUCTS = []
 THIS_STYLE_STRUCT = None
 LONGHANDS = []
 LONGHANDS_BY_NAME = {}
 DERIVED_LONGHANDS = {}
 SHORTHANDS = []
@@ -139,20 +142,20 @@ def new_style_struct(name, is_inherited,
     STYLE_STRUCTS.append(style_struct)
     THIS_STYLE_STRUCT = style_struct
     return ""
 
 def switch_to_style_struct(name):
     global THIS_STYLE_STRUCT
 
     for style_struct in STYLE_STRUCTS:
-        if style_struct.name == name:
+        if style_struct.trait_name == name:
             THIS_STYLE_STRUCT = style_struct
             return ""
-    fail()
+    raise Exception("Failed to find the struct named " + name)
 %>
 
 // Work around Mako's really annoying namespacing setup.
 //
 // The above code runs when the template is loaded, rather than when it's
 // rendered, so it can create global variables, doesn't have access to
 // arguments passed to render(). On the flip side, there are various situations,
 // such as code in the body of a def-used-as-tag, where our python code has
@@ -194,17 +197,17 @@ pub mod longhands {
                 use cssparser::Parser;
                 use parser::ParserContext;
                 use properties::{CSSWideKeyword, DeclaredValue, Shorthand};
             % endif
             use error_reporting::ParseErrorReporter;
             use properties::longhands;
             use properties::property_bit_field::PropertyBitField;
             use properties::{ComputedValues, ServoComputedValues, PropertyDeclaration};
-            use properties::style_struct_traits::T${THIS_STYLE_STRUCT.name};
+            use properties::style_struct_traits::T${THIS_STYLE_STRUCT.trait_name};
             use properties::style_structs;
             use std::collections::HashMap;
             use std::sync::Arc;
             use values::computed::{TContext, ToComputedValue};
             use values::{computed, specified};
             use string_cache::Atom;
             ${caller.body()}
             #[allow(unused_variables)]
@@ -227,35 +230,36 @@ pub mod longhands {
                     }
                     seen.set_${property.ident}();
                     {
                         let custom_props = context.style().custom_properties();
                         ::properties::substitute_variables_${property.ident}(
                             declared_value, &custom_props, |value| match *value {
                                 DeclaredValue::Value(ref specified_value) => {
                                     let computed = specified_value.to_computed_value(context);
-                                    context.mutate_style().mutate_${THIS_STYLE_STRUCT.name.lower()}()
+                                    context.mutate_style().mutate_${THIS_STYLE_STRUCT.trait_name_lower}()
                                                           .set_${property.ident}(computed);
                                 }
                                 DeclaredValue::WithVariables { .. } => unreachable!(),
                                 DeclaredValue::Initial => {
                                     // We assume that it's faster to use copy_*_from rather than
                                     // set_*(get_initial_value());
-                                    let initial_struct = C::initial_values().get_${THIS_STYLE_STRUCT.name.lower()}();
-                                    context.mutate_style().mutate_${THIS_STYLE_STRUCT.name.lower()}()
+                                    let initial_struct = C::initial_values()
+                                                          .get_${THIS_STYLE_STRUCT.trait_name_lower}();
+                                    context.mutate_style().mutate_${THIS_STYLE_STRUCT.trait_name_lower}()
                                                           .copy_${property.ident}_from(initial_struct);
                                 },
                                 DeclaredValue::Inherit => {
                                     // This is a bit slow, but this is rare so it shouldn't
                                     // matter.
                                     //
                                     // FIXME: is it still?
                                     *cacheable = false;
-                                    let inherited_struct = inherited_style.get_${THIS_STYLE_STRUCT.name.lower()}();
-                                    context.mutate_style().mutate_${THIS_STYLE_STRUCT.name.lower()}()
+                                    let inherited_struct = inherited_style.get_${THIS_STYLE_STRUCT.trait_name_lower}();
+                                    context.mutate_style().mutate_${THIS_STYLE_STRUCT.trait_name_lower}()
                                            .copy_${property.ident}_from(inherited_struct);
                                 }
                             }, error_reporter
                         );
                     }
 
                     % if custom_cascade:
                         cascade_property_custom(declaration,
@@ -6158,17 +6162,17 @@ impl PropertyDeclaration {
         }
     }
 }
 
 pub mod style_struct_traits {
     use super::longhands;
 
     % for style_struct in STYLE_STRUCTS:
-        pub trait T${style_struct.name}: Clone {
+        pub trait T${style_struct.trait_name}: Clone {
             % for longhand in style_struct.longhands:
                 #[allow(non_snake_case)]
                 fn set_${longhand.ident}(&mut self, v: longhands::${longhand.ident}::computed_value::T);
                 #[allow(non_snake_case)]
                 fn copy_${longhand.ident}_from(&mut self, other: &Self);
             % endfor
             % for additional in style_struct.additional_methods:
                 #[allow(non_snake_case)]
@@ -6179,58 +6183,58 @@ pub mod style_struct_traits {
 }
 
 pub mod style_structs {
     use fnv::FnvHasher;
     use super::longhands;
     use std::hash::{Hash, Hasher};
 
     % for style_struct in STYLE_STRUCTS:
-        % if style_struct.name == "Font":
+        % if style_struct.trait_name == "Font":
         #[derive(Clone, HeapSizeOf, Debug)]
         % else:
         #[derive(PartialEq, Clone, HeapSizeOf)]
         % endif
-        pub struct ${style_struct.name} {
+        pub struct ${style_struct.servo_struct_name} {
             % for longhand in style_struct.longhands:
                 pub ${longhand.ident}: longhands::${longhand.ident}::computed_value::T,
             % endfor
-            % if style_struct.name == "Font":
+            % if style_struct.trait_name == "Font":
                 pub hash: u64,
             % endif
         }
-        % if style_struct.name == "Font":
-
-        impl PartialEq for ${style_struct.name} {
-            fn eq(&self, other: &${style_struct.name}) -> bool {
+        % if style_struct.trait_name == "Font":
+
+        impl PartialEq for ${style_struct.servo_struct_name} {
+            fn eq(&self, other: &${style_struct.servo_struct_name}) -> bool {
                 self.hash == other.hash
                 % for longhand in style_struct.longhands:
                     && self.${longhand.ident} == other.${longhand.ident}
                 % endfor
             }
         }
         % endif
 
-        impl super::style_struct_traits::T${style_struct.name} for ${style_struct.name} {
+        impl super::style_struct_traits::T${style_struct.trait_name} for ${style_struct.servo_struct_name} {
             % for longhand in style_struct.longhands:
                 fn set_${longhand.ident}(&mut self, v: longhands::${longhand.ident}::computed_value::T) {
                     self.${longhand.ident} = v;
                 }
                 fn copy_${longhand.ident}_from(&mut self, other: &Self) {
                     self.${longhand.ident} = other.${longhand.ident}.clone();
                 }
             % endfor
-            % if style_struct.name == "Border":
+            % if style_struct.trait_name == "Border":
                 % for side in ["top", "right", "bottom", "left"]:
                 fn border_${side}_is_none_or_hidden_and_has_nonzero_width(&self) -> bool {
                     self.border_${side}_style.none_or_hidden() &&
                     self.border_${side}_width != ::app_units::Au(0)
                 }
                 % endfor
-            % elif style_struct.name == "Box":
+            % elif style_struct.trait_name == "Box":
                 fn clone_display(&self) -> longhands::display::computed_value::T {
                     self.display.clone()
                 }
                 fn clone_position(&self) -> longhands::position::computed_value::T {
                     self.position.clone()
                 }
                 fn is_floated(&self) -> bool {
                     self.float != longhands::float::SpecifiedValue::none
@@ -6239,55 +6243,55 @@ pub mod style_structs {
                     self.overflow_x == longhands::overflow_x::computed_value::T::visible
                 }
                 fn overflow_y_is_visible(&self) -> bool {
                     self.overflow_y.0 == longhands::overflow_x::computed_value::T::visible
                 }
                 fn transition_count(&self) -> usize {
                     self.transition_property.0.len()
                 }
-            % elif style_struct.name == "Color":
+            % elif style_struct.trait_name == "Color":
                 fn clone_color(&self) -> longhands::color::computed_value::T {
                     self.color.clone()
                 }
-            % elif style_struct.name == "Font":
+            % elif style_struct.trait_name == "Font":
                 fn clone_font_size(&self) -> longhands::font_size::computed_value::T {
                     self.font_size.clone()
                 }
                 fn clone_font_weight(&self) -> longhands::font_weight::computed_value::T {
                     self.font_weight.clone()
                 }
                 fn compute_font_hash(&mut self) {
                     // Corresponds to the fields in `gfx::font_template::FontTemplateDescriptor`.
                     let mut hasher: FnvHasher = Default::default();
                     hasher.write_u16(self.font_weight as u16);
                     self.font_stretch.hash(&mut hasher);
                     self.font_family.hash(&mut hasher);
                     self.hash = hasher.finish()
                 }
-            % elif style_struct.name == "InheritedBox":
+            % elif style_struct.trait_name == "InheritedBox":
                 fn clone_direction(&self) -> longhands::direction::computed_value::T {
                     self.direction.clone()
                 }
                 fn clone_writing_mode(&self) -> longhands::writing_mode::computed_value::T {
                     self.writing_mode.clone()
                 }
                 fn clone_text_orientation(&self) -> longhands::text_orientation::computed_value::T {
                     self.text_orientation.clone()
                 }
-            % elif style_struct.name == "InheritedText":
+            % elif style_struct.trait_name == "InheritedText":
                 fn clone__servo_text_decorations_in_effect(&self) ->
                     longhands::_servo_text_decorations_in_effect::computed_value::T {
                     self._servo_text_decorations_in_effect.clone()
                 }
-            % elif style_struct.name == "Outline":
+            % elif style_struct.trait_name == "Outline":
                 fn outline_is_none_or_hidden_and_has_nonzero_width(&self) -> bool {
                     self.outline_style.none_or_hidden() && self.outline_width != ::app_units::Au(0)
                 }
-            % elif style_struct.name == "Text":
+            % elif style_struct.trait_name == "Text":
                 fn has_underline(&self) -> bool {
                     self.text_decoration.underline
                 }
                 fn has_overline(&self) -> bool {
                     self.text_decoration.overline
                 }
                 fn has_line_through(&self) -> bool {
                     self.text_decoration.line_through
@@ -6295,77 +6299,80 @@ pub mod style_structs {
             % endif
         }
 
     % endfor
 }
 
 pub trait ComputedValues : Clone + Send + Sync + 'static {
     % for style_struct in STYLE_STRUCTS:
-        type Concrete${style_struct.name}: style_struct_traits::T${style_struct.name};
+        type Concrete${style_struct.trait_name}: style_struct_traits::T${style_struct.trait_name};
     % endfor
 
         // Temporary bailout case for stuff we haven't made work with the trait
         // yet - panics for non-Servo implementations.
         //
         // Used only for animations. Don't use it in other places.
         fn as_servo<'a>(&'a self) -> &'a ServoComputedValues;
         fn as_servo_mut<'a>(&'a mut self) -> &'a mut ServoComputedValues;
 
         fn new(custom_properties: Option<Arc<::custom_properties::ComputedValuesMap>>,
                shareable: bool,
                writing_mode: WritingMode,
                root_font_size: Au,
         % for style_struct in STYLE_STRUCTS:
-               ${style_struct.ident}: Arc<Self::Concrete${style_struct.name}>,
+               ${style_struct.ident}: Arc<Self::Concrete${style_struct.trait_name}>,
         % endfor
         ) -> Self;
 
         fn initial_values() -> &'static Self;
 
         fn do_cascade_property<F: FnOnce(&Vec<Option<CascadePropertyFn<Self>>>)>(f: F);
 
     % for style_struct in STYLE_STRUCTS:
-        fn clone_${style_struct.name.lower()}(&self) -> Arc<Self::Concrete${style_struct.name}>;
-        fn get_${style_struct.name.lower()}<'a>(&'a self) -> &'a Self::Concrete${style_struct.name};
-        fn mutate_${style_struct.name.lower()}<'a>(&'a mut self) -> &'a mut Self::Concrete${style_struct.name};
+        fn clone_${style_struct.trait_name_lower}(&self) ->
+            Arc<Self::Concrete${style_struct.trait_name}>;
+        fn get_${style_struct.trait_name_lower}<'a>(&'a self) ->
+            &'a Self::Concrete${style_struct.trait_name};
+        fn mutate_${style_struct.trait_name_lower}<'a>(&'a mut self) ->
+            &'a mut Self::Concrete${style_struct.trait_name};
     % endfor
 
     fn custom_properties(&self) -> Option<Arc<::custom_properties::ComputedValuesMap>>;
     fn root_font_size(&self) -> Au;
     fn set_root_font_size(&mut self, size: Au);
     fn set_writing_mode(&mut self, mode: WritingMode);
     fn is_multicol(&self) -> bool;
 }
 
 #[derive(Clone, HeapSizeOf)]
 pub struct ServoComputedValues {
     % for style_struct in STYLE_STRUCTS:
-        ${style_struct.ident}: Arc<style_structs::${style_struct.name}>,
+        ${style_struct.ident}: Arc<style_structs::${style_struct.servo_struct_name}>,
     % endfor
     custom_properties: Option<Arc<::custom_properties::ComputedValuesMap>>,
     shareable: bool,
     pub writing_mode: WritingMode,
     pub root_font_size: Au,
 }
 
 impl ComputedValues for ServoComputedValues {
     % for style_struct in STYLE_STRUCTS:
-        type Concrete${style_struct.name} = style_structs::${style_struct.name};
+        type Concrete${style_struct.trait_name} = style_structs::${style_struct.servo_struct_name};
     % endfor
 
         fn as_servo<'a>(&'a self) -> &'a ServoComputedValues { self }
         fn as_servo_mut<'a>(&'a mut self) -> &'a mut ServoComputedValues { self }
 
         fn new(custom_properties: Option<Arc<::custom_properties::ComputedValuesMap>>,
                shareable: bool,
                writing_mode: WritingMode,
                root_font_size: Au,
             % for style_struct in STYLE_STRUCTS:
-               ${style_struct.ident}: Arc<style_structs::${style_struct.name}>,
+               ${style_struct.ident}: Arc<style_structs::${style_struct.servo_struct_name}>,
             % endfor
         ) -> Self {
             ServoComputedValues {
                 custom_properties: custom_properties,
                 shareable: shareable,
                 writing_mode: writing_mode,
                 root_font_size: root_font_size,
             % for style_struct in STYLE_STRUCTS:
@@ -6377,27 +6384,30 @@ impl ComputedValues for ServoComputedVal
         fn initial_values() -> &'static Self { &*INITIAL_SERVO_VALUES }
 
         fn do_cascade_property<F: FnOnce(&Vec<Option<CascadePropertyFn<Self>>>)>(f: F) {
             CASCADE_PROPERTY.with(|x| f(x));
         }
 
     % for style_struct in STYLE_STRUCTS:
         #[inline]
-        fn clone_${style_struct.name.lower()}(&self) -> Arc<Self::Concrete${style_struct.name}> {
-            self.${style_struct.ident}.clone()
-        }
+        fn clone_${style_struct.trait_name_lower}(&self) ->
+            Arc<Self::Concrete${style_struct.trait_name}> {
+                self.${style_struct.ident}.clone()
+            }
         #[inline]
-        fn get_${style_struct.name.lower()}<'a>(&'a self) -> &'a Self::Concrete${style_struct.name} {
-            &self.${style_struct.ident}
-        }
+        fn get_${style_struct.trait_name_lower}<'a>(&'a self) ->
+            &'a Self::Concrete${style_struct.trait_name} {
+                &self.${style_struct.ident}
+            }
         #[inline]
-        fn mutate_${style_struct.name.lower()}<'a>(&'a mut self) -> &'a mut Self::Concrete${style_struct.name} {
-            Arc::make_mut(&mut self.${style_struct.ident})
-        }
+        fn mutate_${style_struct.trait_name_lower}<'a>(&'a mut self) ->
+            &'a mut Self::Concrete${style_struct.trait_name} {
+                Arc::make_mut(&mut self.${style_struct.ident})
+            }
     % endfor
 
     // Cloning the Arc here is fine because it only happens in the case where we have custom
     // properties, and those are both rare and expensive.
     fn custom_properties(&self) -> Option<Arc<::custom_properties::ComputedValuesMap>> {
         self.custom_properties.as_ref().map(|x| x.clone())
     }
 
@@ -6508,17 +6518,17 @@ impl ServoComputedValues {
             position_style.top,
             position_style.right,
             position_style.bottom,
             position_style.left,
         ))
     }
 
     #[inline]
-    pub fn get_font_arc(&self) -> Arc<style_structs::Font> {
+    pub fn get_font_arc(&self) -> Arc<style_structs::ServoFont> {
         self.font.clone()
     }
 
     // http://dev.w3.org/csswg/css-transforms/#grouping-property-values
     pub fn get_used_transform_style(&self) -> computed_values::transform_style::T {
         use computed_values::mix_blend_mode;
         use computed_values::transform_style;
 
@@ -6629,21 +6639,21 @@ pub fn get_writing_mode<S: style_struct_
     flags
 }
 
 
 /// The initial values for all style structs as defined by the specification.
 lazy_static! {
     pub static ref INITIAL_SERVO_VALUES: ServoComputedValues = ServoComputedValues {
         % for style_struct in STYLE_STRUCTS:
-            ${style_struct.ident}: Arc::new(style_structs::${style_struct.name} {
+            ${style_struct.ident}: Arc::new(style_structs::${style_struct.servo_struct_name} {
                 % for longhand in style_struct.longhands:
                     ${longhand.ident}: longhands::${longhand.ident}::get_initial_value(),
                 % endfor
-                % if style_struct.name == "Font":
+                % if style_struct.trait_name == "Font":
                     hash: 0,
                 % endif
             }),
         % endfor
         custom_properties: None,
         shareable: true,
         writing_mode: WritingMode::empty(),
         root_font_size: longhands::font_size::get_initial_value(),
@@ -6672,63 +6682,63 @@ fn cascade_with_cached_declarations<C: C
             WritingMode::empty(),
             parent_style.root_font_size(),
             % for style_struct in STYLE_STRUCTS:
                 % if style_struct.inherited:
                     parent_style
                 % else:
                     cached_style
                 % endif
-                    .clone_${style_struct.name.lower()}(),
+                    .clone_${style_struct.trait_name_lower}(),
             % endfor
         ),
     };
     let mut seen = PropertyBitField::new();
     // Declaration blocks are stored in increasing precedence order,
     // we want them in decreasing order here.
     for sub_list in applicable_declarations.iter().rev() {
         // Declarations are already stored in reverse order.
         for declaration in sub_list.declarations.iter() {
             match *declaration {
                 % for style_struct in STYLE_STRUCTS:
                     % for property in style_struct.longhands:
                         % if property.derived_from is None:
                             PropertyDeclaration::${property.camel_case}(ref
                                     ${'_' if not style_struct.inherited else ''}declared_value)
                                     => {
-                                    use properties::style_struct_traits::T${style_struct.name};
+                                    use properties::style_struct_traits::T${style_struct.trait_name};
                                 % if style_struct.inherited:
                                     if seen.get_${property.ident}() {
                                         continue
                                     }
                                     seen.set_${property.ident}();
                                     let custom_props = context.style().custom_properties();
                                     substitute_variables_${property.ident}(
                                         declared_value, &custom_props,
                                         |value| match *value {
                                             DeclaredValue::Value(ref specified_value)
                                             => {
                                                 let computed = specified_value.to_computed_value(&context);
-                                                context.mutate_style().mutate_${style_struct.name.lower()}()
+                                                context.mutate_style().mutate_${style_struct.trait_name_lower}()
                                                        .set_${property.ident}(computed);
                                             },
                                             DeclaredValue::Initial
                                             => {
                                                 // FIXME(bholley): We may want set_X_to_initial_value() here.
                                                 let initial = longhands::${property.ident}::get_initial_value();
-                                                context.mutate_style().mutate_${style_struct.name.lower()}()
+                                                context.mutate_style().mutate_${style_struct.trait_name_lower}()
                                                        .set_${property.ident}(initial);
                                             },
                                             DeclaredValue::Inherit => {
                                                 // This is a bit slow, but this is rare so it shouldn't
                                                 // matter.
                                                 //
                                                 // FIXME: is it still?
                                                 let inherited_struct = parent_style.get_${style_struct.ident}();
-                                                context.mutate_style().mutate_${style_struct.name.lower()}()
+                                                context.mutate_style().mutate_${style_struct.trait_name_lower}()
                                                        .copy_${property.ident}_from(inherited_struct);
                                             }
                                             DeclaredValue::WithVariables { .. } => unreachable!()
                                         }, &mut error_reporter
                                     );
                                 % endif
 
                                 % if property.name in DERIVED_LONGHANDS:
@@ -6865,17 +6875,17 @@ pub fn cascade<C: ComputedValues>(
             WritingMode::empty(),
             inherited_style.root_font_size(),
             % for style_struct in STYLE_STRUCTS:
             % if style_struct.inherited:
             inherited_style
             % else:
             initial_values
             % endif
-                .clone_${style_struct.name.lower()}(),
+                .clone_${style_struct.trait_name_lower}(),
             % endfor
         ),
     };
 
     // Set computed values, overwriting earlier declarations for the same property.
     let mut cacheable = true;
     let mut seen = PropertyBitField::new();
     // Declaration blocks are stored in increasing precedence order, we want them in decreasing
--- a/servo/ports/geckolib/build.rs
+++ b/servo/ports/geckolib/build.rs
@@ -57,18 +57,17 @@ import os
 import sys
 from mako.template import Template
 from mako import exceptions
 try:
     style_template = Template(filename=os.environ['STYLE_TEMPLATE'], input_encoding='utf8')
     style_template.render(PRODUCT='gecko')
 
     geckolib_template = Template(filename=os.environ['GECKOLIB_TEMPLATE'], input_encoding='utf8')
-    output = geckolib_template.render(STYLE_STRUCTS = style_template.module.STYLE_STRUCTS,
-                                      LONGHANDS = style_template.module.LONGHANDS)
+    output = geckolib_template.render(STYLE_STRUCTS = style_template.module.STYLE_STRUCTS)
     print(output.encode('utf8'))
 except:
     sys.stderr.write(exceptions.text_error_template().render().encode('utf8'))
     sys.exit(1)
 "#)
         .stderr(Stdio::inherit())
         .output()
         .unwrap();
--- a/servo/ports/geckolib/properties.mako.rs
+++ b/servo/ports/geckolib/properties.mako.rs
@@ -1,59 +1,61 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+// STYLE_STRUCTS comes from components/style/properties.mako.rs; see build.rs for more details.
+
 use app_units::Au;
 % for style_struct in STYLE_STRUCTS:
-%if style_struct.gecko_name:
-use gecko_style_structs::${style_struct.gecko_name};
-use bindings::Gecko_Construct_${style_struct.gecko_name};
-use bindings::Gecko_CopyConstruct_${style_struct.gecko_name};
-use bindings::Gecko_Destroy_${style_struct.gecko_name};
+%if style_struct.gecko_ffi_name:
+use gecko_style_structs::${style_struct.gecko_ffi_name};
+use bindings::Gecko_Construct_${style_struct.gecko_ffi_name};
+use bindings::Gecko_CopyConstruct_${style_struct.gecko_ffi_name};
+use bindings::Gecko_Destroy_${style_struct.gecko_ffi_name};
 % endif
 % endfor
 use heapsize::HeapSizeOf;
 use std::fmt::{self, Debug};
 use std::mem::zeroed;
 use std::sync::Arc;
 use style::custom_properties::ComputedValuesMap;
 use style::logical_geometry::WritingMode;
 use style::properties::{CascadePropertyFn, ServoComputedValues, ComputedValues};
 use style::properties::longhands;
 use style::properties::make_cascade_vec;
 use style::properties::style_struct_traits::*;
 
 #[derive(Clone)]
 pub struct GeckoComputedValues {
     % for style_struct in STYLE_STRUCTS:
-    ${style_struct.ident}: Arc<Gecko${style_struct.name}>,
+    ${style_struct.ident}: Arc<${style_struct.gecko_struct_name}>,
     % endfor
 
     custom_properties: Option<Arc<ComputedValuesMap>>,
     shareable: bool,
     pub writing_mode: WritingMode,
     pub root_font_size: Au,
 }
 
 impl ComputedValues for GeckoComputedValues {
 % for style_struct in STYLE_STRUCTS:
-    type Concrete${style_struct.name} = Gecko${style_struct.name};
+    type Concrete${style_struct.trait_name} = ${style_struct.gecko_struct_name};
 % endfor
 
     // These will go away, and we will never implement them.
     fn as_servo<'a>(&'a self) -> &'a ServoComputedValues { unimplemented!() }
     fn as_servo_mut<'a>(&'a mut self) -> &'a mut ServoComputedValues { unimplemented!() }
 
     fn new(custom_properties: Option<Arc<ComputedValuesMap>>,
            shareable: bool,
            writing_mode: WritingMode,
            root_font_size: Au,
             % for style_struct in STYLE_STRUCTS:
-           ${style_struct.ident}: Arc<Gecko${style_struct.name}>,
+           ${style_struct.ident}: Arc<${style_struct.gecko_struct_name}>,
             % endfor
     ) -> Self {
         GeckoComputedValues {
             custom_properties: custom_properties,
             shareable: shareable,
             writing_mode: writing_mode,
             root_font_size: root_font_size,
             % for style_struct in STYLE_STRUCTS:
@@ -65,98 +67,98 @@ impl ComputedValues for GeckoComputedVal
     fn initial_values() -> &'static Self { &*INITIAL_GECKO_VALUES }
 
     fn do_cascade_property<F: FnOnce(&Vec<Option<CascadePropertyFn<Self>>>)>(f: F) {
         CASCADE_PROPERTY.with(|x| f(x));
     }
 
     % for style_struct in STYLE_STRUCTS:
     #[inline]
-    fn clone_${style_struct.name.lower()}(&self) -> Arc<Self::Concrete${style_struct.name}> {
+    fn clone_${style_struct.trait_name_lower}(&self) -> Arc<Self::Concrete${style_struct.trait_name}> {
         self.${style_struct.ident}.clone()
     }
     #[inline]
-    fn get_${style_struct.name.lower()}<'a>(&'a self) -> &'a Self::Concrete${style_struct.name} {
+    fn get_${style_struct.trait_name_lower}<'a>(&'a self) -> &'a Self::Concrete${style_struct.trait_name} {
         &self.${style_struct.ident}
     }
     #[inline]
-    fn mutate_${style_struct.name.lower()}<'a>(&'a mut self) -> &'a mut Self::Concrete${style_struct.name} {
+    fn mutate_${style_struct.trait_name_lower}<'a>(&'a mut self) -> &'a mut Self::Concrete${style_struct.trait_name} {
         Arc::make_mut(&mut self.${style_struct.ident})
     }
     % endfor
 
     fn custom_properties(&self) -> Option<Arc<ComputedValuesMap>> { self.custom_properties.as_ref().map(|x| x.clone())}
     fn root_font_size(&self) -> Au { self.root_font_size }
     fn set_root_font_size(&mut self, s: Au) { self.root_font_size = s; }
     fn set_writing_mode(&mut self, mode: WritingMode) { self.writing_mode = mode; }
 
     #[inline]
     fn is_multicol(&self) -> bool { unimplemented!() }
 }
 
 <%def name="declare_style_struct(style_struct)">
 #[derive(Clone, HeapSizeOf, Debug)]
-% if style_struct.gecko_name:
-pub struct Gecko${style_struct.name} {
-    gecko: ${style_struct.gecko_name},
+% if style_struct.gecko_ffi_name:
+pub struct ${style_struct.gecko_struct_name} {
+    gecko: ${style_struct.gecko_ffi_name},
 }
 % else:
-pub struct Gecko${style_struct.name};
+pub struct ${style_struct.gecko_struct_name};
 % endif
 </%def>
 
 <%def name="impl_style_struct(style_struct)">
-impl Gecko${style_struct.name} {
+impl ${style_struct.gecko_struct_name} {
     #[allow(dead_code, unused_variables)]
     fn initial() -> Self {
-% if style_struct.gecko_name:
-        let mut result = Gecko${style_struct.name} { gecko: unsafe { zeroed() } };
+% if style_struct.gecko_ffi_name:
+        let mut result = ${style_struct.gecko_struct_name} { gecko: unsafe { zeroed() } };
         unsafe {
-            Gecko_Construct_${style_struct.gecko_name}(&mut result.gecko);
+            Gecko_Construct_${style_struct.gecko_ffi_name}(&mut result.gecko);
         }
         result
 % else:
-        Gecko${style_struct.name}
+        ${style_struct.gecko_struct_name}
 % endif
     }
 }
-%if style_struct.gecko_name:
-impl Drop for Gecko${style_struct.name} {
+%if style_struct.gecko_ffi_name:
+impl Drop for ${style_struct.gecko_struct_name} {
     fn drop(&mut self) {
         unsafe {
-            Gecko_Destroy_${style_struct.gecko_name}(&mut self.gecko);
+            Gecko_Destroy_${style_struct.gecko_ffi_name}(&mut self.gecko);
         }
     }
 }
-impl Clone for ${style_struct.gecko_name} {
+impl Clone for ${style_struct.gecko_ffi_name} {
     fn clone(&self) -> Self {
         unsafe {
             let mut result: Self = zeroed();
-            Gecko_CopyConstruct_${style_struct.gecko_name}(&mut result, self);
+            Gecko_CopyConstruct_${style_struct.gecko_ffi_name}(&mut result, self);
             result
         }
     }
 }
-unsafe impl Send for ${style_struct.gecko_name} {}
-unsafe impl Sync for ${style_struct.gecko_name} {}
-impl HeapSizeOf for ${style_struct.gecko_name} {
+unsafe impl Send for ${style_struct.gecko_ffi_name} {}
+unsafe impl Sync for ${style_struct.gecko_ffi_name} {}
+impl HeapSizeOf for ${style_struct.gecko_ffi_name} {
     // Not entirely accurate, but good enough for now.
     fn heap_size_of_children(&self) -> usize { 0 }
 }
-impl Debug for ${style_struct.gecko_name} {
+impl Debug for ${style_struct.gecko_ffi_name} {
     // FIXME(bholley): Generate this.
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         write!(f, "GECKO STYLE STRUCT")
     }
 }
 %endif
 </%def>
 
 <%def name="raw_impl_trait(style_struct, skip_longhands=None, skip_additionals=None)">
-impl T${style_struct.name} for Gecko${style_struct.name} {
+impl T${style_struct.trait_name} for ${style_struct.gecko_struct_name} {
     /*
      * Manually-Implemented Methods.
      */
     ${caller.body().strip()}
 
     /*
      * Auto-Generated Methods.
      */
@@ -175,18 +177,18 @@ impl T${style_struct.name} for Gecko${st
     % for additional in additionals:
     ${additional.stub()}
     % endfor
 }
 </%def>
 
 <%! MANUAL_STYLE_STRUCTS = [] %>
 <%def name="impl_trait(style_struct_name, skip_longhands=None, skip_additionals=None)">
-<%self:raw_impl_trait style_struct="${next(x for x in STYLE_STRUCTS if x.name == style_struct_name)}"
-                       skip_longhands="${skip_longhands}" skip_additionals="${skip_additionals}">
+<%self:raw_impl_trait style_struct="${next(x for x in STYLE_STRUCTS if x.trait_name == style_struct_name)}"
+                      skip_longhands="${skip_longhands}" skip_additionals="${skip_additionals}">
 ${caller.body()}
 </%self:raw_impl_trait>
 <% MANUAL_STYLE_STRUCTS.append(style_struct_name) %>
 </%def>
 
 // Proof-of-concept for a style struct with some manually-implemented methods. We add
 // the manually-implemented methods to skip_longhands and skip_additionals, and the
 // infrastructure auto-generates everything not in those lists. This allows us to
@@ -209,25 +211,25 @@ impl T${style_struct.name} for Gecko${st
     fn border_bottom_is_none_or_hidden_and_has_nonzero_width(&self) -> bool {
         unimplemented!()
     }
 </%self:impl_trait>
 
 % for style_struct in STYLE_STRUCTS:
 ${declare_style_struct(style_struct)}
 ${impl_style_struct(style_struct)}
-% if not style_struct.name in MANUAL_STYLE_STRUCTS:
+% if not style_struct.trait_name in MANUAL_STYLE_STRUCTS:
 <%self:raw_impl_trait style_struct="${style_struct}"></%self:raw_impl_trait>
 % endif
 % endfor
 
 lazy_static! {
     pub static ref INITIAL_GECKO_VALUES: GeckoComputedValues = GeckoComputedValues {
         % for style_struct in STYLE_STRUCTS:
-           ${style_struct.ident}: Arc::new(Gecko${style_struct.name}::initial()),
+           ${style_struct.ident}: Arc::new(${style_struct.gecko_struct_name}::initial()),
         % endfor
         custom_properties: None,
         shareable: true,
         writing_mode: WritingMode::empty(),
         root_font_size: longhands::font_size::get_initial_value(),
     };
 }