diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-04-29 04:48:47 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-05-05 16:20:22 +0200 |
commit | c508d8576dafb13a4f0d51a837508f7984e4c1a8 (patch) | |
tree | c6d6a2b1c135dbfda7f11ea6599b53b9f086bfae /components/style_derive/to_css.rs | |
parent | a375baf84b029c56222d3fe8a304f374ab1c9549 (diff) | |
download | servo-c508d8576dafb13a4f0d51a837508f7984e4c1a8.tar.gz servo-c508d8576dafb13a4f0d51a837508f7984e4c1a8.zip |
style: Move represents_keyword to the css attributes.
Bug: 1457635
Reviewed-by: xidorn
MozReview-Commit-ID: 21yuU4h34AQ
Diffstat (limited to 'components/style_derive/to_css.rs')
-rw-r--r-- | components/style_derive/to_css.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/components/style_derive/to_css.rs b/components/style_derive/to_css.rs index 722107da0cd..7ac7d3a1ae7 100644 --- a/components/style_derive/to_css.rs +++ b/components/style_derive/to_css.rs @@ -189,6 +189,15 @@ fn derive_single_field_expr( writer.item(&item)?; } } + } else if attrs.represents_keyword { + let ident = + field.ast().ident.as_ref().expect("Unnamed field with represents_keyword?"); + let ident = cg::to_css_identifier(ident.as_ref()); + quote! { + if *#field { + writer.raw_item(#ident)?; + } + } } else { if attrs.field_bound { let ty = &field.ast().ty; @@ -236,5 +245,6 @@ pub struct CssFieldAttrs { pub field_bound: bool, pub iterable: bool, pub skip: bool, + pub represents_keyword: bool, pub skip_if: Option<Path>, } |