mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Rustfmt.
This commit is contained in:
parent
c4ad61faa5
commit
80dae5bc59
28 changed files with 145 additions and 107 deletions
|
@ -11,9 +11,9 @@ use crate::values::generics::box_::Perspective as GenericPerspective;
|
|||
use crate::values::generics::box_::VerticalAlign as GenericVerticalAlign;
|
||||
use crate::values::specified::box_ as specified;
|
||||
|
||||
pub use crate::values::specified::box_::Clear as SpecifiedClear;
|
||||
pub use crate::values::specified::box_::{AnimationName, Appearance, BreakBetween, BreakWithin};
|
||||
pub use crate::values::specified::box_::{Clear as SpecifiedClear};
|
||||
pub use crate::values::specified::box_::{Float as SpecifiedFloat, Contain, Display, Overflow};
|
||||
pub use crate::values::specified::box_::{Contain, Display, Float as SpecifiedFloat, Overflow};
|
||||
pub use crate::values::specified::box_::{OverflowAnchor, OverflowClipBox, OverscrollBehavior};
|
||||
pub use crate::values::specified::box_::{
|
||||
ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStrictness, ScrollSnapType,
|
||||
|
|
|
@ -35,9 +35,9 @@ use style_traits::{CssWriter, ParseError, ToCss};
|
|||
use to_shmem::{self, SharedMemoryBuilder, ToShmem};
|
||||
|
||||
pub use crate::values::computed::Length as MozScriptMinSize;
|
||||
pub use crate::values::specified::Integer as SpecifiedInteger;
|
||||
pub use crate::values::specified::font::{FontSynthesis, MozScriptSizeMultiplier};
|
||||
pub use crate::values::specified::font::{XLang, XTextZoom};
|
||||
pub use crate::values::specified::Integer as SpecifiedInteger;
|
||||
|
||||
/// A value for the font-weight property per:
|
||||
///
|
||||
|
|
|
@ -7,15 +7,15 @@
|
|||
//!
|
||||
//! [image]: https://drafts.csswg.org/css-images/#image-values
|
||||
|
||||
use crate::values::computed::position::Position;
|
||||
use crate::values::computed::percentage::Percentage;
|
||||
use crate::values::computed::position::Position;
|
||||
use crate::values::computed::url::ComputedImageUrl;
|
||||
#[cfg(feature = "gecko")]
|
||||
use crate::values::computed::NumberOrPercentage;
|
||||
use crate::values::computed::{Angle, Color, Context};
|
||||
use crate::values::computed::{
|
||||
AngleOrPercentage, LengthPercentage, NonNegativeLength, NonNegativeLengthPercentage,
|
||||
ToComputedValue, Resolution,
|
||||
Resolution, ToComputedValue,
|
||||
};
|
||||
use crate::values::generics::image::{self as generic, GradientCompatMode};
|
||||
use crate::values::specified::image as specified;
|
||||
|
@ -26,7 +26,8 @@ use style_traits::{CssWriter, ToCss};
|
|||
|
||||
/// Computed values for an image according to CSS-IMAGES.
|
||||
/// <https://drafts.csswg.org/css-images/#image-values>
|
||||
pub type Image = generic::GenericImage<Gradient, MozImageRect, ComputedImageUrl, Color, Percentage, Resolution>;
|
||||
pub type Image =
|
||||
generic::GenericImage<Gradient, MozImageRect, ComputedImageUrl, Color, Percentage, Resolution>;
|
||||
|
||||
/// Computed values for a CSS gradient.
|
||||
/// <https://drafts.csswg.org/css-images/#gradients>
|
||||
|
@ -116,7 +117,6 @@ impl ToComputedValue for specified::ImageSet {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// Computed values for `-moz-image-rect(...)`.
|
||||
#[cfg(feature = "gecko")]
|
||||
pub type MozImageRect = generic::GenericMozImageRect<NumberOrPercentage, ComputedImageUrl>;
|
||||
|
|
|
@ -265,9 +265,9 @@ impl LengthPercentage {
|
|||
CalcLengthPercentageLeaf::Length(l) => {
|
||||
Self::new_length(Length::new(clamping_mode.clamp(l.px())).normalized())
|
||||
},
|
||||
CalcLengthPercentageLeaf::Percentage(p) => {
|
||||
Self::new_percent(Percentage(clamping_mode.clamp(crate::values::normalize(p.0))))
|
||||
},
|
||||
CalcLengthPercentageLeaf::Percentage(p) => Self::new_percent(Percentage(
|
||||
clamping_mode.clamp(crate::values::normalize(p.0)),
|
||||
)),
|
||||
}
|
||||
},
|
||||
_ => Self::new_calc_unchecked(Box::new(CalcLengthPercentage {
|
||||
|
|
|
@ -71,7 +71,7 @@ pub use self::list::MozListReversed;
|
|||
pub use self::list::Quotes;
|
||||
pub use self::motion::{OffsetPath, OffsetRotate};
|
||||
pub use self::outline::OutlineStyle;
|
||||
pub use self::page::{Orientation, PaperSize, PageSize};
|
||||
pub use self::page::{Orientation, PageSize, PaperSize};
|
||||
pub use self::percentage::{NonNegativePercentage, Percentage};
|
||||
pub use self::position::AspectRatio;
|
||||
pub use self::position::{
|
||||
|
|
|
@ -59,10 +59,10 @@ pub enum GenericImage<G, MozImageRect, ImageUrl, Color, Percentage, Resolution>
|
|||
pub use self::GenericImage as Image;
|
||||
|
||||
/// <https://drafts.csswg.org/css-images-4/#cross-fade-function>
|
||||
#[css(comma, function = "cross-fade")]
|
||||
#[derive(
|
||||
Clone, Debug, MallocSizeOf, PartialEq, ToResolvedValue, ToShmem, ToCss, ToComputedValue,
|
||||
)]
|
||||
#[css(comma, function = "cross-fade")]
|
||||
#[repr(C)]
|
||||
pub struct GenericCrossFade<Image, Color, Percentage> {
|
||||
/// All of the image percent pairings passed as arguments to
|
||||
|
@ -74,14 +74,7 @@ pub struct GenericCrossFade<Image, Color, Percentage> {
|
|||
/// A `<percent> | none` value. Represents optional percentage values
|
||||
/// assosicated with cross-fade images.
|
||||
#[derive(
|
||||
Clone,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
ToComputedValue,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
ToCss,
|
||||
Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem, ToCss,
|
||||
)]
|
||||
#[repr(C, u8)]
|
||||
pub enum PercentOrNone<Percentage> {
|
||||
|
@ -94,14 +87,7 @@ pub enum PercentOrNone<Percentage> {
|
|||
|
||||
/// An optional percent and a cross fade image.
|
||||
#[derive(
|
||||
Clone,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
ToComputedValue,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
ToCss,
|
||||
Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem, ToCss,
|
||||
)]
|
||||
#[repr(C)]
|
||||
pub struct GenericCrossFadeElement<Image, Color, Percentage> {
|
||||
|
@ -115,15 +101,7 @@ pub struct GenericCrossFadeElement<Image, Color, Percentage> {
|
|||
/// An image or a color. `cross-fade` takes either when blending
|
||||
/// images together.
|
||||
#[derive(
|
||||
Clone,
|
||||
Debug,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
ToComputedValue,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
ToCss,
|
||||
Parse,
|
||||
Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem, ToCss,
|
||||
)]
|
||||
#[repr(C, u8)]
|
||||
pub enum GenericCrossFadeImage<I, C> {
|
||||
|
@ -139,10 +117,8 @@ pub use self::GenericCrossFadeElement as CrossFadeElement;
|
|||
pub use self::GenericCrossFadeImage as CrossFadeImage;
|
||||
|
||||
/// https://drafts.csswg.org/css-images-4/#image-set-notation
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToResolvedValue, ToShmem, ToCss)]
|
||||
#[css(comma, function = "image-set")]
|
||||
#[derive(
|
||||
Clone, Debug, MallocSizeOf, PartialEq, ToResolvedValue, ToShmem, ToCss,
|
||||
)]
|
||||
#[repr(C)]
|
||||
pub struct GenericImageSet<Image, Resolution> {
|
||||
/// The index of the selected candidate. Zero for specified values.
|
||||
|
|
|
@ -496,9 +496,7 @@ where
|
|||
let t = t.to_pixel_length(reference_height)? as f64;
|
||||
Transform3D::translation(0., t, 0.)
|
||||
},
|
||||
TranslateZ(ref z) => {
|
||||
Transform3D::translation(0., 0., z.to_pixel_length(None)? as f64)
|
||||
},
|
||||
TranslateZ(ref z) => Transform3D::translation(0., 0., z.to_pixel_length(None)? as f64),
|
||||
Skew(theta_x, theta_y) => Transform3D::skew(
|
||||
euclid::Angle::radians(theta_x.radians64()),
|
||||
euclid::Angle::radians(theta_y.radians64()),
|
||||
|
|
|
@ -2325,14 +2325,18 @@ impl Parse for MathDepth {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<MathDepth, ParseError<'i>> {
|
||||
if input.try_parse(|i| i.expect_ident_matching("auto-add")).is_ok() {
|
||||
if input
|
||||
.try_parse(|i| i.expect_ident_matching("auto-add"))
|
||||
.is_ok()
|
||||
{
|
||||
return Ok(MathDepth::AutoAdd);
|
||||
}
|
||||
if let Ok(math_depth_value) = input.try_parse(|input| Integer::parse(context, input)) {
|
||||
return Ok(MathDepth::Absolute(math_depth_value));
|
||||
}
|
||||
input.expect_function_matching("add")?;
|
||||
let math_depth_delta_value = input.parse_nested_block(|input| Integer::parse(context, input))?;
|
||||
let math_depth_delta_value =
|
||||
input.parse_nested_block(|input| Integer::parse(context, input))?;
|
||||
Ok(MathDepth::Add(math_depth_delta_value))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ use crate::values::specified::position::{Position, PositionComponent, Side};
|
|||
use crate::values::specified::url::SpecifiedImageUrl;
|
||||
use crate::values::specified::{
|
||||
Angle, AngleOrPercentage, Color, Length, LengthPercentage, NonNegativeLength,
|
||||
NonNegativeLengthPercentage, Resolution
|
||||
NonNegativeLengthPercentage, Resolution,
|
||||
};
|
||||
use crate::values::specified::{Number, NumberOrPercentage, Percentage};
|
||||
use crate::Atom;
|
||||
|
@ -36,7 +36,8 @@ use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss};
|
|||
|
||||
/// Specified values for an image according to CSS-IMAGES.
|
||||
/// <https://drafts.csswg.org/css-images/#image-values>
|
||||
pub type Image = generic::Image<Gradient, MozImageRect, SpecifiedImageUrl, Color, Percentage, Resolution>;
|
||||
pub type Image =
|
||||
generic::Image<Gradient, MozImageRect, SpecifiedImageUrl, Color, Percentage, Resolution>;
|
||||
|
||||
/// Specified values for a CSS gradient.
|
||||
/// <https://drafts.csswg.org/css-images/#gradients>
|
||||
|
@ -194,7 +195,9 @@ impl Image {
|
|||
if allow_none && input.try_parse(|i| i.expect_ident_matching("none")).is_ok() {
|
||||
return Ok(generic::Image::None);
|
||||
}
|
||||
if let Ok(url) = input.try_parse(|input| SpecifiedImageUrl::parse_with_cors_mode(context, input, cors_mode)) {
|
||||
if let Ok(url) = input
|
||||
.try_parse(|input| SpecifiedImageUrl::parse_with_cors_mode(context, input, cors_mode))
|
||||
{
|
||||
return Ok(generic::Image::Url(url));
|
||||
}
|
||||
if let Ok(gradient) = input.try_parse(|i| Gradient::parse(context, i)) {
|
||||
|
@ -218,7 +221,9 @@ impl Image {
|
|||
}
|
||||
#[cfg(feature = "gecko")]
|
||||
{
|
||||
if let Ok(image_rect) = input.try_parse(|input| MozImageRect::parse(context, input, cors_mode)) {
|
||||
if let Ok(image_rect) =
|
||||
input.try_parse(|input| MozImageRect::parse(context, input, cors_mode))
|
||||
{
|
||||
return Ok(generic::Image::Rect(Box::new(image_rect)));
|
||||
}
|
||||
Ok(generic::Image::Element(Image::parse_element(input)?))
|
||||
|
@ -254,7 +259,12 @@ impl Image {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Image, ParseError<'i>> {
|
||||
Self::parse_with_cors_mode(context, input, CorsMode::Anonymous, /* allow_none = */ true)
|
||||
Self::parse_with_cors_mode(
|
||||
context,
|
||||
input,
|
||||
CorsMode::Anonymous,
|
||||
/* allow_none = */ true,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -299,8 +309,10 @@ impl CrossFadeImage {
|
|||
input: &mut Parser<'i, 't>,
|
||||
cors_mode: CorsMode,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if let Ok(image) = input.try_parse(|input| Image::parse_with_cors_mode(context, input, cors_mode, /* allow_none = */ false)) {
|
||||
return Ok(Self::Image(image))
|
||||
if let Ok(image) = input.try_parse(|input| {
|
||||
Image::parse_with_cors_mode(context, input, cors_mode, /* allow_none = */ false)
|
||||
}) {
|
||||
return Ok(Self::Image(image));
|
||||
}
|
||||
Ok(Self::Color(Color::parse(context, input)?))
|
||||
}
|
||||
|
@ -334,7 +346,7 @@ impl ImageSet {
|
|||
})?;
|
||||
Ok(Self {
|
||||
selected_index: 0,
|
||||
items: items.into()
|
||||
items: items.into(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -346,14 +358,19 @@ impl ImageSetItem {
|
|||
cors_mode: CorsMode,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
let image = match input.try_parse(|i| i.expect_url_or_string()) {
|
||||
Ok(url) => Image::Url(SpecifiedImageUrl::parse_from_string(url.as_ref().into(), context, cors_mode)),
|
||||
Err(..) => Image::parse_with_cors_mode(context, input, cors_mode, /* allow_none = */ false)?,
|
||||
Ok(url) => Image::Url(SpecifiedImageUrl::parse_from_string(
|
||||
url.as_ref().into(),
|
||||
context,
|
||||
cors_mode,
|
||||
)),
|
||||
Err(..) => Image::parse_with_cors_mode(
|
||||
context, input, cors_mode, /* allow_none = */ false,
|
||||
)?,
|
||||
};
|
||||
let resolution = input.try_parse(|input| Resolution::parse(context, input)).unwrap_or(Resolution::X(1.0));
|
||||
Ok(Self {
|
||||
image,
|
||||
resolution,
|
||||
})
|
||||
let resolution = input
|
||||
.try_parse(|input| Resolution::parse(context, input))
|
||||
.unwrap_or(Resolution::X(1.0));
|
||||
Ok(Self { image, resolution })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ pub use self::list::MozListReversed;
|
|||
pub use self::list::Quotes;
|
||||
pub use self::motion::{OffsetPath, OffsetRotate};
|
||||
pub use self::outline::OutlineStyle;
|
||||
pub use self::page::{Orientation, PaperSize, PageSize};
|
||||
pub use self::page::{Orientation, PageSize, PaperSize};
|
||||
pub use self::percentage::Percentage;
|
||||
pub use self::position::AspectRatio;
|
||||
pub use self::position::{
|
||||
|
@ -122,8 +122,8 @@ pub mod length;
|
|||
pub mod list;
|
||||
pub mod motion;
|
||||
pub mod outline;
|
||||
pub mod percentage;
|
||||
pub mod page;
|
||||
pub mod percentage;
|
||||
pub mod position;
|
||||
pub mod ratio;
|
||||
pub mod rect;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue