mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Expand the Parser trait to allow anonymous CORS to be applied.
Depends on D5106 Differential Revision: https://phabricator.services.mozilla.com/D5341
This commit is contained in:
parent
b96d44e329
commit
6d57cbd881
3 changed files with 38 additions and 7 deletions
|
@ -71,7 +71,12 @@ impl Parse for ClippingShape {
|
|||
return Ok(ShapeSource::Path(p));
|
||||
}
|
||||
}
|
||||
Self::parse_internal(context, input)
|
||||
|
||||
if let Ok(url) = input.try(|i| SpecifiedUrl::parse(context, i)) {
|
||||
return Ok(ShapeSource::ImageOrUrl(url));
|
||||
}
|
||||
|
||||
Self::parse_common(context, input)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,7 +86,11 @@ impl Parse for FloatAreaShape {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
Self::parse_internal(context, input)
|
||||
if let Ok(image) = input.try(|i| Image::parse_with_cors_anonymous(context, i)) {
|
||||
return Ok(ShapeSource::ImageOrUrl(image));
|
||||
}
|
||||
|
||||
Self::parse_common(context, input)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +100,7 @@ where
|
|||
ImageOrUrl: Parse,
|
||||
{
|
||||
/// The internal parser for ShapeSource.
|
||||
fn parse_internal<'i, 't>(
|
||||
fn parse_common<'i, 't>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
|
@ -99,10 +108,6 @@ where
|
|||
return Ok(ShapeSource::None);
|
||||
}
|
||||
|
||||
if let Ok(image_or_url) = input.try(|i| ImageOrUrl::parse(context, i)) {
|
||||
return Ok(ShapeSource::ImageOrUrl(image_or_url));
|
||||
}
|
||||
|
||||
fn parse_component<U: Parse>(
|
||||
context: &ParserContext,
|
||||
input: &mut Parser,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue