mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Run rustfmt on selectors, servo_arc, and style.
This was generated with: ./mach cargo fmt --package selectors && ./mach cargo fmt --package servo_arc && ./mach cargo fmt --package style Using rustfmt 0.4.1-nightly (a4462d1 2018-03-26)
This commit is contained in:
parent
f7ae1a37e3
commit
c99bcdd4b8
181 changed files with 9981 additions and 7933 deletions
|
@ -13,19 +13,14 @@ use values::computed::{Percentage as ComputedPercentage, ToComputedValue};
|
|||
use values::computed::transform::TimingFunction as ComputedTimingFunction;
|
||||
use values::generics::transform as generic;
|
||||
use values::generics::transform::{Matrix, Matrix3D, StepPosition, TimingKeyword};
|
||||
use values::specified::{self, Angle, Number, Length, Integer, LengthOrPercentage};
|
||||
use values::specified::{self, Angle, Integer, Length, LengthOrPercentage, Number};
|
||||
use values::specified::position::{Side, X, Y};
|
||||
|
||||
pub use values::generics::transform::TransformStyle;
|
||||
|
||||
/// A single operation in a specified CSS `transform`
|
||||
pub type TransformOperation = generic::TransformOperation<
|
||||
Angle,
|
||||
Number,
|
||||
Length,
|
||||
Integer,
|
||||
LengthOrPercentage,
|
||||
>;
|
||||
pub type TransformOperation =
|
||||
generic::TransformOperation<Angle, Number, Length, Integer, LengthOrPercentage>;
|
||||
|
||||
/// A specified CSS `transform`
|
||||
pub type Transform = generic::Transform<TransformOperation>;
|
||||
|
@ -55,8 +50,7 @@ impl Transform {
|
|||
let function = input.expect_function()?.clone();
|
||||
input.parse_nested_block(|input| {
|
||||
let location = input.current_source_location();
|
||||
let result =
|
||||
match_ignore_ascii_case! { &function,
|
||||
let result = match_ignore_ascii_case! { &function,
|
||||
"matrix" => {
|
||||
let a = Number::parse(context, input)?;
|
||||
input.expect_comma()?;
|
||||
|
@ -220,8 +214,10 @@ impl Transform {
|
|||
},
|
||||
_ => Err(()),
|
||||
};
|
||||
result
|
||||
.map_err(|()| location.new_custom_error(StyleParseErrorKind::UnexpectedFunction(function.clone())))
|
||||
result.map_err(|()| {
|
||||
location
|
||||
.new_custom_error(StyleParseErrorKind::UnexpectedFunction(function.clone()))
|
||||
})
|
||||
})
|
||||
})?))
|
||||
}
|
||||
|
@ -230,7 +226,7 @@ impl Transform {
|
|||
impl Parse for Transform {
|
||||
fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
Transform::parse_internal(context, input)
|
||||
}
|
||||
|
@ -251,11 +247,14 @@ pub enum OriginComponent<S> {
|
|||
pub type TimingFunction = generic::TimingFunction<Integer, Number>;
|
||||
|
||||
impl Parse for TransformOrigin {
|
||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
let parse_depth = |input: &mut Parser| {
|
||||
input.try(|i| Length::parse(context, i)).unwrap_or(
|
||||
Length::from_px(0.),
|
||||
)
|
||||
input
|
||||
.try(|i| Length::parse(context, i))
|
||||
.unwrap_or(Length::from_px(0.))
|
||||
};
|
||||
match input.try(|i| OriginComponent::parse(context, i)) {
|
||||
Ok(x_origin @ OriginComponent::Center) => {
|
||||
|
@ -305,7 +304,10 @@ impl<S> Parse for OriginComponent<S>
|
|||
where
|
||||
S: Parse,
|
||||
{
|
||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if input.try(|i| i.expect_ident_matching("center")).is_ok() {
|
||||
return Ok(OriginComponent::Center);
|
||||
}
|
||||
|
@ -325,7 +327,9 @@ where
|
|||
|
||||
fn to_computed_value(&self, context: &Context) -> Self::ComputedValue {
|
||||
match *self {
|
||||
OriginComponent::Center => ComputedLengthOrPercentage::Percentage(ComputedPercentage(0.5)),
|
||||
OriginComponent::Center => {
|
||||
ComputedLengthOrPercentage::Percentage(ComputedPercentage(0.5))
|
||||
},
|
||||
OriginComponent::Length(ref length) => length.to_computed_value(context),
|
||||
OriginComponent::Side(ref keyword) => {
|
||||
let p = ComputedPercentage(if keyword.is_start() { 0. } else { 1. });
|
||||
|
@ -360,13 +364,15 @@ fn allow_frames_timing() -> bool {
|
|||
}
|
||||
|
||||
impl Parse for TimingFunction {
|
||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if let Ok(keyword) = input.try(TimingKeyword::parse) {
|
||||
return Ok(generic::TimingFunction::Keyword(keyword));
|
||||
}
|
||||
if let Ok(ident) = input.try(|i| i.expect_ident_cloned()) {
|
||||
let position =
|
||||
match_ignore_ascii_case! { &ident,
|
||||
let position = match_ignore_ascii_case! { &ident,
|
||||
"step-start" => StepPosition::Start,
|
||||
"step-end" => StepPosition::End,
|
||||
_ => return Err(input.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone()))),
|
||||
|
@ -409,7 +415,9 @@ impl Parse for TimingFunction {
|
|||
}
|
||||
},
|
||||
_ => Err(()),
|
||||
}).map_err(|()| location.new_custom_error(StyleParseErrorKind::UnexpectedFunction(function.clone())))
|
||||
}).map_err(|()| {
|
||||
location.new_custom_error(StyleParseErrorKind::UnexpectedFunction(function.clone()))
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -421,12 +429,7 @@ impl ToComputedValue for TimingFunction {
|
|||
fn to_computed_value(&self, context: &Context) -> Self::ComputedValue {
|
||||
match *self {
|
||||
generic::TimingFunction::Keyword(keyword) => generic::TimingFunction::Keyword(keyword),
|
||||
generic::TimingFunction::CubicBezier {
|
||||
x1,
|
||||
y1,
|
||||
x2,
|
||||
y2,
|
||||
} => {
|
||||
generic::TimingFunction::CubicBezier { x1, y1, x2, y2 } => {
|
||||
generic::TimingFunction::CubicBezier {
|
||||
x1: x1.to_computed_value(context),
|
||||
y1: y1.to_computed_value(context),
|
||||
|
@ -452,17 +455,16 @@ impl ToComputedValue for TimingFunction {
|
|||
ref y1,
|
||||
ref x2,
|
||||
ref y2,
|
||||
} => {
|
||||
generic::TimingFunction::CubicBezier {
|
||||
x1: Number::from_computed_value(x1),
|
||||
y1: Number::from_computed_value(y1),
|
||||
x2: Number::from_computed_value(x2),
|
||||
y2: Number::from_computed_value(y2),
|
||||
}
|
||||
},
|
||||
generic::TimingFunction::Steps(steps, position) => {
|
||||
generic::TimingFunction::Steps(Integer::from_computed_value(&(steps as i32)), position)
|
||||
} => generic::TimingFunction::CubicBezier {
|
||||
x1: Number::from_computed_value(x1),
|
||||
y1: Number::from_computed_value(y1),
|
||||
x2: Number::from_computed_value(x2),
|
||||
y2: Number::from_computed_value(y2),
|
||||
},
|
||||
generic::TimingFunction::Steps(steps, position) => generic::TimingFunction::Steps(
|
||||
Integer::from_computed_value(&(steps as i32)),
|
||||
position,
|
||||
),
|
||||
generic::TimingFunction::Frames(frames) => {
|
||||
generic::TimingFunction::Frames(Integer::from_computed_value(&(frames as i32)))
|
||||
},
|
||||
|
@ -476,7 +478,7 @@ pub type Rotate = generic::Rotate<Number, Angle>;
|
|||
impl Parse for Rotate {
|
||||
fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if input.try(|i| i.expect_ident_matching("none")).is_ok() {
|
||||
return Ok(generic::Rotate::None);
|
||||
|
@ -502,7 +504,7 @@ pub type Translate = generic::Translate<LengthOrPercentage, Length>;
|
|||
impl Parse for Translate {
|
||||
fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if input.try(|i| i.expect_ident_matching("none")).is_ok() {
|
||||
return Ok(generic::Translate::None);
|
||||
|
@ -530,7 +532,7 @@ pub type Scale = generic::Scale<Number>;
|
|||
impl Parse for Scale {
|
||||
fn parse<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if input.try(|i| i.expect_ident_matching("none")).is_ok() {
|
||||
return Ok(generic::Scale::None);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue