mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Update to cssparser 0.22 (source location in error types)
This commit is contained in:
parent
056e599562
commit
c0f8f15f39
90 changed files with 974 additions and 790 deletions
|
@ -11,7 +11,7 @@ use cssparser::Parser;
|
|||
use parser::{Parse, ParserContext};
|
||||
use std::borrow::Cow;
|
||||
use std::fmt;
|
||||
use style_traits::{ToCss, ParseError, StyleParseError};
|
||||
use style_traits::{ToCss, ParseError, StyleParseErrorKind};
|
||||
use values::computed::Percentage;
|
||||
use values::generics::basic_shape::{Circle as GenericCircle};
|
||||
use values::generics::basic_shape::{ClippingShape as GenericClippingShape, Ellipse as GenericEllipse};
|
||||
|
@ -81,7 +81,7 @@ impl<ReferenceBox: Parse> Parse for ShapeSource<BasicShape, ReferenceBox, Specif
|
|||
return Ok(ShapeSource::Shape(shp, ref_box))
|
||||
}
|
||||
|
||||
ref_box.map(|v| ShapeSource::Box(v)).ok_or(StyleParseError::UnspecifiedError.into())
|
||||
ref_box.map(|v| ShapeSource::Box(v)).ok_or(input.new_custom_error(StyleParseErrorKind::UnspecifiedError))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ impl Parse for GeometryBox {
|
|||
return Ok(GeometryBox::ShapeBox(shape_box))
|
||||
}
|
||||
|
||||
try_match_ident_ignore_ascii_case! { input.expect_ident()?,
|
||||
try_match_ident_ignore_ascii_case! { input,
|
||||
"fill-box" => Ok(GeometryBox::FillBox),
|
||||
"stroke-box" => Ok(GeometryBox::StrokeBox),
|
||||
"view-box" => Ok(GeometryBox::ViewBox),
|
||||
|
@ -101,6 +101,7 @@ impl Parse for GeometryBox {
|
|||
|
||||
impl Parse for BasicShape {
|
||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
let location = input.current_source_location();
|
||||
let function = input.expect_function()?.clone();
|
||||
input.parse_nested_block(move |i| {
|
||||
(match_ignore_ascii_case! { &function,
|
||||
|
@ -109,7 +110,7 @@ impl Parse for BasicShape {
|
|||
"ellipse" => return Ellipse::parse_function_arguments(context, i).map(GenericBasicShape::Ellipse),
|
||||
"polygon" => return Polygon::parse_function_arguments(context, i).map(GenericBasicShape::Polygon),
|
||||
_ => Err(())
|
||||
}).map_err(|()| StyleParseError::UnexpectedFunction(function.clone()).into())
|
||||
}).map_err(|()| location.new_custom_error(StyleParseErrorKind::UnexpectedFunction(function.clone())))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -229,7 +230,7 @@ impl Parse for ShapeRadius {
|
|||
return Ok(GenericShapeRadius::Length(lop))
|
||||
}
|
||||
|
||||
try_match_ident_ignore_ascii_case! { input.expect_ident()?,
|
||||
try_match_ident_ignore_ascii_case! { input,
|
||||
"closest-side" => Ok(GenericShapeRadius::ClosestSide),
|
||||
"farthest-side" => Ok(GenericShapeRadius::FarthestSide),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue