diff --git a/components/style/gecko/conversions.rs b/components/style/gecko/conversions.rs index 26159c5681cf..5b777e89033b 100644 --- a/components/style/gecko/conversions.rs +++ b/components/style/gecko/conversions.rs @@ -35,7 +35,12 @@ impl nsStyleImage { // Set CropRect let ref mut rect = *self.mCropRect.mPtr; - *rect = Rect(image_rect.top, image_rect.right, image_rect.bottom, image_rect.left); + *rect = Rect( + image_rect.top, + image_rect.right, + image_rect.bottom, + image_rect.left, + ); } }, GenericImage::Element(ref element) => unsafe { diff --git a/components/style/values/animated/effects.rs b/components/style/values/animated/effects.rs index 2a073062fc7e..67557e54b774 100644 --- a/components/style/values/animated/effects.rs +++ b/components/style/values/animated/effects.rs @@ -19,7 +19,8 @@ pub type AnimatedSimpleShadow = GenericSimpleShadow; /// An animated value for a single `filter`. #[cfg(feature = "gecko")] -pub type AnimatedFilter = GenericFilter; +pub type AnimatedFilter = + GenericFilter; /// An animated value for a single `filter`. #[cfg(not(feature = "gecko"))] diff --git a/components/style/values/computed/effects.rs b/components/style/values/computed/effects.rs index bac58cf93abc..b0a92024cad7 100644 --- a/components/style/values/computed/effects.rs +++ b/components/style/values/computed/effects.rs @@ -8,7 +8,7 @@ use crate::values::computed::color::Color; use crate::values::computed::length::{Length, NonNegativeLength}; #[cfg(feature = "gecko")] use crate::values::computed::url::ComputedUrl; -use crate::values::computed::{Angle, ZeroToOneNumber, NonNegativeNumber}; +use crate::values::computed::{Angle, NonNegativeNumber, ZeroToOneNumber}; use crate::values::generics::effects::BoxShadow as GenericBoxShadow; use crate::values::generics::effects::Filter as GenericFilter; use crate::values::generics::effects::SimpleShadow as GenericSimpleShadow; @@ -20,13 +20,25 @@ pub type BoxShadow = GenericBoxShadow; /// A computed value for a single `filter`. #[cfg(feature = "gecko")] -pub type Filter = - GenericFilter; +pub type Filter = GenericFilter< + Angle, + NonNegativeNumber, + ZeroToOneNumber, + NonNegativeLength, + SimpleShadow, + ComputedUrl, +>; /// A computed value for a single `filter`. #[cfg(feature = "servo")] -pub type Filter = - GenericFilter; +pub type Filter = GenericFilter< + Angle, + NonNegativeNumber, + ZeroToOneNumber, + NonNegativeLength, + Impossible, + Impossible, +>; /// A computed value for the `drop-shadow()` filter. pub type SimpleShadow = GenericSimpleShadow; diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs index 620d4e8d2e28..cea768abeff9 100644 --- a/components/style/values/computed/mod.rs +++ b/components/style/values/computed/mod.rs @@ -8,7 +8,7 @@ use self::transform::DirectionVector; use super::animated::ToAnimatedValue; use super::generics::grid::GridTemplateComponent as GenericGridTemplateComponent; use super::generics::grid::{GenericGridLine, GenericTrackBreadth}; -use super::generics::grid::{TrackList as GenericTrackList, GenericTrackSize}; +use super::generics::grid::{GenericTrackSize, TrackList as GenericTrackList}; use super::generics::transform::IsParallelTo; use super::generics::{self, GreaterThanOrEqualToOne, NonNegative, ZeroToOne}; use super::specified; @@ -75,10 +75,10 @@ pub use self::svg::MozContextProperties; pub use self::svg::{SVGLength, SVGOpacity, SVGPaint, SVGPaintKind}; pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth}; pub use self::table::XSpan; +pub use self::text::TextDecorationSkipInk; pub use self::text::{InitialLetter, LetterSpacing, LineBreak, LineHeight}; pub use self::text::{OverflowWrap, TextOverflow, WordBreak, WordSpacing}; pub use self::text::{TextAlign, TextEmphasisPosition, TextEmphasisStyle}; -pub use self::text::TextDecorationSkipInk; pub use self::time::Time; pub use self::transform::{Rotate, Scale, Transform, TransformOperation}; pub use self::transform::{TransformOrigin, TransformStyle, Translate}; diff --git a/components/style/values/computed/text.rs b/components/style/values/computed/text.rs index 9d6f5f4968aa..500595253ff3 100644 --- a/components/style/values/computed/text.rs +++ b/components/style/values/computed/text.rs @@ -19,9 +19,9 @@ use std::fmt::{self, Write}; use style_traits::{CssWriter, ToCss}; pub use crate::values::specified::TextAlignKeyword as TextAlign; -pub use crate::values::specified::{TextTransform, TextDecorationSkipInk}; pub use crate::values::specified::{LineBreak, OverflowWrap, WordBreak}; pub use crate::values::specified::{TextDecorationLine, TextEmphasisPosition}; +pub use crate::values::specified::{TextDecorationSkipInk, TextTransform}; /// A computed value for the `initial-letter` property. pub type InitialLetter = GenericInitialLetter; diff --git a/components/style/values/generics/grid.rs b/components/style/values/generics/grid.rs index c3e761c51962..7de109141fe8 100644 --- a/components/style/values/generics/grid.rs +++ b/components/style/values/generics/grid.rs @@ -5,17 +5,16 @@ //! Generic types for the handling of //! [grids](https://drafts.csswg.org/css-grid/). -use crate::{Atom, Zero}; use crate::parser::{Parse, ParserContext}; use crate::values::specified; use crate::values::specified::grid::parse_line_names; use crate::values::{CSSFloat, CustomIdent}; +use crate::{Atom, Zero}; use cssparser::Parser; use std::fmt::{self, Write}; use std::{cmp, mem, usize}; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; - /// These are the limits that we choose to clamp grid line numbers to. /// http://drafts.csswg.org/css-grid/#overlarge-grids /// line_num is clamped to this range at parse time. @@ -146,7 +145,10 @@ impl Parse for GridLine { return Err(location.new_custom_error(StyleParseErrorKind::UnspecifiedError)); } - grid_line.line_num = specified::Integer::new(cmp::max(MIN_GRID_LINE, cmp::min(value, MAX_GRID_LINE))); + grid_line.line_num = specified::Integer::new(cmp::max( + MIN_GRID_LINE, + cmp::min(value, MAX_GRID_LINE), + )); } else if let Ok(name) = input.try(|i| i.expect_ident_cloned()) { if val_before_span || grid_line.ident != atom!("") { return Err(location.new_custom_error(StyleParseErrorKind::UnspecifiedError)); @@ -230,7 +232,16 @@ impl TrackBreadth { /// /// /// cbindgen:derive-tagged-enum-copy-constructor=true -#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)] +#[derive( + Clone, + Debug, + MallocSizeOf, + PartialEq, + SpecifiedValueInfo, + ToComputedValue, + ToResolvedValue, + ToShmem, +)] #[repr(C, u8)] pub enum GenericTrackSize { /// A flexible `` diff --git a/components/style/values/specified/effects.rs b/components/style/values/specified/effects.rs index 850bb36a4a16..c10445fa62fb 100644 --- a/components/style/values/specified/effects.rs +++ b/components/style/values/specified/effects.rs @@ -7,8 +7,8 @@ use crate::parser::{Parse, ParserContext}; use crate::values::computed::effects::BoxShadow as ComputedBoxShadow; use crate::values::computed::effects::SimpleShadow as ComputedSimpleShadow; -use crate::values::computed::ZeroToOneNumber as ComputedZeroToOneNumber; use crate::values::computed::NonNegativeNumber as ComputedNonNegativeNumber; +use crate::values::computed::ZeroToOneNumber as ComputedZeroToOneNumber; use crate::values::computed::{Context, ToComputedValue}; use crate::values::generics::effects::BoxShadow as GenericBoxShadow; use crate::values::generics::effects::Filter as GenericFilter; @@ -31,13 +31,25 @@ pub type BoxShadow = /// A specified value for a single `filter`. #[cfg(feature = "gecko")] -pub type SpecifiedFilter = - GenericFilter; +pub type SpecifiedFilter = GenericFilter< + Angle, + NonNegativeFactor, + ZeroToOneFactor, + NonNegativeLength, + SimpleShadow, + SpecifiedUrl, +>; /// A specified value for a single `filter`. #[cfg(feature = "servo")] -pub type SpecifiedFilter = - GenericFilter; +pub type SpecifiedFilter = GenericFilter< + Angle, + NonNegativeFactor, + ZeroToOneFactor, + NonNegativeLength, + Impossible, + Impossible, +>; pub use self::SpecifiedFilter as Filter; diff --git a/components/style/values/specified/grid.rs b/components/style/values/specified/grid.rs index edc570d639a1..3e7f8f72a003 100644 --- a/components/style/values/specified/grid.rs +++ b/components/style/values/specified/grid.rs @@ -28,9 +28,7 @@ pub fn parse_flex<'i, 't>(input: &mut Parser<'i, 't>) -> Result TrackBreadth { - fn parse_keyword<'i, 't>( - input: &mut Parser<'i, 't>, - ) -> Result> { + fn parse_keyword<'i, 't>(input: &mut Parser<'i, 't>) -> Result> { #[derive(Parse)] enum TrackKeyword { Auto, diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index 10937f0cf423..56b738b7f802 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -78,10 +78,10 @@ pub use self::svg::{SVGLength, SVGOpacity, SVGPaint, SVGPaintKind}; pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth}; pub use self::svg_path::SVGPathData; pub use self::table::XSpan; -pub use self::text::{TextTransform, TextDecorationSkipInk}; pub use self::text::{InitialLetter, LetterSpacing, LineBreak, LineHeight, TextAlign}; pub use self::text::{OverflowWrap, TextEmphasisPosition, TextEmphasisStyle, WordBreak}; pub use self::text::{TextAlignKeyword, TextDecorationLine, TextOverflow, WordSpacing}; +pub use self::text::{TextDecorationSkipInk, TextTransform}; pub use self::time::Time; pub use self::transform::{Rotate, Scale, Transform}; pub use self::transform::{TransformOrigin, TransformStyle, Translate};