From c04a4140a73bf78a2ad4abd4e4a77b965e72b2c5 Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Wed, 21 Nov 2018 22:33:15 -0600 Subject: [PATCH 1/9] style: Add 'overflow-anchor' CSS property. https://drafts.csswg.org/css-scroll-anchoring/#exclusion-api Differential Revision: https://phabricator.services.mozilla.com/D13265 --- components/style/cbindgen.toml | 1 + components/style/properties/data.py | 1 + components/style/properties/gecko.mako.rs | 1 + .../style/properties/longhands/box.mako.rs | 12 +++++++++++ components/style/values/computed/box.rs | 2 +- components/style/values/computed/mod.rs | 2 +- components/style/values/specified/box.rs | 20 +++++++++++++++++++ components/style/values/specified/mod.rs | 2 +- 8 files changed, 38 insertions(+), 3 deletions(-) diff --git a/components/style/cbindgen.toml b/components/style/cbindgen.toml index 27ad7bc80a1..f9635812ac4 100644 --- a/components/style/cbindgen.toml +++ b/components/style/cbindgen.toml @@ -63,6 +63,7 @@ include = [ "Float", "OverscrollBehavior", "ScrollSnapType", + "OverflowAnchor", "OverflowClipBox", "Resize", "Overflow", diff --git a/components/style/properties/data.py b/components/style/properties/data.py index 4d980039d1e..fa4f55bc9e5 100644 --- a/components/style/properties/data.py +++ b/components/style/properties/data.py @@ -326,6 +326,7 @@ class Longhand(object): "Opacity", "OutlineStyle", "Overflow", + "OverflowAnchor", "OverflowClipBox", "OverflowWrap", "OverscrollBehavior", diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 40691d75e04..631a9878171 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -1419,6 +1419,7 @@ impl Clone for ${style_struct.gecko_struct_name} { "Number": impl_simple, "Opacity": impl_simple, "OverflowWrap": impl_simple, + "OverflowAnchor": impl_simple, "Perspective": impl_style_coord, "Position": impl_position, "RGBAColor": impl_rgba_color, diff --git a/components/style/properties/longhands/box.mako.rs b/components/style/properties/longhands/box.mako.rs index 1818179a442..10e610a32af 100644 --- a/components/style/properties/longhands/box.mako.rs +++ b/components/style/properties/longhands/box.mako.rs @@ -125,6 +125,18 @@ ${helpers.predefined_type( servo_restyle_damage = "reflow", )} +${helpers.predefined_type( + "overflow-anchor", + "OverflowAnchor", + "computed::OverflowAnchor::Auto", + initial_specified_value="specified::OverflowAnchor::Auto", + products="gecko", + needs_context=False, + gecko_pref="layout.css.scroll-anchoring.enabled", + spec="https://drafts.csswg.org/css-scroll-anchoring/#exclusion-api", + animation_value_type="discrete", +)} + <% transition_extra_prefixes = "moz:layout.css.prefixes.transitions webkit" %> ${helpers.predefined_type( diff --git a/components/style/values/computed/box.rs b/components/style/values/computed/box.rs index 381ae7b364e..89935e2b4d4 100644 --- a/components/style/values/computed/box.rs +++ b/components/style/values/computed/box.rs @@ -13,7 +13,7 @@ use crate::values::specified::box_ as specified; pub use crate::values::specified::box_::{AnimationName, Appearance, BreakBetween, BreakWithin}; pub use crate::values::specified::box_::{Clear as SpecifiedClear, Float as SpecifiedFloat}; -pub use crate::values::specified::box_::{Contain, Display, Overflow, OverflowClipBox}; +pub use crate::values::specified::box_::{Contain, Display, Overflow, OverflowAnchor, OverflowClipBox}; pub use crate::values::specified::box_::{OverscrollBehavior, ScrollSnapType}; pub use crate::values::specified::box_::{TouchAction, TransitionProperty, WillChange}; diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs index c389e1d1267..c727729b958 100644 --- a/components/style/values/computed/mod.rs +++ b/components/style/values/computed/mod.rs @@ -43,7 +43,7 @@ pub use self::border::{BorderImageRepeat, BorderImageSideWidth}; pub use self::border::{BorderImageSlice, BorderImageWidth}; pub use self::box_::{AnimationIterationCount, AnimationName, Contain}; pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float}; -pub use self::box_::{Display, Overflow, TransitionProperty}; +pub use self::box_::{Display, Overflow, OverflowAnchor, TransitionProperty}; pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize}; pub use self::box_::{ScrollSnapType, TouchAction, VerticalAlign, WillChange}; pub use self::color::{Color, ColorPropertyValue, RGBAColor}; diff --git a/components/style/values/specified/box.rs b/components/style/values/specified/box.rs index 30111170bc0..b94ec8a0f26 100644 --- a/components/style/values/specified/box.rs +++ b/components/style/values/specified/box.rs @@ -413,6 +413,26 @@ pub enum OverscrollBehavior { None, } +#[allow(missing_docs)] +#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] +#[derive( + Clone, + Copy, + Debug, + Eq, + MallocSizeOf, + Parse, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] +#[repr(u8)] +pub enum OverflowAnchor { + Auto, + None, +} + #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[derive( diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index 0d35d2b1d75..d2015f714b5 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -36,7 +36,7 @@ pub use self::border::{BorderCornerRadius, BorderImageSlice, BorderImageWidth}; pub use self::border::{BorderImageRepeat, BorderImageSideWidth}; pub use self::border::{BorderRadius, BorderSideWidth, BorderSpacing, BorderStyle}; pub use self::box_::{AnimationIterationCount, AnimationName, Contain, Display}; -pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float, Overflow}; +pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float, Overflow, OverflowAnchor}; pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize}; pub use self::box_::{ScrollSnapType, TouchAction, TransitionProperty, VerticalAlign, WillChange}; pub use self::color::{Color, ColorPropertyValue, RGBAColor}; From 7efbd9cde6d99571c559f1365c12ed07d68397c5 Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Thu, 10 Jan 2019 06:01:03 +0000 Subject: [PATCH 2/9] style: Remove unnecessary mem::transmute in MediaListKey. Differential Revision: https://phabricator.services.mozilla.com/D16147 --- components/style/invalidation/media_queries.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/components/style/invalidation/media_queries.rs b/components/style/invalidation/media_queries.rs index aeec7f1ac1e..75149a02891 100644 --- a/components/style/invalidation/media_queries.rs +++ b/components/style/invalidation/media_queries.rs @@ -38,10 +38,8 @@ impl MediaListKey { pub trait ToMediaListKey: Sized { /// Get a `MediaListKey` for this item. This key needs to uniquely identify /// the item. - #[allow(unsafe_code)] fn to_media_list_key(&self) -> MediaListKey { - use std::mem; - MediaListKey(unsafe { mem::transmute(self as *const Self) }) + MediaListKey(self as *const Self as usize) } } From a8943d2ec519c4fce68fffcee4e6512e63eb4602 Mon Sep 17 00:00:00 2001 From: Boris Chiou Date: Sat, 12 Jan 2019 02:19:04 +0000 Subject: [PATCH 3/9] style: Part 1: Support field_bound on Animate. So we can derive Animate on more generic types. Differential Revision: https://phabricator.services.mozilla.com/D16339 --- components/style/values/animated/mod.rs | 3 +- components/style_derive/animate.rs | 43 ++++++++++++++++--------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/components/style/values/animated/mod.rs b/components/style/values/animated/mod.rs index a4e79074ef6..00410e177fb 100644 --- a/components/style/values/animated/mod.rs +++ b/components/style/values/animated/mod.rs @@ -113,7 +113,8 @@ pub fn animate_multiplicative_factor( /// function has been specified through `#[animate(fallback)]`. /// /// Trait bounds for type parameter `Foo` can be opted out of with -/// `#[animation(no_bound(Foo))]` on the type definition. +/// `#[animation(no_bound(Foo))]` on the type definition, trait bounds for +/// fields can be opted into with `#[animation(field_bound)]` on the field. pub trait Animate: Sized { /// Animate a value towards another one, given an animation procedure. fn animate(&self, other: &Self, procedure: Procedure) -> Result; diff --git a/components/style_derive/animate.rs b/components/style_derive/animate.rs index 905b0ad0e1f..6686d2f4453 100644 --- a/components/style_derive/animate.rs +++ b/components/style_derive/animate.rs @@ -6,7 +6,7 @@ use crate::cg; use darling::util::IdentList; use proc_macro2::TokenStream; use quote::TokenStreamExt; -use syn::{DeriveInput, Path}; +use syn::{DeriveInput, Path, WhereClause}; use synstructure::{Structure, VariantInfo}; pub fn derive(mut input: DeriveInput) -> TokenStream { @@ -21,22 +21,25 @@ pub fn derive(mut input: DeriveInput) -> TokenStream { ); } } + let (mut match_body, append_error_clause) = { + let s = Structure::new(&input); + let mut append_error_clause = s.variants().len() > 1; + + let mut match_body = s.variants().iter().fold(quote!(), |body, variant| { + let arm = match derive_variant_arm(variant, &mut where_clause) { + Ok(arm) => arm, + Err(()) => { + append_error_clause = true; + return body; + }, + }; + quote! { #body #arm } + }); + (match_body, append_error_clause) + }; + input.generics.where_clause = where_clause; - let s = Structure::new(&input); - let mut append_error_clause = s.variants().len() > 1; - - let mut match_body = s.variants().iter().fold(quote!(), |body, variant| { - let arm = match derive_variant_arm(variant) { - Ok(arm) => arm, - Err(()) => { - append_error_clause = true; - return body; - }, - }; - quote! { #body #arm } - }); - if append_error_clause { let input_attrs = cg::parse_input_attrs::(&input); if let Some(fallback) = input_attrs.fallback { @@ -68,7 +71,10 @@ pub fn derive(mut input: DeriveInput) -> TokenStream { } } -fn derive_variant_arm(variant: &VariantInfo) -> Result { +fn derive_variant_arm( + variant: &VariantInfo, + where_clause: &mut Option, +) -> Result { let variant_attrs = cg::parse_variant_attrs_from_ast::(&variant.ast()); if variant_attrs.error { return Err(()); @@ -80,6 +86,10 @@ fn derive_variant_arm(variant: &VariantInfo) -> Result { let iter = result_info.iter().zip(this_info.iter().zip(&other_info)); computations.append_all(iter.map(|(result, (this, other))| { let field_attrs = cg::parse_field_attrs::(&result.ast()); + if field_attrs.field_bound { + let ty = &this.ast().ty; + cg::add_predicate(where_clause, parse_quote!(#ty: crate::values::animated::Animate)); + } if field_attrs.constant { quote! { if #this != #other { @@ -127,4 +137,5 @@ pub struct AnimationVariantAttrs { #[derive(Default, FromField)] pub struct AnimationFieldAttrs { pub constant: bool, + pub field_bound: bool, } From 2b77a29697840f64201f6a5a3080dbdfb83ac9eb Mon Sep 17 00:00:00 2001 From: Boris Chiou Date: Sat, 12 Jan 2019 02:22:39 +0000 Subject: [PATCH 4/9] style: Implement Animate for track lists on grid-template-{columns|rows}. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1348519#c6 and https://github.com/w3c/csswg-drafts/issues/3201: Currently grid-template-rows/columns interpolate “per computed value”, which means that if the number of tracks differs, or any track changes to/from a particular keyword value to any other value, or if a line name is added/removed at any position, the entire track listing is interpolated as “discrete”. But we "agree" with two more granular options: 1. Check interpolation type per track, rather than for the entire list, before falling back to discrete. I.e. a length-percentage track can animate between two values while an adjacent auto track flips discretely to min-content. 2. Allow discrete interpolation of line name changes independently of track sizes. Besides, for the repeat() function, it's complicated to support interpolation between different repeat types (i.e. auto-fill, auto-fit) and different repeat counts, so we always fall-back to discrete if the first parameter of repeat() is different. Differential Revision: https://phabricator.services.mozilla.com/D16129 --- .../properties/longhands/position.mako.rs | 2 +- components/style/values/animated/grid.rs | 153 ++++++++++++++++++ components/style/values/animated/mod.rs | 1 + components/style/values/generics/grid.rs | 42 ++++- 4 files changed, 191 insertions(+), 7 deletions(-) create mode 100644 components/style/values/animated/grid.rs diff --git a/components/style/properties/longhands/position.mako.rs b/components/style/properties/longhands/position.mako.rs index a7a6910f954..cc5515dbac7 100644 --- a/components/style/properties/longhands/position.mako.rs +++ b/components/style/properties/longhands/position.mako.rs @@ -383,7 +383,7 @@ ${helpers.predefined_type( spec="https://drafts.csswg.org/css-grid/#propdef-grid-template-%ss" % kind, boxed=True, flags="GETCS_NEEDS_LAYOUT_FLUSH", - animation_value_type="discrete", + animation_value_type="ComputedValue", )} % endfor diff --git a/components/style/values/animated/grid.rs b/components/style/values/animated/grid.rs new file mode 100644 index 00000000000..0943e97cef3 --- /dev/null +++ b/components/style/values/animated/grid.rs @@ -0,0 +1,153 @@ +/* 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 https://mozilla.org/MPL/2.0/. */ + +//! Animation implementation for various grid-related types. + +// Note: we can implement Animate on their generic types directly, but in this case we need to +// make sure two trait bounds, L: Clone and I: PartialEq, are satisfied on almost all the +// grid-related types and their other trait implementations because Animate needs them. So in +// order to avoid adding these two trait bounds (or maybe more..) everywhere, we implement +// Animate for the computed types, instead of the generic types. + +use super::{Animate, Procedure, ToAnimatedZero}; +use crate::values::computed::{GridTemplateComponent, TrackList, TrackSize}; +use crate::values::computed::Integer; +use crate::values::computed::LengthPercentage; +use crate::values::distance::{ComputeSquaredDistance, SquaredDistance}; +use crate::values::generics::grid as generics; + +fn discrete(from: &T, to: &T, procedure: Procedure) -> Result { + if let Procedure::Interpolate { progress } = procedure { + Ok(if progress < 0.5 { from.clone() } else { to.clone() }) + } else { + Err(()) + } +} + +fn animate_with_discrete_fallback( + from: &T, + to: &T, + procedure: Procedure +) -> Result { + from.animate(to, procedure).or_else(|_| discrete(from, to, procedure)) +} + +impl Animate for TrackSize { + fn animate(&self, other: &Self, procedure: Procedure) -> Result { + match (self, other) { + (&generics::TrackSize::Breadth(ref from), + &generics::TrackSize::Breadth(ref to)) => { + animate_with_discrete_fallback(from, to, procedure) + .map(generics::TrackSize::Breadth) + }, + (&generics::TrackSize::Minmax(ref from_min, ref from_max), + &generics::TrackSize::Minmax(ref to_min, ref to_max)) => { + Ok(generics::TrackSize::Minmax( + animate_with_discrete_fallback(from_min, to_min, procedure)?, + animate_with_discrete_fallback(from_max, to_max, procedure)?, + )) + }, + (&generics::TrackSize::FitContent(ref from), + &generics::TrackSize::FitContent(ref to)) => { + animate_with_discrete_fallback(from, to, procedure) + .map(generics::TrackSize::FitContent) + }, + (_, _) => discrete(self, other, procedure), + } + } +} + +impl Animate for generics::TrackRepeat +where + generics::RepeatCount: PartialEq, +{ + fn animate(&self, other: &Self, procedure: Procedure) -> Result { + // If the keyword, auto-fit/fill, is the same it can result in different + // number of tracks. For both auto-fit/fill, the number of columns isn't + // known until you do layout since it depends on the container size, item + // placement and other factors, so we cannot do the correct interpolation + // by computed values. Therefore, return Err(()) if it's keywords. If it + // is Number, we support animation only if the count is the same and the + // length of track_sizes is the same. + // https://github.com/w3c/csswg-drafts/issues/3503 + match (&self.count, &other.count) { + (&generics::RepeatCount::Number(from), + &generics::RepeatCount::Number(to)) if from == to => (), + (_, _) => return Err(()), + } + + // The length of track_sizes should be matched. + if self.track_sizes.len() != other.track_sizes.len() { + return Err(()); + } + + let count = self.count; + let track_sizes = self.track_sizes + .iter() + .zip(other.track_sizes.iter()) + .map(|(a, b)| a.animate(b, procedure)) + .collect::, _>>()?; + + // The length of |line_names| is always 0 or N+1, where N is the length + // of |track_sizes|. Besides, is always discrete. + let line_names = discrete(&self.line_names, &other.line_names, procedure)?; + + Ok(generics::TrackRepeat { count, line_names, track_sizes }) + } +} + +impl Animate for TrackList { + // Based on https://github.com/w3c/csswg-drafts/issues/3201: + // 1. Check interpolation type per track, so we need to handle discrete animations + // in TrackSize, so any Err(()) returned from TrackSize doesn't make all TrackSize + // fallback to discrete animation. + // 2. line-names is always discrete. + fn animate(&self, other: &Self, procedure: Procedure) -> Result { + if self.values.len() != other.values.len() { + return Err(()); + } + + if self.list_type != other.list_type { + return Err(()); + } + + // For now, repeat(auto-fill/auto-fit, ...) is not animatable. TrackRepeat will + // return Err(()) if we use keywords. Therefore, we can early return here to avoid + // traversing |values| in . This may be updated in the future. + // https://github.com/w3c/csswg-drafts/issues/3503 + if let generics::TrackListType::Auto(_) = self.list_type { + return Err(()); + } + + let list_type = self.list_type; + let auto_repeat = self.auto_repeat.animate(&other.auto_repeat, procedure)?; + let values = self.values + .iter() + .zip(other.values.iter()) + .map(|(a, b)| a.animate(b, procedure)) + .collect::, _>>()?; + // The length of |line_names| is always 0 or N+1, where N is the length + // of |track_sizes|. Besides, is always discrete. + let line_names = discrete(&self.line_names, &other.line_names, procedure)?; + + Ok(TrackList { list_type, values, line_names, auto_repeat }) + } +} + +impl ComputeSquaredDistance for GridTemplateComponent { + #[inline] + fn compute_squared_distance(&self, _other: &Self) -> Result { + // TODO: Bug 1518585, we should implement ComputeSquaredDistance. + Err(()) + } +} + +impl ToAnimatedZero for GridTemplateComponent { + #[inline] + fn to_animated_zero(&self) -> Result { + // It's not clear to get a zero grid track list based on the current definition + // of spec, so we return Err(()) directly. + Err(()) + } +} diff --git a/components/style/values/animated/mod.rs b/components/style/values/animated/mod.rs index 00410e177fb..6bc7f624e34 100644 --- a/components/style/values/animated/mod.rs +++ b/components/style/values/animated/mod.rs @@ -23,6 +23,7 @@ use std::cmp; pub mod color; pub mod effects; mod font; +mod grid; mod length; mod svg; pub mod transform; diff --git a/components/style/values/generics/grid.rs b/components/style/values/generics/grid.rs index 3e978e9c449..38516c7a6c4 100644 --- a/components/style/values/generics/grid.rs +++ b/components/style/values/generics/grid.rs @@ -151,6 +151,7 @@ impl Parse for GridLine { #[allow(missing_docs)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[derive( + Animate, Clone, Copy, Debug, @@ -172,7 +173,16 @@ pub enum TrackKeyword { /// avoid re-implementing it for the computed type. /// /// -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Animate, + Clone, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] pub enum TrackBreadth { /// The generic type is almost always a non-negative `` Breadth(L), @@ -481,12 +491,21 @@ impl TrackRepeat { } /// Track list values. Can be or -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Animate, + Clone, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss +)] pub enum TrackListValue { /// A value. - TrackSize(TrackSize), + TrackSize(#[animation(field_bound)] TrackSize), /// A value. - TrackRepeat(TrackRepeat), + TrackRepeat(#[animation(field_bound)] TrackRepeat), } /// The type of a `` as determined during parsing. @@ -692,13 +711,24 @@ impl ToCss for LineNameList { /// Variants for ` | ` /// Subgrid deferred to Level 2 spec due to lack of implementation. /// But it's implemented in gecko, so we have to as well. -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)] +#[derive( + Animate, + Clone, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToCss +)] pub enum GridTemplateComponent { /// `none` value. None, /// The grid `` - TrackList(#[compute(field_bound)] TrackList), + TrackList(#[animation(field_bound)] #[compute(field_bound)] TrackList), /// A `subgrid ?` + /// TODO: Support animations for this after subgrid is addressed in [grid-2] spec. + #[animation(error)] Subgrid(LineNameList), } From 5bf0eea1f834e5154652fc59edc6f5854d389d70 Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Sat, 12 Jan 2019 06:45:45 +0000 Subject: [PATCH 5/9] style: Remove ServoStyleSet::PrependStyleSheet. Differential Revision: https://phabricator.services.mozilla.com/D16284 --- components/style/stylesheet_set.rs | 22 ---------------------- components/style/stylist.rs | 6 ------ 2 files changed, 28 deletions(-) diff --git a/components/style/stylesheet_set.rs b/components/style/stylesheet_set.rs index 507534edc15..35060a959d6 100644 --- a/components/style/stylesheet_set.rs +++ b/components/style/stylesheet_set.rs @@ -345,14 +345,6 @@ where self.data_validity = cmp::max(validity, self.data_validity); } - fn prepend(&mut self, sheet: S) { - debug_assert!(!self.contains(&sheet)); - // Inserting stylesheets somewhere but at the end changes the validity - // of the cascade data, but not the invalidation data. - self.set_data_validity_at_least(DataValidity::CascadeInvalid); - self.entries.insert(0, StylesheetSetEntry::new(sheet)); - } - /// Returns an iterator over the current list of stylesheets. fn iter(&self) -> StylesheetCollectionIterator { StylesheetCollectionIterator(self.entries.iter()) @@ -417,20 +409,6 @@ macro_rules! sheet_set_methods { collection.append(sheet); } - /// Prepend a new stylesheet to the current set. - pub fn prepend_stylesheet( - &mut self, - device: Option<&Device>, - sheet: S, - guard: &SharedRwLockReadGuard, - ) { - debug!(concat!($set_name, "::prepend_stylesheet")); - self.collect_invalidations_for(device, &sheet, guard); - - let collection = self.collection_for(&sheet, guard); - collection.prepend(sheet); - } - /// Insert a given stylesheet before another stylesheet in the document. pub fn insert_stylesheet_before( &mut self, diff --git a/components/style/stylist.rs b/components/style/stylist.rs index 74b055e099b..a0d33ab02bf 100644 --- a/components/style/stylist.rs +++ b/components/style/stylist.rs @@ -582,12 +582,6 @@ impl Stylist { .append_stylesheet(Some(&self.device), sheet, guard) } - /// Appends a new stylesheet to the current set. - pub fn prepend_stylesheet(&mut self, sheet: StylistSheet, guard: &SharedRwLockReadGuard) { - self.stylesheets - .prepend_stylesheet(Some(&self.device), sheet, guard) - } - /// Remove a given stylesheet to the current set. pub fn remove_stylesheet(&mut self, sheet: StylistSheet, guard: &SharedRwLockReadGuard) { self.stylesheets From f2d6e07aa016f1c8470880ececde0b57af1b6136 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Sat, 12 Jan 2019 19:21:56 +0000 Subject: [PATCH 6/9] Put malloc_size_of_derive on crates.io, and add a reduced fork of malloc_size_of for WebRender. Differential Revision: https://phabricator.services.mozilla.com/D16353 --- components/malloc_size_of/lib.rs | 3 + components/malloc_size_of_derive/Cargo.toml | 15 -- .../malloc_size_of_derive/LICENSE-APACHE | 201 ------------------ components/malloc_size_of_derive/LICENSE-MIT | 23 -- components/malloc_size_of_derive/lib.rs | 125 ----------- components/style/Cargo.toml | 2 +- components/style_traits/Cargo.toml | 2 +- 7 files changed, 5 insertions(+), 366 deletions(-) delete mode 100644 components/malloc_size_of_derive/Cargo.toml delete mode 100644 components/malloc_size_of_derive/LICENSE-APACHE delete mode 100644 components/malloc_size_of_derive/LICENSE-MIT delete mode 100644 components/malloc_size_of_derive/lib.rs diff --git a/components/malloc_size_of/lib.rs b/components/malloc_size_of/lib.rs index fe988e78f6c..808ffb755dc 100644 --- a/components/malloc_size_of/lib.rs +++ b/components/malloc_size_of/lib.rs @@ -42,6 +42,9 @@ //! fields in structs, because it makes it clear that the Box is being //! measured as well as the thing it points to. E.g. //! ` as MallocSizeOf>::size_of(field, ops)`. +//! +//! Note: WebRender has a reduced for of this crate, so that we can avoid +//! publishing this crate on crates.io. extern crate app_units; #[cfg(feature = "servo")] diff --git a/components/malloc_size_of_derive/Cargo.toml b/components/malloc_size_of_derive/Cargo.toml deleted file mode 100644 index 4cfc2ee1235..00000000000 --- a/components/malloc_size_of_derive/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "malloc_size_of_derive" -version = "0.0.1" -authors = ["The Servo Project Developers"] -license = "MIT/Apache-2.0" -publish = false - -[lib] -path = "lib.rs" -proc-macro = true - -[dependencies] -proc-macro2 = "0.4" -syn = { version = "0.15", features = ["full"] } -synstructure = "0.10" diff --git a/components/malloc_size_of_derive/LICENSE-APACHE b/components/malloc_size_of_derive/LICENSE-APACHE deleted file mode 100644 index 16fe87b06e8..00000000000 --- a/components/malloc_size_of_derive/LICENSE-APACHE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/components/malloc_size_of_derive/LICENSE-MIT b/components/malloc_size_of_derive/LICENSE-MIT deleted file mode 100644 index 31aa79387f2..00000000000 --- a/components/malloc_size_of_derive/LICENSE-MIT +++ /dev/null @@ -1,23 +0,0 @@ -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/components/malloc_size_of_derive/lib.rs b/components/malloc_size_of_derive/lib.rs deleted file mode 100644 index 0838f6cfb7f..00000000000 --- a/components/malloc_size_of_derive/lib.rs +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright 2016-2017 The Servo Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! A crate for deriving the MallocSizeOf trait. - -extern crate proc_macro2; -#[macro_use] -extern crate syn; -#[macro_use] -extern crate synstructure; - -#[cfg(not(test))] -decl_derive!([MallocSizeOf, attributes(ignore_malloc_size_of)] => malloc_size_of_derive); - -fn malloc_size_of_derive(s: synstructure::Structure) -> proc_macro2::TokenStream { - let match_body = s.each(|binding| { - let ignore = binding - .ast() - .attrs - .iter() - .any(|attr| match attr.interpret_meta().unwrap() { - syn::Meta::Word(ref ident) | syn::Meta::List(syn::MetaList { ref ident, .. }) - if ident == "ignore_malloc_size_of" => - { - panic!( - "#[ignore_malloc_size_of] should have an explanation, \ - e.g. #[ignore_malloc_size_of = \"because reasons\"]" - ); - } - syn::Meta::NameValue(syn::MetaNameValue { ref ident, .. }) - if ident == "ignore_malloc_size_of" => - { - true - }, - _ => false, - }); - if ignore { - None - } else if let syn::Type::Array(..) = binding.ast().ty { - Some(quote! { - for item in #binding.iter() { - sum += ::malloc_size_of::MallocSizeOf::size_of(item, ops); - } - }) - } else { - Some(quote! { - sum += ::malloc_size_of::MallocSizeOf::size_of(#binding, ops); - }) - } - }); - - let ast = s.ast(); - let name = &ast.ident; - let (impl_generics, ty_generics, where_clause) = ast.generics.split_for_impl(); - let mut where_clause = where_clause.unwrap_or(&parse_quote!(where)).clone(); - for param in ast.generics.type_params() { - let ident = ¶m.ident; - where_clause - .predicates - .push(parse_quote!(#ident: ::malloc_size_of::MallocSizeOf)); - } - - let tokens = quote! { - impl #impl_generics ::malloc_size_of::MallocSizeOf for #name #ty_generics #where_clause { - #[inline] - #[allow(unused_variables, unused_mut, unreachable_code)] - fn size_of(&self, ops: &mut ::malloc_size_of::MallocSizeOfOps) -> usize { - let mut sum = 0; - match *self { - #match_body - } - sum - } - } - }; - - tokens -} - -#[test] -fn test_struct() { - let source = syn::parse_str( - "struct Foo { bar: Bar, baz: T, #[ignore_malloc_size_of = \"\"] z: Arc }", - ) - .unwrap(); - let source = synstructure::Structure::new(&source); - - let expanded = malloc_size_of_derive(source).to_string(); - let mut no_space = expanded.replace(" ", ""); - macro_rules! match_count { - ($e: expr, $count: expr) => { - assert_eq!( - no_space.matches(&$e.replace(" ", "")).count(), - $count, - "counting occurences of {:?} in {:?} (whitespace-insensitive)", - $e, - expanded - ) - }; - } - match_count!("struct", 0); - match_count!("ignore_malloc_size_of", 0); - match_count!("impl ::malloc_size_of::MallocSizeOf for Foo where T: ::malloc_size_of::MallocSizeOf {", 1); - match_count!("sum += ::malloc_size_of::MallocSizeOf::size_of(", 2); - - let source = syn::parse_str("struct Bar([Baz; 3]);").unwrap(); - let source = synstructure::Structure::new(&source); - let expanded = malloc_size_of_derive(source).to_string(); - no_space = expanded.replace(" ", ""); - match_count!("for item in", 1); -} - -#[should_panic(expected = "should have an explanation")] -#[test] -fn test_no_reason() { - let input = syn::parse_str("struct A { #[ignore_malloc_size_of] b: C }").unwrap(); - malloc_size_of_derive(synstructure::Structure::new(&input)); -} diff --git a/components/style/Cargo.toml b/components/style/Cargo.toml index 1940219ea74..11aa564bf05 100644 --- a/components/style/Cargo.toml +++ b/components/style/Cargo.toml @@ -44,7 +44,7 @@ itoa = "0.4" lazy_static = "1" log = "0.4" malloc_size_of = { path = "../malloc_size_of" } -malloc_size_of_derive = { path = "../malloc_size_of_derive" } +malloc_size_of_derive = "0.1" matches = "0.1" num_cpus = {version = "1.1.0"} num-integer = "0.1" diff --git a/components/style_traits/Cargo.toml b/components/style_traits/Cargo.toml index c51831a9bcf..53d3baf8845 100644 --- a/components/style_traits/Cargo.toml +++ b/components/style_traits/Cargo.toml @@ -19,7 +19,7 @@ cssparser = "0.25" bitflags = "1.0" euclid = "0.19" malloc_size_of = { path = "../malloc_size_of" } -malloc_size_of_derive = { path = "../malloc_size_of_derive" } +malloc_size_of_derive = "0.1" selectors = { path = "../selectors" } serde = {version = "1.0", optional = true} webrender_api = {git = "https://github.com/servo/webrender", optional = true} From 8101539c0ae1bcc755cf8da75e80a8ea30e39c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 13 Jan 2019 21:42:38 +0100 Subject: [PATCH 7/9] style: Document a few more macros. --- components/style/gecko/regen_atoms.py | 1 + components/style/gecko_string_cache/namespace.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/components/style/gecko/regen_atoms.py b/components/style/gecko/regen_atoms.py index dfc2252aa89..b6f68fceb7d 100755 --- a/components/style/gecko/regen_atoms.py +++ b/components/style/gecko/regen_atoms.py @@ -130,6 +130,7 @@ RULE_TEMPLATE = ''' '''[1:] MACRO_TEMPLATE = ''' +/// Returns a static atom by passing the literal string it represents. #[macro_export] macro_rules! atom {{ {body}\ diff --git a/components/style/gecko_string_cache/namespace.rs b/components/style/gecko_string_cache/namespace.rs index 4aa4accaf1d..725e1da2169 100644 --- a/components/style/gecko_string_cache/namespace.rs +++ b/components/style/gecko_string_cache/namespace.rs @@ -11,6 +11,8 @@ use std::borrow::Borrow; use std::fmt; use std::ops::Deref; +/// In Gecko namespaces are just regular atoms, so this is a simple macro to +/// forward one macro to the other. #[macro_export] macro_rules! ns { () => { From 122f8ed1bb4527373d850e9d17a7a3a64382ccff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 13 Jan 2019 21:46:40 +0100 Subject: [PATCH 8/9] Update references to malloc_size_of_derive, which is in crates.io now. --- Cargo.lock | 36 ++++++++++--------- components/canvas_traits/Cargo.toml | 2 +- components/devtools_traits/Cargo.toml | 2 +- components/geometry/Cargo.toml | 2 +- components/gfx_traits/Cargo.toml | 2 +- components/metrics/Cargo.toml | 2 +- components/msg/Cargo.toml | 2 +- components/net/Cargo.toml | 2 +- components/net_traits/Cargo.toml | 2 +- components/pixels/Cargo.toml | 2 +- components/range/Cargo.toml | 2 +- components/script/Cargo.toml | 2 +- components/script_layout_interface/Cargo.toml | 2 +- components/script_traits/Cargo.toml | 2 +- components/url/Cargo.toml | 2 +- 15 files changed, 33 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ea6c67f8ddd..af16f9929d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -403,7 +403,7 @@ dependencies = [ "ipc-channel 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", - "malloc_size_of_derive 0.0.1", + "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "offscreen_gl_context 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)", "pixels 0.0.1", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", @@ -899,7 +899,7 @@ dependencies = [ "http 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", - "malloc_size_of_derive 0.0.1", + "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "servo_url 0.0.1", @@ -1304,7 +1304,7 @@ name = "gfx_traits" version = "0.0.1" dependencies = [ "malloc_size_of 0.0.1", - "malloc_size_of_derive 0.0.1", + "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "range 0.0.1", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2288,7 +2288,8 @@ dependencies = [ [[package]] name = "malloc_size_of_derive" -version = "0.0.1" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2355,7 +2356,7 @@ dependencies = [ "ipc-channel 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", - "malloc_size_of_derive 0.0.1", + "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "profile_traits 0.0.1", "script_traits 0.0.1", @@ -2529,7 +2530,7 @@ name = "msg" version = "0.0.1" dependencies = [ "malloc_size_of 0.0.1", - "malloc_size_of_derive 0.0.1", + "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "size_of_test 0.0.1", "webrender_api 0.57.2 (git+https://github.com/servo/webrender)", @@ -2564,7 +2565,7 @@ dependencies = [ "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", - "malloc_size_of_derive 0.0.1", + "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", "mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2617,7 +2618,7 @@ dependencies = [ "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", - "malloc_size_of_derive 0.0.1", + "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2914,7 +2915,7 @@ version = "0.0.1" dependencies = [ "euclid 0.19.3 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", - "malloc_size_of_derive 0.0.1", + "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3059,7 +3060,7 @@ name = "range" version = "0.0.1" dependencies = [ "malloc_size_of 0.0.1", - "malloc_size_of_derive 0.0.1", + "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3249,7 +3250,7 @@ dependencies = [ "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", - "malloc_size_of_derive 0.0.1", + "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "metrics 0.0.1", "mime 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", "mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3316,7 +3317,7 @@ dependencies = [ "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", - "malloc_size_of_derive 0.0.1", + "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "metrics 0.0.1", "msg 0.0.1", "net_traits 0.0.1", @@ -3372,7 +3373,7 @@ dependencies = [ "keyboard-types 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", - "malloc_size_of_derive 0.0.1", + "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", "pixels 0.0.1", @@ -3632,7 +3633,7 @@ dependencies = [ "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.19.3 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", - "malloc_size_of_derive 0.0.1", + "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "style_traits 0.0.1", "webrender_api 0.57.2 (git+https://github.com/servo/webrender)", ] @@ -3670,7 +3671,7 @@ name = "servo_url" version = "0.0.1" dependencies = [ "malloc_size_of 0.0.1", - "malloc_size_of_derive 0.0.1", + "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "servo_rand 0.0.1", "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3875,7 +3876,7 @@ dependencies = [ "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", - "malloc_size_of_derive 0.0.1", + "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "num-derive 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3952,7 +3953,7 @@ dependencies = [ "cssparser 0.25.1 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.19.3 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", - "malloc_size_of_derive 0.0.1", + "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.21.0", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "servo_arc 0.1.1", @@ -5011,6 +5012,7 @@ dependencies = [ "checksum mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" "checksum mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "86dd2487cdfea56def77b88438a2c915fb45113c5319bfe7e14306ca4cd0b0e1" "checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +"checksum malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "35adee9ed962cf7d07d62cb58bc45029f3227f5b5b86246caa8632f06c187bc3" "checksum markup5ever 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "897636f9850c3eef4905a5540683ed53dc9393860f0846cab2c2ddf9939862ff" "checksum matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1" "checksum memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0a3eb002f0535929f1199681417029ebea04aadc0c7a4224b46be99c7f5d6a16" diff --git a/components/canvas_traits/Cargo.toml b/components/canvas_traits/Cargo.toml index 59a11368c5b..1e7e17f8b9e 100644 --- a/components/canvas_traits/Cargo.toml +++ b/components/canvas_traits/Cargo.toml @@ -20,7 +20,7 @@ ipc-channel = "0.11" gleam = "0.6.7" lazy_static = "1" malloc_size_of = { path = "../malloc_size_of" } -malloc_size_of_derive = { path = "../malloc_size_of_derive" } +malloc_size_of_derive = "0.1" offscreen_gl_context = {version = "0.21", features = ["serde"]} pixels = {path = "../pixels"} serde = "1.0" diff --git a/components/devtools_traits/Cargo.toml b/components/devtools_traits/Cargo.toml index f3a1868ff4a..2b6de380600 100644 --- a/components/devtools_traits/Cargo.toml +++ b/components/devtools_traits/Cargo.toml @@ -15,7 +15,7 @@ bitflags = "1.0" http = "0.1" ipc-channel = "0.11" malloc_size_of = { path = "../malloc_size_of" } -malloc_size_of_derive = { path = "../malloc_size_of_derive" } +malloc_size_of_derive = "0.1" msg = {path = "../msg"} serde = "1.0" servo_url = {path = "../url"} diff --git a/components/geometry/Cargo.toml b/components/geometry/Cargo.toml index a88b601e562..407fbe81e78 100644 --- a/components/geometry/Cargo.toml +++ b/components/geometry/Cargo.toml @@ -14,6 +14,6 @@ path = "lib.rs" app_units = "0.7" euclid = "0.19" malloc_size_of = { path = "../malloc_size_of" } -malloc_size_of_derive = { path = "../malloc_size_of_derive" } +malloc_size_of_derive = "0.1" style_traits = { path = "../style_traits" } webrender_api = { git = "https://github.com/servo/webrender" } diff --git a/components/gfx_traits/Cargo.toml b/components/gfx_traits/Cargo.toml index c52dbc18912..89e9d2180b1 100644 --- a/components/gfx_traits/Cargo.toml +++ b/components/gfx_traits/Cargo.toml @@ -12,6 +12,6 @@ path = "lib.rs" [dependencies] malloc_size_of = { path = "../malloc_size_of" } -malloc_size_of_derive = { path = "../malloc_size_of_derive" } +malloc_size_of_derive = "0.1" range = {path = "../range"} serde = "1.0" diff --git a/components/metrics/Cargo.toml b/components/metrics/Cargo.toml index ebc90d5f5cd..562126f569d 100644 --- a/components/metrics/Cargo.toml +++ b/components/metrics/Cargo.toml @@ -15,7 +15,7 @@ gfx_traits = {path = "../gfx_traits"} ipc-channel = "0.11" log = "0.4" malloc_size_of = { path = "../malloc_size_of" } -malloc_size_of_derive = { path = "../malloc_size_of_derive" } +malloc_size_of_derive = "0.1" msg = {path = "../msg"} profile_traits = {path = "../profile_traits"} script_traits = {path = "../script_traits"} diff --git a/components/msg/Cargo.toml b/components/msg/Cargo.toml index 815e8962a58..5d8747bdfcf 100644 --- a/components/msg/Cargo.toml +++ b/components/msg/Cargo.toml @@ -14,7 +14,7 @@ doctest = false [dependencies] malloc_size_of = { path = "../malloc_size_of" } -malloc_size_of_derive = { path = "../malloc_size_of_derive" } +malloc_size_of_derive = "0.1" serde = "1.0.60" webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]} diff --git a/components/net/Cargo.toml b/components/net/Cargo.toml index f094e817473..8840d09a2e5 100644 --- a/components/net/Cargo.toml +++ b/components/net/Cargo.toml @@ -33,7 +33,7 @@ ipc-channel = "0.11" lazy_static = "1" log = "0.4" malloc_size_of = { path = "../malloc_size_of" } -malloc_size_of_derive = { path = "../malloc_size_of_derive" } +malloc_size_of_derive = "0.1" matches = "0.1" mime = "0.3" mime_guess = "2.0.0-alpha.6" diff --git a/components/net_traits/Cargo.toml b/components/net_traits/Cargo.toml index f4dd6bd683d..d018f8cdc7d 100644 --- a/components/net_traits/Cargo.toml +++ b/components/net_traits/Cargo.toml @@ -25,7 +25,7 @@ ipc-channel = "0.11" lazy_static = "1" log = "0.4" malloc_size_of = { path = "../malloc_size_of" } -malloc_size_of_derive = { path = "../malloc_size_of_derive" } +malloc_size_of_derive = "0.1" mime = "0.3" msg = {path = "../msg"} num-traits = "0.2" diff --git a/components/pixels/Cargo.toml b/components/pixels/Cargo.toml index 6de6106c337..0d5c9161b26 100644 --- a/components/pixels/Cargo.toml +++ b/components/pixels/Cargo.toml @@ -13,5 +13,5 @@ path = "lib.rs" [dependencies] euclid = "0.19" malloc_size_of = {path = "../malloc_size_of"} -malloc_size_of_derive = {path = "../malloc_size_of_derive"} +malloc_size_of_derive = "0.1" serde = {version = "1", features = ["derive"]} diff --git a/components/range/Cargo.toml b/components/range/Cargo.toml index 8aa28cf8263..38b28ec3a01 100644 --- a/components/range/Cargo.toml +++ b/components/range/Cargo.toml @@ -13,6 +13,6 @@ path = "lib.rs" [dependencies] malloc_size_of = { path = "../malloc_size_of" } -malloc_size_of_derive = { path = "../malloc_size_of_derive" } +malloc_size_of_derive = "0.1" num-traits = "0.2" serde = "1.0" diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index cc27ff73ea8..4d9bde6af9e 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -68,7 +68,7 @@ lazy_static = "1" libc = "0.2" log = "0.4" malloc_size_of = { path = "../malloc_size_of" } -malloc_size_of_derive = { path = "../malloc_size_of_derive" } +malloc_size_of_derive = "0.1" metrics = {path = "../metrics"} mitochondria = "1.1.2" mime = "0.3" diff --git a/components/script_layout_interface/Cargo.toml b/components/script_layout_interface/Cargo.toml index ec88d901742..caae48d943b 100644 --- a/components/script_layout_interface/Cargo.toml +++ b/components/script_layout_interface/Cargo.toml @@ -24,7 +24,7 @@ libc = "0.2" log = "0.4" time = "0.1.17" malloc_size_of = { path = "../malloc_size_of" } -malloc_size_of_derive = { path = "../malloc_size_of_derive" } +malloc_size_of_derive = "0.1" metrics = {path = "../metrics"} msg = {path = "../msg"} net_traits = {path = "../net_traits"} diff --git a/components/script_traits/Cargo.toml b/components/script_traits/Cargo.toml index 43525bfa7bc..40628cce234 100644 --- a/components/script_traits/Cargo.toml +++ b/components/script_traits/Cargo.toml @@ -26,7 +26,7 @@ ipc-channel = "0.11" keyboard-types = "0.4.3" libc = "0.2" malloc_size_of = { path = "../malloc_size_of" } -malloc_size_of_derive = { path = "../malloc_size_of_derive" } +malloc_size_of_derive = "0.1" msg = {path = "../msg"} net_traits = {path = "../net_traits"} pixels = {path = "../pixels"} diff --git a/components/url/Cargo.toml b/components/url/Cargo.toml index b6a97d5ac51..dbbed4f58db 100644 --- a/components/url/Cargo.toml +++ b/components/url/Cargo.toml @@ -12,7 +12,7 @@ path = "lib.rs" [dependencies] malloc_size_of = { path = "../malloc_size_of", features = ["servo"] } -malloc_size_of_derive = { path = "../malloc_size_of_derive" } +malloc_size_of_derive = "0.1" serde = {version = "1.0", features = ["derive"]} servo_rand = {path = "../rand"} url = "1.2" From 2e6d34cad982c1e7d6a8410c0ef86f8b0a7ed7bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 13 Jan 2019 21:49:46 +0100 Subject: [PATCH 9/9] style: Rustfmt recent changes. --- components/style/values/animated/grid.rs | 66 +++++++++++++++--------- components/style/values/computed/box.rs | 3 +- components/style/values/generics/grid.rs | 33 +++--------- components/style/values/specified/mod.rs | 3 +- components/style_derive/animate.rs | 5 +- 5 files changed, 58 insertions(+), 52 deletions(-) diff --git a/components/style/values/animated/grid.rs b/components/style/values/animated/grid.rs index 0943e97cef3..2b59f32e437 100644 --- a/components/style/values/animated/grid.rs +++ b/components/style/values/animated/grid.rs @@ -11,15 +11,19 @@ // Animate for the computed types, instead of the generic types. use super::{Animate, Procedure, ToAnimatedZero}; -use crate::values::computed::{GridTemplateComponent, TrackList, TrackSize}; use crate::values::computed::Integer; use crate::values::computed::LengthPercentage; +use crate::values::computed::{GridTemplateComponent, TrackList, TrackSize}; use crate::values::distance::{ComputeSquaredDistance, SquaredDistance}; use crate::values::generics::grid as generics; fn discrete(from: &T, to: &T, procedure: Procedure) -> Result { if let Procedure::Interpolate { progress } = procedure { - Ok(if progress < 0.5 { from.clone() } else { to.clone() }) + Ok(if progress < 0.5 { + from.clone() + } else { + to.clone() + }) } else { Err(()) } @@ -28,31 +32,31 @@ fn discrete(from: &T, to: &T, procedure: Procedure) -> Result { fn animate_with_discrete_fallback( from: &T, to: &T, - procedure: Procedure + procedure: Procedure, ) -> Result { - from.animate(to, procedure).or_else(|_| discrete(from, to, procedure)) + from.animate(to, procedure) + .or_else(|_| discrete(from, to, procedure)) } impl Animate for TrackSize { fn animate(&self, other: &Self, procedure: Procedure) -> Result { match (self, other) { - (&generics::TrackSize::Breadth(ref from), - &generics::TrackSize::Breadth(ref to)) => { + (&generics::TrackSize::Breadth(ref from), &generics::TrackSize::Breadth(ref to)) => { animate_with_discrete_fallback(from, to, procedure) .map(generics::TrackSize::Breadth) }, - (&generics::TrackSize::Minmax(ref from_min, ref from_max), - &generics::TrackSize::Minmax(ref to_min, ref to_max)) => { - Ok(generics::TrackSize::Minmax( - animate_with_discrete_fallback(from_min, to_min, procedure)?, - animate_with_discrete_fallback(from_max, to_max, procedure)?, - )) - }, - (&generics::TrackSize::FitContent(ref from), - &generics::TrackSize::FitContent(ref to)) => { - animate_with_discrete_fallback(from, to, procedure) - .map(generics::TrackSize::FitContent) - }, + ( + &generics::TrackSize::Minmax(ref from_min, ref from_max), + &generics::TrackSize::Minmax(ref to_min, ref to_max), + ) => Ok(generics::TrackSize::Minmax( + animate_with_discrete_fallback(from_min, to_min, procedure)?, + animate_with_discrete_fallback(from_max, to_max, procedure)?, + )), + ( + &generics::TrackSize::FitContent(ref from), + &generics::TrackSize::FitContent(ref to), + ) => animate_with_discrete_fallback(from, to, procedure) + .map(generics::TrackSize::FitContent), (_, _) => discrete(self, other, procedure), } } @@ -72,8 +76,11 @@ where // length of track_sizes is the same. // https://github.com/w3c/csswg-drafts/issues/3503 match (&self.count, &other.count) { - (&generics::RepeatCount::Number(from), - &generics::RepeatCount::Number(to)) if from == to => (), + (&generics::RepeatCount::Number(from), &generics::RepeatCount::Number(to)) + if from == to => + { + () + }, (_, _) => return Err(()), } @@ -83,7 +90,8 @@ where } let count = self.count; - let track_sizes = self.track_sizes + let track_sizes = self + .track_sizes .iter() .zip(other.track_sizes.iter()) .map(|(a, b)| a.animate(b, procedure)) @@ -93,7 +101,11 @@ where // of |track_sizes|. Besides, is always discrete. let line_names = discrete(&self.line_names, &other.line_names, procedure)?; - Ok(generics::TrackRepeat { count, line_names, track_sizes }) + Ok(generics::TrackRepeat { + count, + line_names, + track_sizes, + }) } } @@ -122,7 +134,8 @@ impl Animate for TrackList { let list_type = self.list_type; let auto_repeat = self.auto_repeat.animate(&other.auto_repeat, procedure)?; - let values = self.values + let values = self + .values .iter() .zip(other.values.iter()) .map(|(a, b)| a.animate(b, procedure)) @@ -131,7 +144,12 @@ impl Animate for TrackList { // of |track_sizes|. Besides, is always discrete. let line_names = discrete(&self.line_names, &other.line_names, procedure)?; - Ok(TrackList { list_type, values, line_names, auto_repeat }) + Ok(TrackList { + list_type, + values, + line_names, + auto_repeat, + }) } } diff --git a/components/style/values/computed/box.rs b/components/style/values/computed/box.rs index 89935e2b4d4..38d021d9829 100644 --- a/components/style/values/computed/box.rs +++ b/components/style/values/computed/box.rs @@ -13,7 +13,8 @@ use crate::values::specified::box_ as specified; pub use crate::values::specified::box_::{AnimationName, Appearance, BreakBetween, BreakWithin}; pub use crate::values::specified::box_::{Clear as SpecifiedClear, Float as SpecifiedFloat}; -pub use crate::values::specified::box_::{Contain, Display, Overflow, OverflowAnchor, OverflowClipBox}; +pub use crate::values::specified::box_::{Contain, Display, Overflow}; +pub use crate::values::specified::box_::{OverflowAnchor, OverflowClipBox}; pub use crate::values::specified::box_::{OverscrollBehavior, ScrollSnapType}; pub use crate::values::specified::box_::{TouchAction, TransitionProperty, WillChange}; diff --git a/components/style/values/generics/grid.rs b/components/style/values/generics/grid.rs index 38516c7a6c4..7dbee9b8dbe 100644 --- a/components/style/values/generics/grid.rs +++ b/components/style/values/generics/grid.rs @@ -174,14 +174,7 @@ pub enum TrackKeyword { /// /// #[derive( - Animate, - Clone, - Debug, - MallocSizeOf, - PartialEq, - SpecifiedValueInfo, - ToComputedValue, - ToCss, + Animate, Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, )] pub enum TrackBreadth { /// The generic type is almost always a non-negative `` @@ -492,14 +485,7 @@ impl TrackRepeat { /// Track list values. Can be or #[derive( - Animate, - Clone, - Debug, - MallocSizeOf, - PartialEq, - SpecifiedValueInfo, - ToComputedValue, - ToCss + Animate, Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, )] pub enum TrackListValue { /// A value. @@ -712,20 +698,17 @@ impl ToCss for LineNameList { /// Subgrid deferred to Level 2 spec due to lack of implementation. /// But it's implemented in gecko, so we have to as well. #[derive( - Animate, - Clone, - Debug, - MallocSizeOf, - PartialEq, - SpecifiedValueInfo, - ToComputedValue, - ToCss + Animate, Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, )] pub enum GridTemplateComponent { /// `none` value. None, /// The grid `` - TrackList(#[animation(field_bound)] #[compute(field_bound)] TrackList), + TrackList( + #[animation(field_bound)] + #[compute(field_bound)] + TrackList, + ), /// A `subgrid ?` /// TODO: Support animations for this after subgrid is addressed in [grid-2] spec. #[animation(error)] diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index d2015f714b5..2cb267045ac 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -36,7 +36,8 @@ pub use self::border::{BorderCornerRadius, BorderImageSlice, BorderImageWidth}; pub use self::border::{BorderImageRepeat, BorderImageSideWidth}; pub use self::border::{BorderRadius, BorderSideWidth, BorderSpacing, BorderStyle}; pub use self::box_::{AnimationIterationCount, AnimationName, Contain, Display}; -pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float, Overflow, OverflowAnchor}; +pub use self::box_::{Appearance, BreakBetween, BreakWithin}; +pub use self::box_::{Clear, Float, Overflow, OverflowAnchor}; pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize}; pub use self::box_::{ScrollSnapType, TouchAction, TransitionProperty, VerticalAlign, WillChange}; pub use self::color::{Color, ColorPropertyValue, RGBAColor}; diff --git a/components/style_derive/animate.rs b/components/style_derive/animate.rs index 6686d2f4453..d9674e444c3 100644 --- a/components/style_derive/animate.rs +++ b/components/style_derive/animate.rs @@ -88,7 +88,10 @@ fn derive_variant_arm( let field_attrs = cg::parse_field_attrs::(&result.ast()); if field_attrs.field_bound { let ty = &this.ast().ty; - cg::add_predicate(where_clause, parse_quote!(#ty: crate::values::animated::Animate)); + cg::add_predicate( + where_clause, + parse_quote!(#ty: crate::values::animated::Animate), + ); } if field_attrs.constant { quote! {