Use strings rather than arrays for skip_longhands and skip_additionals.

This matches what we do in components/style.
This commit is contained in:
Bobby Holley 2016-04-19 16:08:25 -07:00
parent cc35d4fcce
commit 972cc7ead5

View file

@ -165,10 +165,9 @@ impl Debug for ${style_struct.gecko_ffi_name} {
%endif %endif
</%def> </%def>
<%def name="raw_impl_trait(style_struct, skip_longhands=None, skip_additionals=None)"> <%def name="raw_impl_trait(style_struct, skip_longhands='', skip_additionals='')">
<% <%
longhands = [x for x in style_struct.longhands longhands = [x for x in style_struct.longhands if not x.name in skip_longhands.split()]
if not (skip_longhands and x.name in skip_longhands)]
# #
# Make a list of types we can't auto-generate. # Make a list of types we can't auto-generate.
@ -254,7 +253,7 @@ impl ${style_struct.trait_name} for ${style_struct.gecko_struct_name} {
% endif % endif
% endfor % endfor
<% additionals = [x for x in style_struct.additional_methods <% additionals = [x for x in style_struct.additional_methods
if not (skip_additionals and x.name in skip_additionals)] %> if not x.name in skip_additionals.split()] %>
% for additional in additionals: % for additional in additionals:
${additional.stub()} ${additional.stub()}
% endfor % endfor
@ -262,7 +261,7 @@ impl ${style_struct.trait_name} for ${style_struct.gecko_struct_name} {
</%def> </%def>
<% data.manual_style_structs = [] %> <% data.manual_style_structs = [] %>
<%def name="impl_trait(style_struct_name, skip_longhands=None, skip_additionals=None)"> <%def name="impl_trait(style_struct_name, skip_longhands='', skip_additionals='')">
<%self:raw_impl_trait style_struct="${next(x for x in data.style_structs if x.trait_name == style_struct_name)}" <%self:raw_impl_trait style_struct="${next(x for x in data.style_structs if x.trait_name == style_struct_name)}"
skip_longhands="${skip_longhands}" skip_additionals="${skip_additionals}"> skip_longhands="${skip_longhands}" skip_additionals="${skip_additionals}">
${caller.body()} ${caller.body()}
@ -275,8 +274,8 @@ ${caller.body()}
// infrastructure auto-generates everything not in those lists. This allows us to // infrastructure auto-generates everything not in those lists. This allows us to
// iteratively implement more and more methods. // iteratively implement more and more methods.
<%self:impl_trait style_struct_name="Border" <%self:impl_trait style_struct_name="Border"
skip_longhands="${['border-left-color', 'border-left-style']}" skip_longhands="border-left-color border-left-style"
skip_additionals="${['border_bottom_has_nonzero_width']}"> skip_additionals="border_bottom_has_nonzero_width">
fn set_border_left_color(&mut self, _: longhands::border_left_color::computed_value::T) { fn set_border_left_color(&mut self, _: longhands::border_left_color::computed_value::T) {
unimplemented!() unimplemented!()
} }