mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Format remaining files
This commit is contained in:
parent
bf47f90da6
commit
cb07debcb6
252 changed files with 5944 additions and 3744 deletions
|
@ -152,11 +152,7 @@ impl Parse for Angle {
|
|||
|
||||
impl Angle {
|
||||
/// Parse an `<angle>` value given a value and an unit.
|
||||
pub fn parse_dimension(
|
||||
value: CSSFloat,
|
||||
unit: &str,
|
||||
was_calc: bool,
|
||||
) -> Result<Angle, ()> {
|
||||
pub fn parse_dimension(value: CSSFloat, unit: &str, was_calc: bool) -> Result<Angle, ()> {
|
||||
let value = match_ignore_ascii_case! { unit,
|
||||
"deg" => AngleDimension::Deg(value),
|
||||
"grad" => AngleDimension::Grad(value),
|
||||
|
@ -200,7 +196,8 @@ impl Angle {
|
|||
return input.parse_nested_block(|i| CalcNode::parse_angle(context, i))
|
||||
},
|
||||
_ => Err(()),
|
||||
}.map_err(|()| input.new_unexpected_token_error(token.clone()))
|
||||
}
|
||||
.map_err(|()| input.new_unexpected_token_error(token.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -275,7 +275,8 @@ impl Ellipse {
|
|||
ShapeRadius::parse(context, i)?,
|
||||
ShapeRadius::parse(context, i)?,
|
||||
))
|
||||
}).unwrap_or_default();
|
||||
})
|
||||
.unwrap_or_default();
|
||||
let position = if input.try(|i| i.expect_ident_matching("at")).is_ok() {
|
||||
Position::parse(context, input)?
|
||||
} else {
|
||||
|
@ -422,7 +423,8 @@ impl Polygon {
|
|||
let fill = FillRule::parse(i)?;
|
||||
i.expect_comma()?; // only eat the comma if there is something before it
|
||||
Ok(fill)
|
||||
}).unwrap_or_default();
|
||||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
let buf = input.parse_comma_separated(|i| {
|
||||
Ok(PolygonCoord(
|
||||
|
@ -459,7 +461,8 @@ impl Path {
|
|||
let fill = FillRule::parse(i)?;
|
||||
i.expect_comma()?;
|
||||
Ok(fill)
|
||||
}).unwrap_or_default();
|
||||
})
|
||||
.unwrap_or_default();
|
||||
let path = SVGPathData::parse(context, input)?;
|
||||
Ok(Path { fill, path })
|
||||
}
|
||||
|
|
|
@ -92,7 +92,8 @@ impl ToComputedValue for BorderSideWidth {
|
|||
BorderSideWidth::Medium => Length::from_px(3.).to_computed_value(context),
|
||||
BorderSideWidth::Thick => Length::from_px(5.).to_computed_value(context),
|
||||
BorderSideWidth::Length(ref length) => length.to_computed_value(context),
|
||||
}.into()
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -182,7 +183,8 @@ impl Parse for BorderSpacing {
|
|||
) -> Result<Self, ParseError<'i>> {
|
||||
Size::parse_with(context, input, |context, input| {
|
||||
Length::parse_non_negative_quirky(context, input, AllowQuirks::Yes).map(From::from)
|
||||
}).map(GenericBorderSpacing)
|
||||
})
|
||||
.map(GenericBorderSpacing)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -529,8 +529,7 @@ impl CalcNode {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<CSSInteger, ParseError<'i>> {
|
||||
Self::parse_number(context, input)
|
||||
.map(|n| n.round() as CSSInteger)
|
||||
Self::parse_number(context, input).map(|n| n.round() as CSSInteger)
|
||||
}
|
||||
|
||||
/// Convenience parsing function for `<length> | <percentage>`.
|
||||
|
|
|
@ -93,7 +93,8 @@ impl Content {
|
|||
.try(|input| {
|
||||
input.expect_comma()?;
|
||||
ListStyleType::parse(input)
|
||||
}).unwrap_or(ListStyleType::Decimal)
|
||||
})
|
||||
.unwrap_or(ListStyleType::Decimal)
|
||||
}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
|
@ -102,7 +103,8 @@ impl Content {
|
|||
.try(|input| {
|
||||
input.expect_comma()?;
|
||||
CounterStyleOrNone::parse(context, input)
|
||||
}).unwrap_or(CounterStyleOrNone::decimal())
|
||||
})
|
||||
.unwrap_or(CounterStyleOrNone::decimal())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,10 +74,9 @@ impl Parse for TimingFunction {
|
|||
Ok(GenericTimingFunction::Steps(steps, position))
|
||||
},
|
||||
_ => Err(()),
|
||||
}).map_err(|()| {
|
||||
location.new_custom_error(
|
||||
StyleParseErrorKind::UnexpectedFunction(function.clone())
|
||||
)
|
||||
})
|
||||
.map_err(|()| {
|
||||
location.new_custom_error(StyleParseErrorKind::UnexpectedFunction(function.clone()))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
@ -733,7 +733,8 @@ impl ToComputedValue for KeywordSize {
|
|||
KeywordSize::XLarge => Au::from_px(FONT_MEDIUM_PX) * 3 / 2,
|
||||
KeywordSize::XXLarge => Au::from_px(FONT_MEDIUM_PX) * 2,
|
||||
KeywordSize::XXXLarge => Au::from_px(FONT_MEDIUM_PX) * 3,
|
||||
}.into()
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -837,7 +838,8 @@ impl FontSize {
|
|||
6 => KeywordSize::XXLarge,
|
||||
// If value is greater than 7, let it be 7.
|
||||
_ => KeywordSize::XXXLarge,
|
||||
}.into(),
|
||||
}
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -906,7 +908,8 @@ impl FontSize {
|
|||
.to_computed_value_zoomed(
|
||||
context,
|
||||
FontBaseSize::InheritedStyleButStripEmUnits,
|
||||
).length_component();
|
||||
)
|
||||
.length_component();
|
||||
|
||||
info = parent.keyword_info.map(|i| i.compose(ratio, abs.into()));
|
||||
}
|
||||
|
@ -2108,7 +2111,8 @@ impl ToComputedValue for FontLanguageOverride {
|
|||
String::from_utf8(buf.to_vec()).unwrap()
|
||||
} else {
|
||||
unsafe { String::from_utf8_unchecked(buf.to_vec()) }
|
||||
}.into_boxed_str(),
|
||||
}
|
||||
.into_boxed_str(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,7 +189,9 @@ impl Image {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Image, ParseError<'i>> {
|
||||
if let Ok(url) = input.try(|input| SpecifiedImageUrl::parse_with_cors_anonymous(context, input)) {
|
||||
if let Ok(url) =
|
||||
input.try(|input| SpecifiedImageUrl::parse_with_cors_anonymous(context, input))
|
||||
{
|
||||
return Ok(generic::Image::Url(url));
|
||||
}
|
||||
Self::parse(context, input)
|
||||
|
@ -1023,7 +1025,8 @@ impl Parse for PaintWorklet {
|
|||
.try(|input| {
|
||||
input.expect_comma()?;
|
||||
input.parse_comma_separated(|input| SpecifiedValue::parse(input))
|
||||
}).unwrap_or(vec![]);
|
||||
})
|
||||
.unwrap_or(vec![]);
|
||||
Ok(PaintWorklet { name, arguments })
|
||||
})
|
||||
}
|
||||
|
|
|
@ -73,10 +73,12 @@ impl SourceSizeList {
|
|||
Some(ref v) => v.to_computed_value(context),
|
||||
None => Length::NoCalc(NoCalcLength::ViewportPercentage(
|
||||
ViewportPercentageLength::Vw(100.),
|
||||
)).to_computed_value(context),
|
||||
))
|
||||
.to_computed_value(context),
|
||||
},
|
||||
}
|
||||
}).into()
|
||||
})
|
||||
.into()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -563,7 +563,6 @@ impl ToAnimatedZero for ArcFlag {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// SVG Path parser.
|
||||
struct PathParser<'a> {
|
||||
chars: Peekable<Cloned<slice::Iter<'a, u8>>>,
|
||||
|
|
|
@ -613,30 +613,40 @@ impl TextEmphasisShapeKeyword {
|
|||
pub fn char(&self, fill: TextEmphasisFillMode) -> &str {
|
||||
let fill = fill == TextEmphasisFillMode::Filled;
|
||||
match *self {
|
||||
TextEmphasisShapeKeyword::Dot => if fill {
|
||||
"\u{2022}"
|
||||
} else {
|
||||
"\u{25e6}"
|
||||
TextEmphasisShapeKeyword::Dot => {
|
||||
if fill {
|
||||
"\u{2022}"
|
||||
} else {
|
||||
"\u{25e6}"
|
||||
}
|
||||
},
|
||||
TextEmphasisShapeKeyword::Circle => if fill {
|
||||
"\u{25cf}"
|
||||
} else {
|
||||
"\u{25cb}"
|
||||
TextEmphasisShapeKeyword::Circle => {
|
||||
if fill {
|
||||
"\u{25cf}"
|
||||
} else {
|
||||
"\u{25cb}"
|
||||
}
|
||||
},
|
||||
TextEmphasisShapeKeyword::DoubleCircle => if fill {
|
||||
"\u{25c9}"
|
||||
} else {
|
||||
"\u{25ce}"
|
||||
TextEmphasisShapeKeyword::DoubleCircle => {
|
||||
if fill {
|
||||
"\u{25c9}"
|
||||
} else {
|
||||
"\u{25ce}"
|
||||
}
|
||||
},
|
||||
TextEmphasisShapeKeyword::Triangle => if fill {
|
||||
"\u{25b2}"
|
||||
} else {
|
||||
"\u{25b3}"
|
||||
TextEmphasisShapeKeyword::Triangle => {
|
||||
if fill {
|
||||
"\u{25b2}"
|
||||
} else {
|
||||
"\u{25b3}"
|
||||
}
|
||||
},
|
||||
TextEmphasisShapeKeyword::Sesame => if fill {
|
||||
"\u{fe45}"
|
||||
} else {
|
||||
"\u{fe46}"
|
||||
TextEmphasisShapeKeyword::Sesame => {
|
||||
if fill {
|
||||
"\u{fe45}"
|
||||
} else {
|
||||
"\u{fe46}"
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue