Skip to content

Commit

Permalink
Derive ToCss for keyword structs
Browse files Browse the repository at this point in the history
  • Loading branch information
nox committed Jun 17, 2017
1 parent b0bc1d0 commit 3a2e792
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
10 changes: 2 additions & 8 deletions components/style/macros.rs
Expand Up @@ -82,17 +82,11 @@ macro_rules! add_impls_for_keyword_enum {

macro_rules! define_keyword_type {
($name: ident, $css: expr) => {
#[derive(Clone, PartialEq, Copy)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, PartialEq, ToCss)]
pub struct $name;

impl ::style_traits::ToCss for $name {
fn to_css<W>(&self, dest: &mut W) -> ::std::fmt::Result where W: ::std::fmt::Write {
write!(dest, $css)
}
}

impl $crate::properties::animated_properties::Animatable for $name {
#[inline]
fn add_weighted(&self, _other: &Self, _self_progress: f64, _other_progress: f64)
Expand Down
1 change: 1 addition & 0 deletions components/style_derive/to_css.rs
Expand Up @@ -142,6 +142,7 @@ fn where_predicate(ty: syn::Ty) -> syn::WherePredicate {
/// If the first Camel segment is "Moz"" or "Webkit", the result string
/// is prepended with "-".
fn to_css_identifier(mut camel_case: &str) -> String {
camel_case = camel_case.trim_right_matches('_');
let mut first = true;
let mut result = String::with_capacity(camel_case.len());
while let Some(segment) = split_camel_segment(&mut camel_case) {
Expand Down

0 comments on commit 3a2e792

Please sign in to comment.