mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Cleanup indentation in a couple places.
This commit is contained in:
parent
50a299f82c
commit
9ace0e43ce
1 changed files with 21 additions and 13 deletions
|
@ -35,14 +35,16 @@ fn is_context_value_enabled() -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_context_value<'i, 't, T>(input: &mut Parser<'i, 't>, value: T)
|
fn parse_context_value<'i, 't, T>(
|
||||||
-> Result<T, ParseError<'i>> {
|
input: &mut Parser<'i, 't>,
|
||||||
if is_context_value_enabled() {
|
value: T,
|
||||||
if input.expect_ident_matching("context-value").is_ok() {
|
) -> Result<T, ParseError<'i>> {
|
||||||
return Ok(value);
|
if !is_context_value_enabled() {
|
||||||
}
|
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
|
||||||
}
|
}
|
||||||
Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError))
|
|
||||||
|
input.expect_ident_matching("context-value")?;
|
||||||
|
Ok(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A value of <length> | <percentage> | <number> for stroke-dashoffset.
|
/// A value of <length> | <percentage> | <number> for stroke-dashoffset.
|
||||||
|
@ -54,8 +56,10 @@ pub type SvgLengthOrPercentageOrNumber =
|
||||||
pub type SVGLength = generic::SVGLength<SvgLengthOrPercentageOrNumber>;
|
pub type SVGLength = generic::SVGLength<SvgLengthOrPercentageOrNumber>;
|
||||||
|
|
||||||
impl Parse for SVGLength {
|
impl Parse for SVGLength {
|
||||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
|
fn parse<'i, 't>(
|
||||||
-> Result<Self, ParseError<'i>> {
|
context: &ParserContext,
|
||||||
|
input: &mut Parser<'i, 't>,
|
||||||
|
) -> Result<Self, ParseError<'i>> {
|
||||||
input.try(|i| SvgLengthOrPercentageOrNumber::parse(context, i))
|
input.try(|i| SvgLengthOrPercentageOrNumber::parse(context, i))
|
||||||
.map(Into::into)
|
.map(Into::into)
|
||||||
.or_else(|_| parse_context_value(input, generic::SVGLength::ContextValue))
|
.or_else(|_| parse_context_value(input, generic::SVGLength::ContextValue))
|
||||||
|
@ -77,8 +81,10 @@ pub type NonNegativeSvgLengthOrPercentageOrNumber =
|
||||||
pub type SVGWidth = generic::SVGLength<NonNegativeSvgLengthOrPercentageOrNumber>;
|
pub type SVGWidth = generic::SVGLength<NonNegativeSvgLengthOrPercentageOrNumber>;
|
||||||
|
|
||||||
impl Parse for SVGWidth {
|
impl Parse for SVGWidth {
|
||||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
|
fn parse<'i, 't>(
|
||||||
-> Result<Self, ParseError<'i>> {
|
context: &ParserContext,
|
||||||
|
input: &mut Parser<'i, 't>,
|
||||||
|
) -> Result<Self, ParseError<'i>> {
|
||||||
input.try(|i| NonNegativeSvgLengthOrPercentageOrNumber::parse(context, i))
|
input.try(|i| NonNegativeSvgLengthOrPercentageOrNumber::parse(context, i))
|
||||||
.map(Into::into)
|
.map(Into::into)
|
||||||
.or_else(|_| parse_context_value(input, generic::SVGLength::ContextValue))
|
.or_else(|_| parse_context_value(input, generic::SVGLength::ContextValue))
|
||||||
|
@ -95,8 +101,10 @@ impl From<NonNegativeSvgLengthOrPercentageOrNumber> for SVGWidth {
|
||||||
pub type SVGStrokeDashArray = generic::SVGStrokeDashArray<NonNegativeSvgLengthOrPercentageOrNumber>;
|
pub type SVGStrokeDashArray = generic::SVGStrokeDashArray<NonNegativeSvgLengthOrPercentageOrNumber>;
|
||||||
|
|
||||||
impl Parse for SVGStrokeDashArray {
|
impl Parse for SVGStrokeDashArray {
|
||||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
|
fn parse<'i, 't>(
|
||||||
-> Result<Self, ParseError<'i>> {
|
context: &ParserContext,
|
||||||
|
input: &mut Parser<'i, 't>,
|
||||||
|
) -> Result<Self, ParseError<'i>> {
|
||||||
if let Ok(values) = input.try(|i| CommaWithSpace::parse(i, |i| {
|
if let Ok(values) = input.try(|i| CommaWithSpace::parse(i, |i| {
|
||||||
NonNegativeSvgLengthOrPercentageOrNumber::parse(context, i)
|
NonNegativeSvgLengthOrPercentageOrNumber::parse(context, i)
|
||||||
})) {
|
})) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue