mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Implemented paint worklet arguments.
This commit is contained in:
parent
d859734702
commit
d101f9c945
8 changed files with 78 additions and 27 deletions
|
@ -9,6 +9,7 @@
|
|||
|
||||
use Atom;
|
||||
use cssparser::{Parser, Token, BasicParseError};
|
||||
use custom_properties::SpecifiedValue;
|
||||
use parser::{Parse, ParserContext};
|
||||
use selectors::parser::SelectorParseError;
|
||||
#[cfg(feature = "servo")]
|
||||
|
@ -874,12 +875,17 @@ impl Parse for ColorStop {
|
|||
}
|
||||
|
||||
impl Parse for PaintWorklet {
|
||||
fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
input.expect_function_matching("paint")?;
|
||||
input.parse_nested_block(|i| {
|
||||
let name = i.expect_ident()?;
|
||||
input.parse_nested_block(|input| {
|
||||
let name = Atom::from(&**input.expect_ident()?);
|
||||
let arguments = input.try(|input| {
|
||||
input.expect_comma()?;
|
||||
input.parse_comma_separated(|input| Ok(*SpecifiedValue::parse(context, input)?))
|
||||
}).unwrap_or(vec![]);
|
||||
Ok(PaintWorklet {
|
||||
name: Atom::from(name.as_ref()),
|
||||
name: name,
|
||||
arguments: arguments,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue