Skip to content

Commit

Permalink
style: rustfmt recent changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
emilio committed Jul 8, 2019
1 parent 069c0b0 commit 1af30fa
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 23 deletions.
7 changes: 6 additions & 1 deletion components/style/gecko/conversions.rs
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion components/style/values/animated/effects.rs
Expand Up @@ -19,7 +19,8 @@ pub type AnimatedSimpleShadow = GenericSimpleShadow<Color, Length, Length>;

/// An animated value for a single `filter`.
#[cfg(feature = "gecko")]
pub type AnimatedFilter = GenericFilter<Angle, Number, Number, Length, AnimatedSimpleShadow, ComputedUrl>;
pub type AnimatedFilter =
GenericFilter<Angle, Number, Number, Length, AnimatedSimpleShadow, ComputedUrl>;

/// An animated value for a single `filter`.
#[cfg(not(feature = "gecko"))]
Expand Down
22 changes: 17 additions & 5 deletions components/style/values/computed/effects.rs
Expand Up @@ -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;
Expand All @@ -20,13 +20,25 @@ pub type BoxShadow = GenericBoxShadow<Color, Length, NonNegativeLength, Length>;

/// A computed value for a single `filter`.
#[cfg(feature = "gecko")]
pub type Filter =
GenericFilter<Angle, NonNegativeNumber, ZeroToOneNumber, NonNegativeLength, SimpleShadow, ComputedUrl>;
pub type Filter = GenericFilter<
Angle,
NonNegativeNumber,
ZeroToOneNumber,
NonNegativeLength,
SimpleShadow,
ComputedUrl,
>;

/// A computed value for a single `filter`.
#[cfg(feature = "servo")]
pub type Filter =
GenericFilter<Angle, NonNegativeNumber, ZeroToOneNumber, NonNegativeLength, Impossible, Impossible>;
pub type Filter = GenericFilter<
Angle,
NonNegativeNumber,
ZeroToOneNumber,
NonNegativeLength,
Impossible,
Impossible,
>;

/// A computed value for the `drop-shadow()` filter.
pub type SimpleShadow = GenericSimpleShadow<Color, Length, NonNegativeLength>;
4 changes: 2 additions & 2 deletions components/style/values/computed/mod.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion components/style/values/computed/text.rs
Expand Up @@ -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<CSSFloat, CSSInteger>;
Expand Down
19 changes: 15 additions & 4 deletions components/style/values/generics/grid.rs
Expand Up @@ -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.
Expand Down Expand Up @@ -146,7 +145,10 @@ impl Parse for GridLine<specified::Integer> {
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));
Expand Down Expand Up @@ -230,7 +232,16 @@ impl<L> TrackBreadth<L> {
/// <https://drafts.csswg.org/css-grid/#typedef-track-size>
///
/// 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<L> {
/// A flexible `<track-breadth>`
Expand Down
22 changes: 17 additions & 5 deletions components/style/values/specified/effects.rs
Expand Up @@ -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;
Expand All @@ -31,13 +31,25 @@ pub type BoxShadow =

/// A specified value for a single `filter`.
#[cfg(feature = "gecko")]
pub type SpecifiedFilter =
GenericFilter<Angle, NonNegativeFactor, ZeroToOneFactor, NonNegativeLength, SimpleShadow, SpecifiedUrl>;
pub type SpecifiedFilter = GenericFilter<
Angle,
NonNegativeFactor,
ZeroToOneFactor,
NonNegativeLength,
SimpleShadow,
SpecifiedUrl,
>;

/// A specified value for a single `filter`.
#[cfg(feature = "servo")]
pub type SpecifiedFilter =
GenericFilter<Angle, NonNegativeFactor, ZeroToOneFactor, NonNegativeLength, Impossible, Impossible>;
pub type SpecifiedFilter = GenericFilter<
Angle,
NonNegativeFactor,
ZeroToOneFactor,
NonNegativeLength,
Impossible,
Impossible,
>;

pub use self::SpecifiedFilter as Filter;

Expand Down
4 changes: 1 addition & 3 deletions components/style/values/specified/grid.rs
Expand Up @@ -28,9 +28,7 @@ pub fn parse_flex<'i, 't>(input: &mut Parser<'i, 't>) -> Result<CSSFloat, ParseE
}

impl<L> TrackBreadth<L> {
fn parse_keyword<'i, 't>(
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
fn parse_keyword<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
#[derive(Parse)]
enum TrackKeyword {
Auto,
Expand Down
2 changes: 1 addition & 1 deletion components/style/values/specified/mod.rs
Expand Up @@ -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};
Expand Down

0 comments on commit 1af30fa

Please sign in to comment.