mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +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
|
@ -166,6 +166,18 @@ impl Image {
|
|||
ref t => Err(location.new_unexpected_token_error(t.clone())),
|
||||
})
|
||||
}
|
||||
|
||||
/// Provides an alternate method for parsing that associates the URL
|
||||
/// with anonymous CORS headers.
|
||||
pub fn parse_with_cors_anonymous<'i, 't>(
|
||||
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)) {
|
||||
return Ok(generic::Image::Url(url));
|
||||
}
|
||||
Self::parse(context, input)
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for Gradient {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue